Example #1
0
 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;
 }