vtiger Forum Index vtiger
The Honest Open Source CRM
 

DueDate sync with DateStart 4.2.x
Click here to go to the original topic

 
       vtiger Forum Index -> Code Contributions - 4.x
Previous topic :: Next topic  
Author Message
ales



Joined: 13 Jun 2006
Posts: 18
Location: Slovenia

Posted: Tue Aug 01, 2006 5:00 pm    Post subject: DueDate sync with DateStart 4.2.x  

When DateStart is inserted or modified, DueDate is synced with value of DateStart. You can also add additional check...

The following lines are copy/paste from my code

1. In file ../apache/htdocs/include/utils.php under function getOutputHtml() change next lines:
..
{
if( $fieldname != 'birthday' )
$disp_value = getNewDisplayDate();
..
if( $fieldname == 'date_start' ) {

//modified line
$custfld .= '<td width="30%"><input onchange="due_date.value=this.value;" name="'.$fieldname.'" id="jscal_field_'.$fieldname.'" type="text" size="11" maxlength="10" value="'.$disp_value.'"> <img src="themes/'.$theme.'/images/calendar.gif" id="jscal_trigger_'.$fieldname.'">';

}else{

$custfld .= '<td width="30%"><input name="'.$fieldname.'" id="jscal_field_'.$fieldname.'" type="text" size="11" maxlength="10" value="'.$disp_value.'"> <img src="themes/'.$theme.'/images/calendar.gif" id="jscal_trigger_'.$fieldname.'">';
}


THAT'S IT

Ok, in future there will be patch available for this feature.

By Ales
Back to top  
KLeo



Joined: 19 Nov 2005
Posts: 198

Posted: Wed Aug 02, 2006 8:27 am    Post subject: DueDate sync with DateStart 4.2.x  

Hi Ales!

it is a good idea.

A other good option would be:
a custom field types "Date" shold be blank. (Currently is custom field allways current data).

Regards,
kleo
Back to top  
silverdad



Joined: 30 Jan 2006
Posts: 26
Location: France

Posted: Wed Aug 02, 2006 12:46 pm    Post subject: Re: DueDate sync with DateStart 4.2.x  

hi ales

good point ! thank for your contribution !

i just want to add a minor fix to this code :
the code works fine except for date & time picker emails
so add the following :

if( ($fieldname == 'date_start') && ($_REQUEST['module']!='Emails'))
$custfld .= '<td width="30%"><input onchange="due_date.value=this.value;" name="'.$fieldname.'" id="jscal_field_'.$fieldname.'" type="text" size="11" maxlength="10" value="'.$disp_value.'"> <img src="themes/'.$theme.'/images/calendar.gif" id="jscal_trigger_'.$fieldname.'">';
else $custfld .= '<td width="30%"><input name="'.$fieldname.'" id="jscal_field_'.$fieldname.'" type="text" size="11" maxlength="10" value="'.$disp_value.'"> <img src="themes/'.$theme.'/images/calendar.gif" id="jscal_trigger_'.$fieldname.'">';

moreover , you can add an easy way to set start_date and due_date to today date
add few lines above this minor fix

if($uitype == 5 || $uitype == 6 || $uitype ==23)
{
$vtlog->logthis("uitype is ".$uitype,'info');

if($value=='')
{
// modif by silverdad to set due_date as today date
//if($fieldname != 'birthday' && $fieldname != 'due_date') $disp_value=getNewDisplayDate();
if($fieldname != 'birthday' ) $disp_value=getNewDisplayDate();
}
else {
$disp_value = getDisplayDate($value);
}

.....

that all !
Back to top  
ales



Joined: 13 Jun 2006
Posts: 18
Location: Slovenia

Posted: Wed Aug 02, 2006 1:08 pm    Post subject: Re: DueDate sync with DateStart 4.2.x  

Hi All,

Exactly... The basic code was new point ... and like silverdad added new stuff .. this are the reasons for my contribution, that all will participate and try/test new code.

Will be back with new stuff :)

By Ales
Back to top  
 
       vtiger Forum Index -> Code Contributions - 4.x
Page 1 of 1


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