adjusting: modifying files
This commit is contained in:
bovenliggende
3349b72a57
commit
4eec91e84b
@ -35,7 +35,6 @@ class d3_Order_PdfDocuments extends d3_Order_PdfDocuments_parent
|
||||
public function genPdf($sFilename, $iSelLang = 0, $target = 'I')
|
||||
{
|
||||
$Pdf= $this->getPdfClass();
|
||||
die();
|
||||
|
||||
$Pdf->setOrder($this);
|
||||
$Pdf->genPdf($sFilename, $iSelLang = 0, $target = 'I');
|
||||
@ -44,12 +43,15 @@ class d3_Order_PdfDocuments extends d3_Order_PdfDocuments_parent
|
||||
switch (Registry::getRequest()->getRequestParameter('pdftype')) {
|
||||
case ('dnote'):
|
||||
case ('dnote_without_logo'):
|
||||
return oxNew(deliverynotePdf::class);
|
||||
$pdfInstance= oxNew(deliverynotePdf::class);
|
||||
$pdfInstance->setOrder($this);
|
||||
return $pdfInstance;
|
||||
case ('standart'):
|
||||
case('standart_without_logo'):
|
||||
return oxNew(invoicePdf::class);
|
||||
$pdfInvoice= oxNew(invoicePdf::class);
|
||||
$pdfInvoice->setOrder($this);
|
||||
return $pdfInvoice;
|
||||
default:
|
||||
dumpVar(get_class($this));
|
||||
return $this->getCustomPdfClass();
|
||||
}
|
||||
}
|
||||
@ -61,6 +63,8 @@ class d3_Order_PdfDocuments extends d3_Order_PdfDocuments_parent
|
||||
*/
|
||||
public function getCustomPdfClass()
|
||||
{
|
||||
return oxNew(invoicePdf::class);
|
||||
$pdfInvoice= oxNew(invoicePdf::class);
|
||||
$pdfInvoice->setOrder($this);
|
||||
return $pdfInvoice;
|
||||
}
|
||||
}
|
||||
|
@ -2,18 +2,23 @@
|
||||
namespace D3\PdfDocuments\Modules\Application\Model;
|
||||
|
||||
use \OxidEsales\Eshop\Application\Model\Order;
|
||||
use OxidEsales\Eshop\Application\Model\Payment;
|
||||
use OxidEsales\Eshop\Application\Model\User;
|
||||
use OxidEsales\Eshop\Core\Base;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use Spipu\Html2Pdf\Html2Pdf;
|
||||
|
||||
abstract class pdfDocuments implements albatros
|
||||
{
|
||||
public $oOrder;
|
||||
protected $blIsNewOrder;
|
||||
|
||||
public function genPdf($sFilename, $iSelLang = 0, $target = 'I')
|
||||
{
|
||||
self::$_blIsAdmin = 0;
|
||||
|
||||
$oSmarty = Registry::getUtilsView()->getSmarty();
|
||||
$oSmarty->assign('oConfig', Registry::getSession()->getConfig());
|
||||
$oSmarty->assign('oViewConf', Registry::getSession()->getConfig()->getActiveView()->getViewConfig());
|
||||
$oSmarty->assign('order', $this);
|
||||
$oSmarty->assign('order', $this->getOrder());
|
||||
$oSmarty->assign('shop', Registry::getSession()->getConfig()->getActiveShop());
|
||||
$oSmarty->assign('lang', Registry::getLang());
|
||||
|
||||
@ -29,14 +34,8 @@ abstract class pdfDocuments implements albatros
|
||||
$this->setInvoiceDate();
|
||||
$this->saveOrderOnChanges();
|
||||
|
||||
switch (Registry::getRequest()->getRequestParameter('pdftype')) {
|
||||
case ('dnote'):
|
||||
case ('dnote_without_logo'):
|
||||
$sContent = $oSmarty->fetch($this->getTemplate());
|
||||
break;
|
||||
default:
|
||||
$sContent = $oSmarty->fetch($this->getTemplate());
|
||||
}
|
||||
$sContent = $oSmarty->fetch($this->getTemplate());
|
||||
$this->setFilename($sContent, $target, $sFilename);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -48,7 +47,7 @@ abstract class pdfDocuments implements albatros
|
||||
}
|
||||
|
||||
/**
|
||||
* @return OrderModel
|
||||
* @return Order
|
||||
*/
|
||||
public function getOrder()
|
||||
{
|
||||
|
@ -1,15 +1,20 @@
|
||||
<?php
|
||||
namespace D3\PdfDocuments\Modules\Application\controllers;
|
||||
|
||||
use OxidEsales\Eshop\Application\Model\Order;
|
||||
use OxidEsales\Eshop\Core\DatabaseProvider;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\TableViewNameGenerator;
|
||||
|
||||
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).
|
||||
$masterDb = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();
|
||||
$masterDb = DatabaseProvider::getMaster();
|
||||
$sOrderId = $this->getEditObjectId();
|
||||
|
||||
$viewNameGenerator = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Core\TableViewNameGenerator::class);
|
||||
$viewNameGenerator = Registry::get(TableViewNameGenerator::class);
|
||||
$sTable = $viewNameGenerator->getViewName("oxorderarticles");
|
||||
|
||||
$sQ = "select count(oxid) from {$sTable} where oxorderid = " . $masterDb->quote($sOrderId) . " and oxstorno = 0";
|
||||
@ -20,22 +25,18 @@ class d3_overview_controller_pdfdocuments extends d3_overview_controller_pdfdocu
|
||||
|
||||
public function createPDF()
|
||||
{
|
||||
echo __LINE__;
|
||||
$soxId = $this->getEditObjectId();
|
||||
if ($soxId != "-1" && isset($soxId)) {
|
||||
echo __LINE__;
|
||||
// load object
|
||||
$oOrder = oxNew(\OxidEsales\Eshop\Application\Model\Order::class);
|
||||
$oOrder = oxNew(Order::class);
|
||||
if ($oOrder->load($soxId)) {
|
||||
echo __LINE__;
|
||||
$oUtils = \OxidEsales\Eshop\Core\Registry::getUtils();
|
||||
self::$_blIsAdmin = 0;
|
||||
$oUtils = Registry::getUtils();
|
||||
$sTrimmedBillName = trim($oOrder->oxorder__oxbilllname->getRawValue());
|
||||
$sFilename = $oOrder->oxorder__oxordernr->value . "_" . $sTrimmedBillName . ".pdf";
|
||||
$sFilename = $this->makeValidFileName($sFilename);
|
||||
//ob_start();
|
||||
echo __LINE__;
|
||||
$oOrder->genPDF($sFilename, \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("pdflanguage"));
|
||||
die();
|
||||
ob_start();
|
||||
$oOrder->genPDF($sFilename, Registry::getConfig()->getRequestParameter("pdflanguage"));
|
||||
$sPDF = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$oUtils->setHeader("Pragma: public");
|
||||
@ -43,7 +44,7 @@ class d3_overview_controller_pdfdocuments extends d3_overview_controller_pdfdocu
|
||||
$oUtils->setHeader("Expires: 0");
|
||||
$oUtils->setHeader("Content-type: application/pdf");
|
||||
$oUtils->setHeader("Content-Disposition: attachment; filename=" . $sFilename);
|
||||
\OxidEsales\Eshop\Core\Registry::getUtils()->showMessageAndExit($sPDF);
|
||||
Registry::getUtils()->showMessageAndExit($sPDF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Laden…
Verwijs in nieuw issue
Block a user