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;
     }
 }
Exemplo n.º 2
0
 public function printAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->getHelper("layout")->disableLayout();
     require_once "../library/zkk/AppCms2/tcpdf/tcpdf.php";
     $nOrderId = (int) $this->_getParam("no");
     if (is_numeric($nOrderId) && $nOrderId > 0 && in_array($this->_sRoleName, array("librarian", "administrator", "superadministrator"))) {
         $oModelOrderJournal = new User_Model_VOrderJournal();
         $oModelOrderChangeLog = new User_Model_OrderChangeLog();
         $oModelOrderJournalOrderChangeLog = new User_Model_OrderJournalOrderChangeLog();
         $oOrderJournal = $oModelOrderJournal->getOne($nOrderId);
         $oPdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, "UTF-8", false);
         $oPdf->setFont("freesans");
         $oPdf->setPrintHeader(false);
         $oPdf->addPage();
         $oPdf->SetFontSize(12);
         $oPdf->writeHTMLCell(60, 10, "", 5, "<strong>{$oOrderJournal->call_id}</strong>", 0, 0, false, true, "L", true);
         $oPdf->writeHTMLCell(120, 10, "", "", "ZAKŁADKA ZAMÓWIENIA KOPII", 0, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(95, 5, "", "", "Numer zamówienia: <strong>{$oOrderJournal->id}</strong>", 0, 0, false, true, "L", true);
         $oPdf->writeHTMLCell(75, 5, "", "", "Sygnatura: <strong>{$oOrderJournal->call_id}</strong><br />Sygnatura lokalna: <strong>{$oOrderJournal->csa_call_id}</strong><br />Kolekcja: <strong>{$oOrderJournal->collection}</strong>", 0, 1, false, true, "R", true);
         $oPdf->writeHTMLCell(190, 5, "", "", "", 0, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(190, 5, "", "", "", 0, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(95, 30, "", "", "Tytuł książki / czasopisma:<br /><strong>{$oOrderJournal->journal_title}</strong>", 1, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(95, 5, "", "", "Rocznik: <strong>{$oOrderJournal->journal_year_publication}</strong>", 1, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(95, 5, "", "", "Numeracja: <strong>{$oOrderJournal->journal_number}</strong>", 1, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(95, 5, "", "", "Strony od: <strong>{$oOrderJournal->page_from}</strong>", 1, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(95, 5, "", "", "Strony do: <strong>{$oOrderJournal->page_until}</strong>", 1, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(95, 5, "", "", "Autor: <strong>{$oOrderJournal->article_author}</strong>", 1, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(95, 30, "", "", "Nazwa rozdziału / artykułu:<br /><strong>{$oOrderJournal->article_title}</strong>", 1, 1, false, true, "L", true);
         $sCurrTime = date("Y-m-d H:i:s", time());
         $sHtml1 = "\n        Data zamówienia: <strong>{$sCurrTime}</strong><br /><br />\n        Zamówione dla: <br /><strong>{$oOrderJournal->user_first_name} {$oOrderJournal->user_last_name}</strong><br /><br />\n        Przekazać do: <br /><strong></strong>\n      ";
         $oPdf->writeHTMLCell(95, 5, 110, 75, $sHtml1, 0, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(60, 10, "", 150, "<strong>{$oOrderJournal->call_id}</strong>", 0, 0, false, true, "L", true);
         $oPdf->writeHTMLCell(120, 10, "", "", "ZAKŁADKA ZAMÓWIENIA KOPII", 0, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(95, 5, "", "", "Numer zamówienia: <strong>{$oOrderJournal->id}</strong>", 0, 0, false, true, "L", true);
         $oPdf->writeHTMLCell(75, 5, "", "", "Sygnatura: <strong>{$oOrderJournal->call_id}</strong><br />Sygnatura lokalna: <strong>{$oOrderJournal->csa_call_id}</strong><br />Kolekcja: <strong>{$oOrderJournal->collection}</strong>", 0, 1, false, true, "R", true);
         $oPdf->writeHTMLCell(190, 5, "", "", "", 0, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(190, 5, "", "", "", 0, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(95, 30, "", "", "Tytuł książki / czasopisma:<br /><strong>{$oOrderJournal->journal_title}</strong>", 1, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(95, 5, "", "", "Rocznik: <strong>{$oOrderJournal->journal_year_publication}</strong>", 1, 1, false, true, "L", true);
         $oPdf->writeHTMLCell(95, 5, "", "", "Numeracja: <strong>{$oOrderJournal->journal_number}</strong>", 1, 1, false, true, "L", true);
         $sHtml2 = "\n        Data zamówienia: <strong>{$sCurrTime}</strong><br /><br />\n        Zamówione dla: <br /><strong></strong>\n      ";
         $oPdf->writeHTMLCell(95, 5, 110, 190, $sHtml2, 0, 1, false, true, "L", true);
         $oPdf->Output($nOrderId . ".pdf", "I");
         $nOrderChangeLogId = $oModelOrderChangeLog->addRow(array("order_change_type_id" => 3, "user_id" => $this->_oAuth->getStorage()->read()->user_id, "date" => time()));
         $oModelOrderJournalOrderChangeLog->addRow(array("order_journal_id" => $nOrderId, "order_change_log_id" => $nOrderChangeLogId));
     }
     exit;
 }
Exemplo n.º 3
0
 public function indexAction()
 {
     $oXServer = new AppCms2_Controller_Plugin_XServer();
     //$oModelSybase = new Borrower_Model_Sybase();
     $oModelOrderStatus = new User_Model_OrderStatus();
     $oModelOrderJournal = new User_Model_OrderJournal();
     $oModelVOrderJournal = new Borrower_Model_VOrderJournal();
     $oModelOrderChangeLog = new User_Model_OrderChangeLog();
     $oModelOrderJournalOrderChangeLog = new User_Model_OrderJournalOrderChangeLog();
     $oSuccessSession = new Zend_Session_Namespace("success");
     $aData = null;
     $nItemHashGet = $this->_request->getParam("new");
     $nOrderJournalId = $this->_request->getParam("open");
     $nItemHashSession = $oSuccessSession->bIsNew;
     if (isset($nItemHashGet)) {
         $nItemHash = $nItemHashGet;
     } else {
         if (isset($nItemHashSession)) {
             $oSuccessSession->bIsNew = false;
             $nItemHash = $nItemHashSession;
         }
     }
     if ($oSuccessSession->bIsSave === true) {
         $oSuccessSession->bIsSave = false;
         $oSuccessSession->bIsNew = false;
         $oSuccessSession->nNewOrder = 0;
     }
     if (isset($nItemHash) && is_numeric($nItemHash)) {
         $aJournalSettings = $oXServer->getJournalSettings($nItemHash);
         if ($aJournalSettings) {
             $aData["user_id"] = $this->_nUserId;
             $aData["order_status_id"] = 1;
             $aData["item_id"] = $aJournalSettings["item#"];
             $aData["call_id"] = $aJournalSettings["call"];
             $aData["csa_call_id"] = $aJournalSettings["csa_call"];
             $aData["location"] = $aJournalSettings["location"];
             $aData["is_journal_collection"] = 1;
             $aData["collection"] = null;
             $aData["journal_title"] = $aJournalSettings["processed"];
             $nTime = time();
             $aData["created_date"] = $nTime;
             $aData["modified_date"] = $nTime;
             $nOrderJournalId = $oModelOrderJournal->saveNewOrder($aData);
             if ($nOrderJournalId) {
                 $oSuccessSession->bIsSave = true;
                 $oSuccessSession->bIsNew = false;
                 $oSuccessSession->nNewOrder = $nOrderJournalId;
                 $nOrderChangeLogId = $oModelOrderChangeLog->addRow(array("order_change_type_id" => 1, "user_id" => $this->_nUserId, "date" => $nTime));
                 $oModelOrderJournalOrderChangeLog->addRow(array("order_journal_id" => $nOrderJournalId, "order_change_log_id" => $nOrderChangeLogId));
             }
         }
     } else {
         if (isset($nOrderJournalId) && is_numeric($nOrderJournalId)) {
             $oSuccessSession->bIsSave = true;
             $oSuccessSession->bIsNew = false;
             $oSuccessSession->nNewOrder = $nOrderJournalId;
         }
     }
     $aAllStatuses = $oModelOrderStatus->getAll()->toArray();
     if (count($aAllStatuses)) {
         foreach ($aAllStatuses as $nKey => $aValue) {
             $aAllStatuses[$nKey]["count"] = $oModelVOrderJournal->getUserCount($this->_nUserId, $aValue["id"]);
         }
     }
     $this->view->aAllStatuses = $aAllStatuses;
 }