Ejemplo n.º 1
0
 public function operationstatechangeajaxAction()
 {
     try {
         $mapper = new Gyuser_Model_OperationsDataMapper();
         $obj = new Gyuser_Model_Operations();
         $request = $this->getRequest();
         if ($this->getRequest()->isPost()) {
             $this->_helper->layout->disableLayout();
             $this->_helper->viewRenderer->setNoRender();
             $operationId = $request->operation_id;
             $stateId = (int) $request->state_id;
             $obj->setId($operationId);
             $obj->setState($stateId);
             $chequesList = null;
             $chequeId = null;
             switch ($stateId) {
                 //step2
                 case 2:
                     $obj->setCave_id($request->cave_id);
                     break;
                     //step3
                 //step3
                 case 3:
                     //report approved
                 //report approved
                 case 4:
                     //report denied
                     $obj->setReport($request->report);
                     break;
                     //step 4
                 //step 4
                 case 5:
                     $chequesList = $request->cheques_list;
                     $obj->setAmount($request->total_amount);
                     $obj->setPlan_id($request->plan_id);
                     $obj->setInterests_id($request->interests_id);
                     break;
                 case 8:
                 case 9:
                     $chequeId = $request->id;
                     $chequesList = $request->cheques_list;
                     $obj->setAmount($request->total_amount);
                     $obj->setPlan_id($request->plan_id);
                     break;
                     //step 5
                 //step 5
                 case 6:
                     //en camino
                 //en camino
                 case 7:
                     //en camino lavalle
                 //en camino lavalle
                 case 99:
                     //cancel op.
                 //cancel op.
                 default:
                     break;
             }
             $result = $mapper->OperationStateChange($obj, $chequesList, $chequeId);
             if ($result) {
                 echo $result;
             } else {
                 echo "f";
             }
         }
     } catch (Exception $e) {
         echo $e;
     }
 }