2020-05-19 16:06:32 +02:00
|
|
|
<?php
|
2020-05-30 00:52:41 +02:00
|
|
|
|
|
|
|
/**
|
2020-07-04 23:25:24 +02:00
|
|
|
* See LICENSE file for license details.
|
2020-05-30 00:52:41 +02:00
|
|
|
*
|
|
|
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
2020-07-04 23:25:24 +02:00
|
|
|
* @author D3 Data Development - Max Buhe <support@shopmodule.com>
|
|
|
|
* @link http://www.oxidmodule.com
|
2020-05-30 00:52:41 +02:00
|
|
|
*/
|
|
|
|
|
2020-06-04 10:31:38 +02:00
|
|
|
namespace D3\PdfDocuments\Modules\Application\Controller;
|
2020-05-19 16:06:32 +02:00
|
|
|
|
2020-06-04 10:31:38 +02:00
|
|
|
use D3\PdfDocuments\Application\Controller\orderOverviewPdfGenerator;
|
2020-07-03 20:04:21 +02:00
|
|
|
use D3\PdfDocuments\Application\Model\Exceptions\noPdfHandlerFoundException;
|
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-08-13 09:39:19 +02:00
|
|
|
use OxidEsales\Eshop\Application\Controller\Admin\OrderOverview;
|
2020-05-20 11:51:48 +02:00
|
|
|
use OxidEsales\Eshop\Application\Model\Order;
|
|
|
|
use OxidEsales\Eshop\Core\DatabaseProvider;
|
2020-07-03 20:04:21 +02:00
|
|
|
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
2020-05-20 11:51:48 +02:00
|
|
|
use OxidEsales\Eshop\Core\Registry;
|
|
|
|
use OxidEsales\Eshop\Core\TableViewNameGenerator;
|
|
|
|
|
2020-05-19 16:06:32 +02:00
|
|
|
class d3_overview_controller_pdfdocuments extends d3_overview_controller_pdfdocuments_parent
|
|
|
|
{
|
2024-08-26 23:42:41 +02:00
|
|
|
/**
|
2020-07-03 20:04:21 +02:00
|
|
|
* @return bool
|
|
|
|
* @throws DatabaseConnectionException
|
|
|
|
*/
|
|
|
|
public function d3CanExport()
|
|
|
|
{
|
|
|
|
// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
|
|
|
|
$masterDb = DatabaseProvider::getMaster();
|
|
|
|
$sOrderId = $this->getEditObjectId();
|
2020-05-19 16:06:32 +02:00
|
|
|
|
2020-07-03 20:04:21 +02:00
|
|
|
$viewNameGenerator = Registry::get(TableViewNameGenerator::class);
|
|
|
|
$sTable = $viewNameGenerator->getViewName("oxorderarticles");
|
2020-05-19 16:06:32 +02:00
|
|
|
|
2023-09-19 23:32:55 +02:00
|
|
|
$sQ = "select count(oxid) from $sTable where oxorderid = " . $masterDb->quote($sOrderId) . " and oxstorno = 0";
|
2020-07-03 20:04:21 +02:00
|
|
|
return (bool) $masterDb->getOne($sQ);
|
2020-05-19 16:06:32 +02:00
|
|
|
}
|
2020-05-30 00:52:41 +02:00
|
|
|
|
|
|
|
/**
|
2020-07-03 20:04:21 +02:00
|
|
|
* @throws noPdfHandlerFoundException
|
|
|
|
* @throws pdfGeneratorExceptionAbstract
|
2020-05-30 00:52:41 +02:00
|
|
|
*/
|
2020-07-03 20:04:21 +02:00
|
|
|
public function d3CreatePDF()
|
|
|
|
{
|
|
|
|
$soxId = $this->getEditObjectId();
|
|
|
|
if ($soxId != "-1" && isset($soxId)) {
|
2023-09-19 23:32:55 +02:00
|
|
|
/** @var Order $oOrder */
|
2020-07-03 20:04:21 +02:00
|
|
|
$oOrder = oxNew(Order::class);
|
|
|
|
if ($oOrder->load($soxId)) {
|
|
|
|
$generator = oxNew( orderOverviewPdfGenerator::class );
|
|
|
|
$generator->generatePdf($oOrder, Registry::getRequest()->getRequestEscapedParameter("pdflanguage"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return registryOrderoverview
|
|
|
|
*/
|
|
|
|
public function d3getGeneratorList()
|
|
|
|
{
|
|
|
|
return oxNew(registryOrderoverview::class);
|
|
|
|
}
|
2020-05-19 16:06:32 +02:00
|
|
|
}
|