示例#1
0
 public function save(Gyuser_Model_User $User)
 {
     $data = array("client_type" => $User->getClient_type(), "first_name" => $User->getFirst_name(), "last_name" => $User->getLast_name(), "DNI" => $User->getDNI(), "CUIL" => $User->getCUIL(), "tel_cell" => $User->getTel_cell(), "tel_lab" => $User->getTel_lab(), "tel_otro" => $User->getTel_otro(), "tel_part" => $User->getTel_part(), "tel_lab_code" => $User->getTel_lab_code(), "tel_otro_code" => $User->getTel_otro_code(), "tel_part_code" => $User->getTel_part_code(), "email" => $User->getEmail(), "activity" => $User->getActivity(), "date_added" => $User->getDate_added(), "operator" => (int) $User->getOperator(), "contact_point" => $User->getContact_point(), "extra_info" => $User->getExtra_info(), "business" => $User->getBusiness(), "business_CUIT" => $User->getBusiness_CUIT(), "type_change" => $User->getType_change());
     if (null === ($id = $User->getId())) {
         unset($data['id']);
         $id = $this->getDbTable()->insert($data);
         if ($id) {
             $MultiAddressJson = $User->getMulti_address_json();
             $addressMapper = new Gyuser_Model_AddressDataMapper();
             $addresssJsonResult = $addressMapper->saveWithJson($MultiAddressJson, $id);
             $MultiPriorJson = $User->getMulti_prior_json();
             $priorMapper = new Gyuser_Model_PriorOperationsDataMapper();
             $PriorJsonResult = $priorMapper->saveWithJson($MultiPriorJson, $id);
         }
         return $id;
     } else {
         $id = $this->getDbTable()->update($data, array('id = ?' => $id));
         return $id;
     }
 }
示例#2
0
 public function userpriorformajaxAction()
 {
     try {
         $request = $this->getRequest();
         if ($this->getRequest()->isPost()) {
             $mapper = new Gyuser_Model_PriorOperationsDataMapper();
             $Obj = new Gyuser_Model_PriorOperations();
             if ($request->date) {
                 list($Day, $Month, $Year) = explode('/', $request->date);
                 $stampeddate = mktime(12, 0, 0, $Month, $Day, $Year);
                 $next_check_date = date("Y-m-d", $stampeddate);
             } else {
                 $next_check_date = null;
             }
             $Obj->setDate($next_check_date);
             $Obj->setIs_operation_completed($request->is_operation_completed);
             $Obj->setCave_name($request->cave_name);
             $Obj->setAmount($request->amount);
             $Obj->setNext_check_date($request->next_check_date);
             $Obj->setPending_checks($request->pending_checks);
             $Obj->setIs_last_operation($request->is_last_operation);
             if ($request->next_check_date) {
                 list($Day, $Month, $Year) = explode('/', $request->next_check_date);
                 $stampeddate = mktime(12, 0, 0, $Month, $Day, $Year);
                 $next_check_date = date("Y-m-d", $stampeddate);
             } else {
                 $next_check_date = null;
             }
             $Obj->setNext_check_date($next_check_date);
             $Obj->setClient_id($request->client_id);
             if ($request->id) {
                 $Obj->setId($request->id);
             }
             $this->_helper->layout->disableLayout();
             $this->_helper->viewRenderer->setNoRender();
             $id = $mapper->save($Obj);
             if ($id) {
                 echo $id;
             } else {
                 echo "f";
             }
         }
     } catch (Exception $e) {
         echo $e;
     }
 }