vtiger Forum Index vtiger
The Honest Open Source CRM
 

Default date on custom date fields
Click here to go to the original topic
Goto page 1, 2  Next
 
       vtiger Forum Index -> Code Contributions - 4.x
Previous topic :: Next topic  
Author Message
kether



Joined: 01 Aug 2006
Posts: 6
Location: Clarksville, AR

Posted: Tue Aug 01, 2006 3:36 pm    Post subject: Default date on custom date fields  

In 4.24, empty custom date fields automatically get filled with the current date whenever you add or edit a record (lead, contact, or account).

Does anybody know what file controls this behavior? I really need to change things so that empty date fields stay empty until deliberately filled. On forms with many custom dates, it can get pretty tiresome having to clear them all in edit view every time one thing needs to be updated.

I hope sombody can help me--thanks in advance....

Louis
Back to top  
BrianLaughlin



Joined: 13 Dec 2005
Posts: 801

Posted: Tue Aug 01, 2006 3:59 pm    Post subject: Default date on custom date fields  

Known bugs

http://vtiger.fosslabs.com/cgi-bin/trac.cgi/ticket/73

http://vtiger.fosslabs.com/cgi-bin/trac.cgi/ticket/1504

Regards,
Back to top  
kether



Joined: 01 Aug 2006
Posts: 6
Location: Clarksville, AR

Posted: Tue Aug 01, 2006 4:07 pm    Post subject: Re: Default date on custom date fields  

Thanks Brian.

Looks like it was fixed recently in beta 2: http://vtiger.fosslabs.com/cgi-bin/trac.cgi/ticket/1469

Wish it was something easy I could just change in 4.24.

Louis
Back to top  
kether



Joined: 01 Aug 2006
Posts: 6
Location: Clarksville, AR

Posted: Tue Aug 01, 2006 4:12 pm    Post subject: Re: Default date on custom date fields  

Interesting....

I just tried the online demo of beta 2, and you can't add a custom field at all!

Same thing happened with the version I downloaded.

Guess it's really not fixed yet....

Louis
Back to top  
ales



Joined: 13 Jun 2006
Posts: 18
Location: Slovenia

Posted: Tue Aug 01, 2006 5:09 pm    Post subject: Re: Default date on custom date fields  

Ok, let me see..try this

In file ../apache/htdocs/include/utils.php under function getOutputHtml() change next lines:
..
{
if( $fieldname != 'birthday' )
$disp_value = getNewDisplayDate();
..
//this is your check for custom field you are looking for
if( $fieldname == 'custom_field_name' ) {

//your code goes here

}


THAT'S IT

By Ales
Back to top  
kether



Joined: 01 Aug 2006
Posts: 6
Location: Clarksville, AR

Posted: Wed Aug 02, 2006 12:15 am    Post subject: Re: Default date on custom date fields  

Ales, that's awesome.

I just commented out the two lines

if( $fieldname != 'birthday' )
$disp_value = getNewDisplayDate();

and it works! No more default today's dates!

Thank you so much.....

Louis
Back to top  
kether



Joined: 01 Aug 2006
Posts: 6
Location: Clarksville, AR

Posted: Wed Aug 02, 2006 1:46 am    Post subject: Re: Default date on custom date fields  

One more thing I had to do....

After commenting out those lines, the system still tried to put "00-00-0000" into the custom date fields. To fix that, in the same file, I went to this function: getDisplayDate($cur_date_val) near the bottom.

Just above the last line of the function that reads return $display_date; I put in this conditional:

if($display_date == '00-00-0000' || $display_date == '0000-00-00')
$display_date = ''; (two single quotes).

Now it works and keeps the custom date fields blank until you actually enter something. Ales, thanks again for pointing me in the right direction.

Louis
Back to top  
KLeo



Joined: 19 Nov 2005
Posts: 198

Posted: Fri Aug 04, 2006 7:52 am    Post subject: Re: Default date on custom date fields  

I think, I have a solution.

Please test it, I have now not server to test it.

Change in include/utils.php by function getOutputHtml

the code:

Code: if($fieldname != 'birthday' && $fieldname != 'due_date')

into:

Code: if($fieldname != 'birthday' && $fieldname != 'due_date' && substr('$fieldname', 0, 3)!= 'cf_')

Best regards,
Kleo
Back to top  
Zuzvub



Joined: 07 Aug 2006
Posts: 1
Location: USA

Posted: Mon Aug 07, 2006 2:57 pm    Post subject:  

Great information
Back to top  
KLeo



Joined: 19 Nov 2005
Posts: 198

Posted: Thu Aug 17, 2006 10:01 am    Post subject:  

I have test it, it work correct.

Change in include/utils.php by function getOutputHtml

the code:

Code:
if($fieldname != 'birthday' && $fieldname != 'due_date')


into:


Code: if($fieldname != 'birthday' && $fieldname != 'due_date' && substr($fieldname, 0, 3)!= 'cf_')


Best regards,
Kleo
Back to top  
 
       vtiger Forum Index -> Code Contributions - 4.x Goto page 1, 2  Next
Page 1 of 2


Powered by phpBB Search Engine Indexer
Powered by phpBB 2.0.15 © 2001, 2002 phpBB Group