/** * updates status , last transaction and disconnect time in requests table * where request_id * * overridden from parent Np_Method * * @return bool */ public function saveToDB() { if (parent::saveToDB() === FALSE) { return FALSE; } $updateArray = array('status' => 1, 'last_transaction' => $this->getHeaderField("MSG_TYPE"), 'disconnect_time' => Application_Model_General::getDateTimeInSqlFormat($this->getBodyField("DISCONNECT_TIME"))); // if it's execute_response that leaves, status => 0 (no more actions) if ($this->getHeaderField("FROM") == Application_Model_General::getSettings('InternalProvider')) { $updateArray['status'] = 0; } $whereArray = array('request_id =?' => $this->getHeaderField("REQUEST_ID")); $tbl = new Application_Model_DbTable_Requests(Np_Db::master()); return $tbl->update($updateArray, $whereArray); }
public function saveToDB() { if (parent::saveToDB()) { //this is a request from provider! //save a new row in Requests DB $flags = new stdClass(); $flags->inquire = $this->getBodyField("CURRENT_OPERATOR"); $data = array('last_transaction' => $this->getHeaderField("MSG_TYPE"), 'status' => 0, 'flags' => json_encode($flags)); $whereArray = array('request_id =?' => $this->getHeaderField("REQUEST_ID")); $tbl = new Application_Model_DbTable_Requests(Np_Db::master()); $ret = $tbl->update($data, $whereArray); return $ret; } return false; //else //this request is from cron! internal is sending to all providers //don't save in Requests DB }