private function runTransaction($process) { try { $config = \Tinebase_Config::getInstance()->getConfig('pdfserver', NULL, TRUE)->value; $storageConf = \Tinebase_Config::getInstance()->getConfig('printjobs', NULL, TRUE)->value; $this->copyWatermarkFile = $config['copywatermarkfile']; $this->previewWatermarkFile = $config['previewwatermarkfile']; $this->tempFilePath = CSopen::instance()->getCustomerPath() . '/customize/data/documents/temp/'; $this->templateController = DocManager_Controller_Template::getInstance(); $db = Tinebase_Core::getDb(); $tm = Tinebase_TransactionManager::getInstance(); $this->pdfServer = org\sopen\app\api\pdf\server\PdfServer::getInstance($config)->setDocumentsTempPath(CSopen::instance()->getDocumentsTempPath()); $this->printJobStorage = org\sopen\app\api\filesystem\storage\FileProcessStorage::createNew('printjobs', $storageConf['storagepath']); $this->printJobStorage->addProcessLines(array('in', 'convert', 'out', 'preview', 'copy')); $tId = $tm->startTransaction($db); $preview = false; switch ($process) { case self::PROCESS_TEST: break; case self::PROCESS_RECEIPT: $this->createReceipt(); break; case self::PROCESS_RECEIPTS: $this->createReceipts(); break; case self::PROCESS_RECEIPT_PREVIEW: $this->createReceipt(); $preview = true; break; case self::PROCESS_SUPPLY_RECEIPT: $this->createSupplyReceipt(); break; case self::PROCESS_SUPPLY_RECEIPT_PREVIEW: $this->createSupplyReceipt(); $preview = true; break; } // create the multipage output from single page input files if ($this->count > 0) { $this->createResult(); } // make db changes final $tm->commitTransaction($tId); // output the result if ($this->output) { if ($this->count > 0) { if ($preview) { if ($this->outputType == self::OUTPUT_TYPE_PAGE) { $this->outputPreview(); } else { $this->outputPreviewForDownload(); } } else { if ($this->outputType == self::OUTPUT_TYPE_PAGE) { $this->outputResult(); } else { $this->outputResultForDownload(); } } } else { $this->outputNone(); } } } catch (Exception $e) { //echo $e->__toString(); $tm->rollback($tId); throw $e; } }
private function runTransaction() { try { $config = \Tinebase_Config::getInstance()->getConfig('pdfserver', NULL, TRUE)->value; $storageConf = \Tinebase_Config::getInstance()->getConfig('printjobs', NULL, TRUE)->value; $this->tempFilePath = CSopen::instance()->getCustomerPath() . '/customize/data/documents/temp/'; $this->templateController = DocManager_Controller_Template::getInstance(); $db = Tinebase_Core::getDb(); $tm = Tinebase_TransactionManager::getInstance(); $this->pdfServer = org\sopen\app\api\pdf\server\PdfServer::getInstance($config)->setDocumentsTempPath(CSopen::instance()->getDocumentsTempPath()); $this->printJobStorage = org\sopen\app\api\filesystem\storage\TempFileProcessStorage::createNew('printjobs', $storageConf['storagepath']); $this->printJobStorage->addProcessLines(array('in', 'convert', 'out')); $tId = $tm->startTransaction($db); $this->createResult(); // make db changes final $tm->commitTransaction($tId); // output the result if ($this->count > 0) { $this->outputResult(); } else { $this->outputNone(); } } catch (Exception $e) { echo $e->__toString(); $tm->rollback($tId); } }
private function runTransaction() { try { $config = \Tinebase_Config::getInstance()->getConfig('pdfserver', NULL, TRUE)->value; $storageConf = \Tinebase_Config::getInstance()->getConfig('printjobs', NULL, TRUE)->value; $this->tempFilePath = CSopen::instance()->getCustomerPath() . '/customize/data/documents/temp/'; $this->templateController = DocManager_Controller_Template::getInstance(); $db = Tinebase_Core::getDb(); $tm = Tinebase_TransactionManager::getInstance(); $this->pdfServer = org\sopen\app\api\pdf\server\PdfServer::getInstance($config)->setDocumentsTempPath(CSopen::instance()->getDocumentsTempPath()); $this->printJobStorage = org\sopen\app\api\filesystem\storage\TempFileProcessStorage::createNew('printjobs', $storageConf['storagepath']); $this->printJobStorage->addProcessLines(array('in', 'convert', 'out')); $tId = $tm->startTransaction($db); $this->printResult(); // make db changes final $tm->commitTransaction($tId); // output the result if (!$this->createOnly) { if ($this->count > 0) { $this->outputResult(); } else { $this->outputNone(); } } else { if ($this->exportFileName) { $this->printJobStorage->copyOut("//out/result/merge/pdf/final", $this->exportFileName); } return; } } catch (Exception $e) { // echo $e->__toString(); if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . $e->__toString()); } $tm->rollback($tId); throw $e; } exit; }