/** * * @return int|bool */ public function save() { $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $dbAdapter->beginTransaction(); try { $row = $this->_checkOcupation($this->_data); if (!empty($row)) { $this->_message->addMessage('Okupasaun Internasional iha tiha ona.', App_Message::ERROR); return false; } $mapperMiniGroup = new Register_Model_Mapper_ProfMiniGroup(); $miniGroup = $mapperMiniGroup->fetchRow($this->_data['fk_id_profminigroup']); $this->_data['acronym'] = $miniGroup->acronym . $this->_data['acronym']; if (empty($this->_data['id_profocupation'])) { $history = 'INSERE OCUPASAUN INTERNASIONAU: %s DADUS PRINCIPAL - INSERE NOVO OCUPASAUN INTERNASIONAU'; } else { $history = 'ALTERA OCUPASAUN INTERNASIONAU: %s DADUS PRINCIPAL - ALTERA OCUPASAUN INTERNASIONAU'; } $id = parent::_simpleSave(); $history = sprintf($history, $this->_data['ocupation_name']); $this->_sysAudit($history); $dbAdapter->commit(); return $id; } catch (Exception $e) { $dbAdapter->rollBack(); $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR); return false; } }