[Vtigercrm-developers] Default Date V6Beta

Daniel Thompson developingdanny at gmail.com
Tue Aug 13 15:28:01 UTC 2013


Hi Guys,

A slight step back in my book but in version 5.4.0 you set the default date
to today.

Now it's blank and annoying to put this back every time :(

9 / 10 times when creating an invoice the invoice date is today.

I've added a quick patch on my beta version to cater for this for my
testing as it started to get annoying.

modules>Vtiger>uitypes>Date.php

Made mine bold.

public function getEditViewDisplayValue($value) {
        if (empty($value) || $value === ' ') {
            $value = trim($value);
            $fieldInstance =
$this->get('field')->getWebserviceFieldObject();
            $moduleName = $this->get('field')->getModule()->getName();
            $fieldName = $fieldInstance->getFieldName();

            //Restricted Fields for to show Default Value
            if (($fieldName === 'birthday' && $moduleName === 'Contacts')
                    || ($fieldName === 'validtill' && $moduleName ===
'Quotes')
                    || $moduleName === 'Products' ) {
                return $value;
            }

            //Special Condition for field 'support_end_date' in Contacts
Module
            if ($fieldName === 'support_end_date' && $moduleName ===
'Contacts') {
                $value = DateTimeField::convertToUserFormat(date('Y-m-d',
strtotime("+1 year")));
            } elseif ($fieldName === 'support_start_date' && $moduleName
=== 'Contacts') {
                $value = DateTimeField::convertToUserFormat(date('Y-m-d'));
            }
           * else
            {
                $value = DateTimeField::convertToUserFormat(date('Y-m-d'));
            }*
        } else {
            $value = DateTimeField::convertToUserFormat($value);
        }
        return $value;
    }

regards

Danny
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20130813/b1055ac7/attachment.html>


More information about the vtigercrm-developers mailing list