public function addfileAction() { $this->_helper->viewRenderer->setNoRender(); $this->_helper->getHelper("layout")->disableLayout(); $this->getFileUploadScript(); if ($this->_request->isPost()) { $oModelOrderFile = new User_Model_OrderFile(); $oUploadHandler = new AppCms2_UploadHandlerScannedFile(); $aResult = $oUploadHandler->post(); if (!isset($aResult["files"][0]->error)) { $sUserName = $aResult["files"][0]->name; $sGenName = $aResult["files"][0]->gen_name; if (!is_dir($this->_sPath)) { if (!mkdir($this->_sPath, 0777)) { throw new Zend_Exception(); } } if (!rename($this->_sPath . $sUserName, $this->_sPath . $sGenName)) { unlink($this->_sPath . $sUserName); } if (file_exists($this->_sPath . $sUserName)) { throw new Zend_Exception(); } $aData = array("name" => $sGenName, "user_name" => $sUserName, "upload_date" => time()); $oModelOrderFile->addRow($aData); } } return 0; }
public function __construct($options = null) { $oModelOrderFile = new User_Model_OrderFile(); $oModelOrderFile->getAll(); $this->_aAllOrderFile[0] = "-"; $aAllOrderFile = $oModelOrderFile->getNotExists(); if (count($aAllOrderFile)) { foreach ($aAllOrderFile as $aValue) { $this->_aAllOrderFile[$aValue["id"]] = $aValue["user_name"]; } } parent::__construct($options); }
public function getscannedfileslistAction() { $this->_helper->viewRenderer->setNoRender(); $this->_helper->getHelper("layout")->disableLayout(); $aJson = null; $oModelOrderFile = new User_Model_OrderFile(); if ($this->_request->isPost()) { $aAllOrderFile = array(); $aAllOrderFile[0] = "-"; $aTempAllOrderFile = $oModelOrderFile->getNotExists(); if (count($aTempAllOrderFile)) { foreach ($aTempAllOrderFile as $aValue) { $aAllOrderFile[$aValue["id"]] = $aValue["user_name"]; } } $aJson = $aAllOrderFile; } header("Content-type: application/json"); echo Zend_Json::encode($aJson); exit; }
public function makeactionAction() { $this->_helper->viewRenderer->setNoRender(); $this->_helper->getHelper("layout")->disableLayout(); $aJson = null; $oMail = new AppCms2_Controller_Plugin_Mail(); $oModelOrderJournal = new User_Model_OrderJournal(); //$oModelSybase = new User_Model_Sybase(); $oModelOrderFile = new User_Model_OrderFile(); $oModelOrderChangeLog = new User_Model_OrderChangeLog(); $oModelOrderJournalOrderChangeLog = new User_Model_OrderJournalOrderChangeLog(); if ($this->_request->isPost()) { $aPostData = $this->_request->getPost(); $nOrderStatusId = $aPostData["order_status_id"]; $nOrderId = $aPostData["order_id"]; $bIsCanceled = $aPostData["is_canceled"]; $aParam = $aPostData["param"]; $nNewOrderStatusId = $nOrderStatusId + 1; if ($nOrderStatusId == 1) { if ($this->_nUserId == $oModelOrderJournal->getOrderUserId($nOrderId)) { $aJson = $oModelOrderJournal->changeStatus($nOrderId, $nNewOrderStatusId); } } else { if ($nOrderStatusId == 3) { if ($this->_nUserId == $oModelOrderJournal->getOrderUserId($nOrderId)) { if ($bIsCanceled == "true") { $nNewOrderStatusId = 7; $nItemId = $oModelOrderJournal->getOrderItemId($nOrderId); //$oModelSybase->setItemStatusAndRequestable($nItemId, "s", "0"); $aJson = $oModelOrderJournal->changeStatusCancel($nOrderId, $nNewOrderStatusId); } else { $aJson = $oModelOrderJournal->changeStatus($nOrderId, $nNewOrderStatusId); } } } else { if ($nOrderStatusId == 6) { if ($this->_nUserId == $oModelOrderJournal->getOrderUserId($nOrderId)) { $nOrderFileId = $oModelOrderJournal->getRow($nOrderId)->order_file_id; if (isset($nOrderFileId)) { $oOrderFileInfo = $oModelOrderFile->getRow($nOrderFileId); if (isset($oOrderFileInfo)) { $aJson = $this->_nUserId . "/" . $oOrderFileInfo->name; $nOrderChangeLogId = $oModelOrderChangeLog->addRow(array("order_change_type_id" => 8, "user_id" => $this->_oAuth->getStorage()->read()->user_id, "date" => time())); $oModelOrderJournalOrderChangeLog->addRow(array("order_journal_id" => $nOrderId, "order_change_log_id" => $nOrderChangeLogId)); } } } } else { if ($nOrderStatusId == 7) { $oMail->sendSendInvoice($aAdminEmailAddress, $aParam); } } } } header("Content-type: application/json"); echo Zend_Json::encode($aJson); exit; } }
public function statusAction() { $this->_helper->viewRenderer->setNoRender(); $this->_helper->getHelper("layout")->disableLayout(); if ($this->_request->isPost()) { $aPostData = $this->_request->getPost(); $sHash = md5($aPostData["transaction_id"] . $aPostData["merchant_id"] . $aPostData["order_id"] . $aPostData["product_id"] . $aPostData["user_id"] . $aPostData["amount"] . $aPostData["descr"] . $aPostData["client_ip"] . $aPostData["time"] . $this->_sAuthKey2); if ($sHash === $aPostData["hash"]) { $oModelOrderPayment = new User_Model_OrderPayment(); $oModelOrderJournal = new User_Model_OrderJournal(); $oModelOrderFile = new User_Model_OrderFile(); $oModelOrderCart = new Borrower_Model_OrderCart(); $oModelOrderJournalOrderCart = new Borrower_Model_OrderJournalOrderCart(); $oModelVOrderPaymentHistory = new User_Model_VOrderPaymentHistory(); $sPathOld = APPLICATION_PATH . "/../files_scanned/"; $sPathNew = APPLICATION_PATH . "/../../public_html/files_scanned/"; $nOrderPaymentId = (int) $aPostData["order_id"]; $nUserId = (int) $aPostData["user_id"]; $nAmount = (int) $aPostData["amount"]; $oOrderPayment = $oModelOrderPayment->getRow($nOrderPaymentId); if ($oOrderPayment->user_id === $nUserId && $oOrderPayment->amount === $nAmount && $oOrderPayment->is_ending !== 1) { $oDb = Zend_Db_Table::getDefaultAdapter(); try { if (!@is_dir($sPathNew)) { if (!@mkdir($sPathNew, 0777)) { throw new Zend_Exception(); } } if (!@is_dir($sPathOld)) { throw new Zend_Exception(); } $oDb->beginTransaction(); $oOrderJournal = $oModelVOrderPaymentHistory->getOrderJournal($nOrderPaymentId); foreach ($oOrderJournal as $oRow) { $nOrderJournalId = $oRow->order_journal_id; if (!@is_dir($sPathNew . "user_id_" . $nUserId)) { if (!@mkdir($sPathNew . "user_id_" . $nUserId, 0777)) { throw new Zend_Exception(); } } $oOrderFile = $oModelOrderFile->getRow($oRow->order_file_id); if (!@copy($sPathOld . $oOrderFile->name, $sPathNew . "user_id_" . $nUserId . "/" . $oOrderFile->name)) { throw new Zend_Exception(); } $oModelOrderJournal->setOrderPaymentSuccess($nOrderJournalId); $oMail = new AppCms2_Controller_Plugin_Mail(); $oMail->sendBorrowerOrderStatusInfo($nOrderJournalId, 5); } $oModelOrderPayment->editRow($nOrderPaymentId, array("is_ending" => 1, "date_is_ending" => time())); $nOrderCartId = $oModelOrderCart->getOrderCartId($nUserId); $oModelOrderJournalOrderCart->deleteCartJournals($nOrderCartId); $oDb->commit(); echo "ACK"; } catch (Zend_Exception $e) { $oDb->rollBack(); } } } } exit; }