Exemplo n.º 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);
     }
 }
Exemplo n.º 2
0
 /**
  * get special options
  *
  * @param string $_value
  * @return array
  */
 protected function _getSpecialOptions($_value)
 {
     $result = array();
     switch ($_value) {
         case self::TEMPLATE_CALCULATION:
         case self::TEMPLATE_BID:
         case self::TEMPLATE_CONFIRM:
         case self::TEMPLATE_SHIPPING:
         case self::TEMPLATE_INVOICE:
         case self::TEMPLATE_POSINVOICE:
         case self::TEMPLATE_CREDIT:
         case self::TEMPLATE_MONITION:
         case self::TEMPLATE_MONITION2:
         case self::TEMPLATE_MONITION3:
         case self::TEMPLATE_QUERY:
         case self::TEMPLATE_OFFER:
         case self::TEMPLATE_ORDER:
         case self::TEMPLATE_INCINVOICE:
         case self::TEMPLATE_ARTICLE_SOLD:
         case self::TEMPLATE_DTA_DEBIT_PREPARE:
         case self::TEMPLATE_MONITION_PREPARE:
         case self::TEMPLATE_DEBIT_RETURN_INQUIRY:
         case self::TEMPLATE_ACCOUNT_STATEMENT:
         case self::TEMPLATE_SUM_SALDATION:
         case self::TEMPLATE_YEAR_TERMINATION1:
         case self::TEMPLATE_YEAR_TERMINATION2:
             $templates = DocManager_Controller_Template::getInstance()->getAll();
             foreach ($templates as $template) {
                 $result[] = array($template->getId(), $template->__get('name'));
             }
             break;
         case self::POS_DEFAULT_DEBITOR:
             $result[] = array();
             /*$debitors = Billing_Controller_Debitor::getInstance()->getAll();
             		foreach ($debitors as $debitor) {
             			$result[] = array($debitor->getId(), $debitor->__get('debitor_nr'));
             		}*/
             break;
         case self::FIBU_KTO_DEBITOR:
         case self::FIBU_KTO_DTA_SETTLE:
         case self::FIBU_KTO_DTA_RETURN_FEE:
             $ktos = Billing_Controller_AccountSystem::getInstance()->getAll();
             foreach ($ktos as $kto) {
                 $result[] = array($kto->getId(), $kto->__get('number') . ' ' . $kto->__get('name'));
             }
             break;
         case self::DEBIT_RETURN_FEE:
         case self::MONITION_STAGE1:
         case self::MONITION_STAGE2:
         case self::MONITION_STAGE3:
             $result = array();
             break;
         case self::FIBU_INSTANT_BOOK_BILLABLE:
             $result = array(array(0, 'Nein'), array(1, 'Ja'));
             break;
         case self::ACTIVE_CONTENT_TYPE:
             $result = array(array('Invoice', 'Rechnungen'), array('OpenItem', 'Offene Posten'), array('SepaMandate', 'Sepa-Mandate'));
             break;
         default:
             $result = parent::_getSpecialOptions($_value);
     }
     return $result;
 }
Exemplo n.º 3
0
 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;
     }
 }
Exemplo n.º 4
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->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;
 }