Tuesday, October 20, 2015

Cakephp Inline Editing

I'm working on a project for Payroll Dept. I have included inline editing feature in my code.

When the user edits start date, the program should calculate and update the hours field by subtracting the stop date from start date. I'm stuck on the calculation part giving an error "Unsupported Operand Types". Below is my code snippet

case 'event_date':
           
             if ($this->request->data['Leave']['event_date'] == $value) {
                   
                    $stop = $this->Leave->find('first', array('conditions' => array('event_date' => $value)));
                    $this->set('stop',$stop['Leave']['event_stop_time']);
                   
                    $start = $this->request->data['Leave']['event_date'];
                                   
                    $hours = ($stop - $start);
                    $this->request->data['Leave']['hours'] = $hours;
                    $this->set('updated_value', $hours);
               
             }

Any form of help is much appreciated as I'm a newbie to cakephp

Thanks

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: