コード例 #1
0
 public function operationsformajaxAction()
 {
     try {
         $this->_helper->layout->disableLayout();
         $this->_helper->viewRenderer->setNoRender();
         $request = $this->getRequest();
         if ($this->getRequest()->isPost()) {
             $mapper = new Gyuser_Model_OperationsDataMapper();
             $Obj = new Gyuser_Model_Operations();
             $Obj->setClient_id($request->client_id);
             date_default_timezone_set('Europe/Vienna');
             list($Day, $Month, $Year) = explode('/', $request->date);
             $stampeddate = mktime(12, 0, 0, $Month, $Day, $Year);
             $realDate = date("Y-m-d", $stampeddate);
             $Obj->setDate($realDate);
             $Obj->setAmount($request->amount);
             $Obj->setState($request->state);
             $Obj->setObservations($request->observations);
             $Obj->setCave_id($request->cave);
             $Obj->setBank_account_id($request->bank_account_id);
             if ($request->id) {
                 $Obj->setId($request->id);
             }
             $id = $mapper->save($Obj);
             if ($id) {
                 //set client type to active
                 $clientMapper = new Gyuser_Model_UserDataMapper();
                 $clientObj = new Gyuser_Model_User();
                 $clientObj->setId($request->client_id);
                 $clientObj->setClient_type(3);
                 //active
                 $clientMapper->UpdateUserType($clientObj);
                 echo $id;
             } else {
                 echo "f";
             }
         }
     } catch (Exception $e) {
         echo $e;
     }
 }