AnsweredAssumed Answered

$bean->save ignoring Datetime values in Datetime fields

Question asked by community-support on Jan 13, 2014
Latest reply on Jan 13, 2014 by community-support
i created a new custom module and insert values to its field in a 'before_save' logic hook.

All the fields values are indeed saved in the new module except the Datetime field.

the value i put in the DateTime field reset to null in the saved module:


                 $milestone = new cs_Milestones();

// other fields...

                 $milestone->ml_case_type_c = $Timer->case_type_c;

                 $milestone->ml_case_priority_c = $Timer->case_priority_c;

                 $milestone->timer_trigger_c = $Timer->timer_trigger_c;

                 $milestone->case_response_type_c = $Timer->case_response_type_c;

// DateTime field

                 $milestone->elapsed_c = CalculateElapsedDateTime($Timer->timer_duration_c, $Timer->timer_duration_period_c,$Timer->case_type_c);

                 $GLOBALS['log']->fatal('milestone is = ' . $milestone->elapsed_c->format('Y-m-d H:i:s'));   // shows : 2013-12-26 11:40:12



all the fields are saved right except the DateTime is empty , although i rechecked that it has a value before the save (as you can see above)

i read this post but didn't understand what to do....

Can someone please help. (using SugarCRM 6.5.13)

(from rodnikosh)