i have the following fields:
autoContactInt (integer)
setAutoContact (enum Y/N)
nextContactDate (varchar 15) - in PHPR, edit as "date" ... drop down boxes with date picker
here is what i want to do...
on edit:
if setAutoContact == Y,
nextContactDate = now() + autoContactInt
currently i have tried...
in the Before Record Updated i added the following custom code:
if ($values['setAutoContact'] == 'Y'){
$followup = mktime(0, 0, 0, date("m"), date("d")+10, date("y"));
$values['nextContact'] = $followup;
}
note: the +10 is just for debugging rigt now... want to change this to $values[]'autoContactInt'] once this is working....
however, after editing a record i am getting the following ouput aftering refreshing the edit screen:
day drop down: 13
month drop down: empty
year drop down: 12
and in the list view: 0012/00/13 (the list view is set to "view as" short date
as a sidenote i also tried this code:
this works!!!
if ($values['setAutoContact'] == 'Y'){
$values['nextContact'] = date("Y-m-d",strtotime("+3
day"));
}
return true;
Changed to this:
This doesn't work!!!
if ($values['setAutoContact'] == 'Y'){
$days = $values['autoContactInt'];
$values['nextContact'] = date("Y-m-d",strtotime("+".$days." day"));
}
return true;
and it does NOT work... results in the following date: 1969/12/31
Help?