pdfdokumente/Modules/Application/Controller/d3_overview_controller_pdfdocuments.php

67 lines
2.3 KiB
PHP
Raw Normal View History

2020-05-19 16:06:32 +02:00
<?php
2020-05-30 00:52:41 +02:00
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
*
* Any unauthorized use of this software without a valid license
* is a violation of the license agreement and will be prosecuted by
* civil and criminal law.
*
* http://www.shopmodule.com
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Max Buhe <support@shopmodule.com>
* @link http://www.oxidmodule.com
*/
namespace D3\PdfDocuments\Modules\Application\Controller;
2020-05-19 16:06:32 +02:00
use D3\PdfDocuments\Application\Controller\orderOverviewPdfGenerator;
2020-05-30 00:52:41 +02:00
use D3\PdfDocuments\Application\Model\Exceptions\pdfGeneratorExceptionAbstract;
2020-05-30 01:02:50 +02:00
use D3\PdfDocuments\Application\Model\Registries\registryOrderoverview;
2020-05-30 00:52:41 +02:00
use D3\PdfDocuments\Modules\Application\Model\d3_Order_PdfDocuments;
2020-05-20 11:51:48 +02:00
use OxidEsales\Eshop\Application\Model\Order;
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\TableViewNameGenerator;
2020-05-30 00:52:41 +02:00
use OxidEsales\Eshop\Core\UtilsView;
2020-05-20 11:51:48 +02:00
2020-05-19 16:06:32 +02:00
class d3_overview_controller_pdfdocuments extends d3_overview_controller_pdfdocuments_parent
{
public function canExport()
{
// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
2020-05-20 11:51:48 +02:00
$masterDb = DatabaseProvider::getMaster();
2020-05-19 16:06:32 +02:00
$sOrderId = $this->getEditObjectId();
2020-05-20 11:51:48 +02:00
$viewNameGenerator = Registry::get(TableViewNameGenerator::class);
2020-05-19 16:06:32 +02:00
$sTable = $viewNameGenerator->getViewName("oxorderarticles");
$sQ = "select count(oxid) from {$sTable} where oxorderid = " . $masterDb->quote($sOrderId) . " and oxstorno = 0";
$blCan = (bool) $masterDb->getOne($sQ);
return $blCan;
}
public function createPDF()
{
$soxId = $this->getEditObjectId();
if ($soxId != "-1" && isset($soxId)) {
2020-05-30 00:52:41 +02:00
/** @var d3_Order_PdfDocuments $oOrder */
2020-05-20 11:51:48 +02:00
$oOrder = oxNew(Order::class);
2020-05-19 16:06:32 +02:00
if ($oOrder->load($soxId)) {
$generator = oxNew( orderOverviewPdfGenerator::class );
$generator->generatePdf($oOrder, Registry::getRequest()->getRequestEscapedParameter("pdflanguage"));
2020-05-19 16:06:32 +02:00
}
}
}
2020-05-30 00:52:41 +02:00
/**
2020-05-30 01:02:50 +02:00
* @return registryOrderoverview
2020-05-30 00:52:41 +02:00
*/
public function d3getGeneratorList()
{
2020-05-30 01:02:50 +02:00
return oxNew(registryOrderoverview::class);
2020-05-30 00:52:41 +02:00
}
2020-05-19 16:06:32 +02:00
}