Ejemplo n.º 1
0
 /**
  * 
  * @return int|bool
  */
 public function save()
 {
     $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
     $dbAdapter->beginTransaction();
     try {
         $row = $this->_checkClass($this->_data);
         if (!empty($row)) {
             $this->_message->addMessage('Klase Setor Industria iha tiha ona.', App_Message::ERROR);
             return false;
         }
         $mapperGroup = new Register_Model_Mapper_IsicGroup();
         $miniGroup = $mapperGroup->fetchRow($this->_data['fk_id_isicgroup']);
         $this->_data['acronym'] = $miniGroup->acronym . $this->_data['acronym'];
         if (empty($this->_data['id_isicclass'])) {
             $history = 'INSERE CLASSE: %s';
         } else {
             $history = 'ALTERA ALTERA CLASSE: %s';
         }
         $id = parent::_simpleSave();
         $history = sprintf($history, $this->_data['acronym']);
         $this->_sysAudit($history);
         $dbAdapter->commit();
         return $id;
     } catch (Exception $e) {
         $dbAdapter->rollBack();
         $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR);
         return false;
     }
 }
Ejemplo n.º 2
0
 /**
  * 
  */
 public function searchGroupAction()
 {
     $mapperIsicGroup = new Register_Model_Mapper_IsicGroup();
     $rows = $mapperIsicGroup->listAll($this->_getParam('id'));
     $opts = array(array('id' => '', 'name' => ''));
     foreach ($rows as $row) {
         $opts[] = array('id' => $row->id_isicgroup, 'name' => $row->name_group);
     }
     $this->_helper->json($opts);
 }