Page 1 of 1

before_update code

Posted: 2015-12-23 23:11
by grimblefritz
I've looked through the forums, faqs, etc, and I thought I had this right. I guess not.

Code: Select all

  function job_before_update(&$data, $memberInfo, &$args){
    $data['next_date'] = calc_next_date($data['service_date']);
    return TRUE;
  }

  function calc_next_date($service_date){
    return '1/1/2001';
  }
There are indeed fields in the job table named service_date and next_date.

When I edit a record, instead of getting 1/1/2001 in next_date, it remains blank.

What am I missing?

Once I see this basic hook work, I will be coding a proper calc_next_date(), of course.

Thanks!

Re: before_update code

Posted: 2015-12-24 11:45
by grimblefritz
I got this sorted. It seems the date must be in Y-m-d (2001-01-01) format.