/** * */ public function searchUserCeopAction() { $userCeop = $this->_mapper->searchUserCeop($this->_getParam('id')); $return = array(); if (!empty($userCeop)) { $return = array('id' => $userCeop->id_sysuser); } $this->_helper->json($return); }
/** * * @access public * @return boolean */ public function loginExternal() { $valid = false; try { $auth = Zend_Auth::getInstance(); $auth->getStorage()->clear(); unset($this->_session->client); $mapperClient = new Client_Model_Mapper_Client(); $selectClient = $mapperClient->selectClient(); $selectClient->where('CONCAT( c.num_district, "-", c.num_subdistrict, "-", c.num_servicecode, "-", c.num_year, "-", c.num_sequence) = ?', $this->_data['evidence_card'])->where('DATE_FORMAT( c.birth_date, "%d/%m/%Y" ) = ?', $this->_data['birth_date'])->where('c.active = ?', 1); $dbPerData = App_Model_DbTable_Factory::get('PerData'); $client = $dbPerData->fetchRow($selectClient); // Check is there is client with evidence card and date birth if (!empty($client)) { $userBusinessMapper = new Admin_Model_Mapper_UserBusiness(); $userCeop = $userBusinessMapper->searchUserCeop($client->fk_id_dec); // Check if there is user defined for its ceop. if (!empty($userCeop)) { $auth->getStorage()->write($this->detailUser($userCeop->id_sysuser)); $this->_session->client = $client; $valid = true; } } return $valid; } catch (Exception $e) { return $valid; } }