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; } }
public function getDetailsByOpId($opId) { $table = $this->getDbTable(); $select = $table->select(); $select->setIntegrityCheck(false); $select->from(array('ope' => 'operations'), array('id', 'client_id', 'bank_account_id', 'date', 'ac_date', 'state_change', 'client_id')); $select->where('ope.id = ?', $opId); $row = $table->fetchRow($select); if ($row) { $op = new Gyuser_Model_Operations(); $op->setId($opId); $op->setClient_id($row->client_id); $op->setBank_account_id($row->bank_account_id); $op->setAc_date($row->ac_date); return $op; } else { return null; } }