/** * * @return int|bool */ public function save() { $validStatuses = $this->_getValidStatuses(); if (!in_array($this->_data['status'], $validStatuses)) { throw new Exception($this->_data['status'] . ' is not a valid status'); } // Inactivate the last status $dataUpdate = array('status' => 0, 'date_finished' => Zend_Date::now()->toString('yyyy-MM-dd HH:mm:ss')); $whereUpdate = array('fk_id_fefop_contract = ?' => $this->_data['contract'], 'status = ?' => 1); $this->_dbTable->update($dataUpdate, $whereUpdate); $data = array('fk_id_fefop_contract' => $this->_data['contract'], 'fk_id_fefop_status' => $this->_data['status'], 'fk_id_sysuser' => Zend_Auth::getInstance()->getIdentity()->id_sysuser, 'status' => 1); // If there is description to be inserted if (!empty($this->_data['description'])) { $mapperFollowUp = new Fefop_Model_Mapper_Followup(); $data['fk_id_fefop_followup'] = $mapperFollowUp->saveFollowUp($this->_data['contract'], $this->_data['description']); } else { if (!empty($this->_data['id_fefop_followup'])) { $data['fk_id_fefop_followup'] = $this->_data['id_fefop_followup']; } } return $this->_dbTable->createRow($data)->save(); }
/** * */ public function listFollowupAction() { $this->view->rows = $this->_mapper->listFollowups($this->_getParam('id')); }