Пример #1
0
 public function ValidateCUIL(Gyuser_Model_User $obj)
 {
     $id = (int) $obj->getId();
     $CUIL = $obj->getCUIL();
     if (trim($CUIL) == '') {
         return true;
     }
     if (!$id) {
         $query = "SELECT count(CUIL) as CUIL_count,id FROM clients WHERE CUIL = '{$CUIL}' and status = 1 ";
     } else {
         $query = "SELECT count(CUIL) as CUIL_count,id FROM clients WHERE CUIL = '{$CUIL}' and status = 1 and id != {$id}";
     }
     $db = Zend_Db_Table::getDefaultAdapter();
     $stmt = $db->query($query);
     $row = $stmt->fetchAll();
     $count = $row[0]['CUIL_count'];
     if ($count) {
         $cObj = new Gyuser_Model_Operator();
         $cId = $row[0]['id'];
         $cObj->setId($cId);
         $cObj = $this->findClientNames($cObj);
         $First_name = $cObj->getFirst_name();
         $Last_name = $cObj->getLast_name();
         $rArr = array('f_name' => $First_name, 'l_name' => $Last_name);
         return $rArr;
     } else {
         return true;
     }
 }