change small syntax issues

This commit is contained in:
Daniel Seifert 2020-07-03 20:04:21 +02:00
parent 242610a8cf
commit 5541acaab0
Signed by: DanielS
GPG Key ID: 6A513E13AEE66170
16 changed files with 96 additions and 74 deletions

View File

@ -15,9 +15,7 @@
namespace D3\PdfDocuments\Application\Controller;
use D3\PdfDocuments\Application\Model\Exceptions\noBaseObjectSetException;
use D3\PdfDocuments\Application\Model\Exceptions\noPdfHandlerFoundException;
use D3\PdfDocuments\Application\Model\Exceptions\pdfGeneratorExceptionAbstract;
use D3\PdfDocuments\Application\Model\Interfaces\pdfdocumentsOrderInterface;
use D3\PdfDocuments\Application\Model\Registries\registryOrderoverview;
use OxidEsales\Eshop\Application\Model\Order;
@ -27,12 +25,8 @@ class orderOverviewPdfGenerator
{
/**
* @param Order $order
* @param $sFilename
* @param int $iSelLang
* @param string $target
* @throws noPdfHandlerFoundException
* @throws noBaseObjectSetException
* @throws pdfGeneratorExceptionAbstract
*/
public function generatePdf(Order $order, $iSelLang = 0)
{

View File

@ -58,11 +58,10 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
}
/**
* @param $sFilename
* @param int $iSelLang
* @param $sFilename
* @param int $iSelLang
* @param string $target
*
* @return mixed|string
* @return mixed|string|null
* @throws Html2PdfException
*/
public function genPdf($sFilename, $iSelLang = 0, $target = self::PDF_DESTINATION_STDOUT)
@ -80,6 +79,7 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
/**
* @param int $iLanguage
* @throws Html2PdfException
*/
public function downloadPdf($iLanguage = 0)
{
@ -204,8 +204,6 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
}
/**
* @param string $sFilename
*
* @return string
*/
public function getFilename()
@ -265,6 +263,14 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
return false;
}
/**
* @param Html2Pdf $oPdf
* @param $sFilename
* @param $target
* @param $html
* @return string|null
* @throws Html2PdfException
*/
public function output(Html2Pdf $oPdf, $sFilename, $target, $html)
{
if ((bool) Registry::getConfig()->getConfigParam('d3PdfDocumentsbDev') === true) {
@ -279,7 +285,7 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
* @param $sFilename
* @param $target
* @param $html
* @return mixed
* @return null
*/
public function outputDev(Html2Pdf $oPdf, $sFilename, $target, $html)
{
@ -350,5 +356,7 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
$oPdf->pdf->Error('Incorrect output destination: '.$target);
}
}
return null;
}
}

View File

@ -23,7 +23,6 @@ use \OxidEsales\Eshop\Application\Model\Order;
use OxidEsales\Eshop\Application\Model\Payment;
use OxidEsales\Eshop\Application\Model\User;
use OxidEsales\Eshop\Core\Registry;
use Spipu\Html2Pdf\Exception\Html2PdfException;
abstract class pdfdocumentsOrder extends pdfdocumentsGeneric implements orderInterface
{
@ -65,8 +64,6 @@ abstract class pdfdocumentsOrder extends pdfdocumentsGeneric implements orderInt
}
/**
* @param string $sFilename
*
* @return string
*/
public function getFilename()
@ -97,19 +94,15 @@ abstract class pdfdocumentsOrder extends pdfdocumentsGeneric implements orderInt
}
/**
* @param $sFilename
* @param int $iSelLang
* @param $sFilename
* @param int $iSelLang
* @param string $target
*
* @return mixed|string|void
* @throws Html2PdfException
* @throws noBaseObjectSetException
* @return mixed|string|null
*/
public function genPdf($sFilename, $iSelLang = 0, $target = 'I')
{
if (false == $this->getOrder()) {
$e = oxNew(noBaseObjectSetException::class);
throw $e;
throw oxNew(noBaseObjectSetException::class);
}
return parent::genPdf($sFilename, $iSelLang, $target);

View File

@ -34,7 +34,7 @@ class deliverynotePdf extends pdfdocumentsOrder
*/
public function getTitleIdent()
{
return "ORDER_OVERVIEW_PDF_DNOTE";
return "D3_PDFDOCUMENTS_DELIVERYNOTE";
}
/**

View File

@ -32,7 +32,7 @@ class deliverynotewithoutlogoPdf extends deliverynotePdf
*/
public function getTitleIdent()
{
return "ORDER_OVERVIEW_PDF_DNOTE_WITHOUT_LOGO";
return "D3_PDFDOCUMENTS_DELIVERYNOTE_WITHOUT_LOGO";
}
/**

View File

@ -40,7 +40,7 @@ class invoicePdf extends pdfdocumentsOrder implements pdfdocumentsOrderinvoiceIn
*/
public function getTitleIdent()
{
return "ORDER_OVERVIEW_PDF_STANDART";
return "D3_PDFDOCUMENTS_INVOICE";
}
/**
@ -103,8 +103,6 @@ class invoicePdf extends pdfdocumentsOrder implements pdfdocumentsOrderinvoiceIn
}
/**
* @param string $sFilename
*
* @return string
*/
public function getFilename()

View File

@ -33,7 +33,7 @@ class invoicewithoutlogoPdf extends invoicePdf
*/
public function getTitleIdent()
{
return "ORDER_OVERVIEW_PDF_STANDART_WITHOUT_LOGO";
return "D3_PDFDOCUMENTS_INVOICE_WITHOUT_LOGO";
}
/**

View File

@ -75,6 +75,7 @@ abstract class registryAbstract implements registryGenericInterface
/**
* @param $className * generator fully qualified class name
* @return bool
*/
public function hasGenerator($className)
{

View File

@ -38,7 +38,9 @@ $aLang = array(
'D3_PDFDOCUMENTS_DELIVERYADDRESS' => 'Lieferadresse',
'D3_PDFDOCUMENTS_INVOICE' => 'Rechnung',
'D3_PDFDOCUMENTS_INVOICE_WITHOUT_LOGO' => 'Rechnung ohne Logo',
'D3_PDFDOCUMENTS_DELIVERYNOTE' => 'Lieferschein',
'D3_PDFDOCUMENTS_DELIVERYNOTE_WITHOUT_LOGO' => 'Lieferschein ohne Logo',
'D3_PDFDOCUMENTS_ORDERNR' => 'Bestellnr.',
'D3_PDFDOCUMENTS_ORDER_FROM_AT' => 'Ihre Bestellung vom %1$s bei "%2$s"',

View File

@ -37,7 +37,9 @@ $aLang = array(
'D3_PDFDOCUMENTS_DELIVERYADDRESS' => 'Shipping Address',
'D3_PDFDOCUMENTS_INVOICE' => 'Invoice',
'D3_PDFDOCUMENTS_INVOICE_WITHOUT_LOGO' => 'Invoice without logo',
'D3_PDFDOCUMENTS_DELIVERYNOTE' => 'Deliverynote',
'D3_PDFDOCUMENTS_DELIVERYNOTE_WITHOUT_LOGO' => 'Deliverynote without logo',
'D3_PDFDOCUMENTS_ORDERNR' => 'Order No.',
'D3_PDFDOCUMENTS_ORDER_FROM_AT' => 'Your order from %1$s at "%2$s"',

View File

@ -18,4 +18,12 @@ $aLang = array(
'SHOP_MODULE_GROUP_d3PdfDocumentsmain' => 'Grundeinstellungen',
'SHOP_MODULE_d3PdfDocumentsbDev' => 'Entwicklermodus',
'D3_PDFDOCUMENTS_INVOICE' => 'Rechnung',
'D3_PDFDOCUMENTS_INVOICE_WITHOUT_LOGO' => 'Rechnung ohne Logo',
'D3_PDFDOCUMENTS_DELIVERYNOTE' => 'Lieferschein',
'D3_PDFDOCUMENTS_DELIVERYNOTE_WITHOUT_LOGO' => 'Lieferschein ohne Logo',
'D3_PDFDOCUMENTS_PDF_TYPE' => 'PDF Typ',
'D3_PDFDOCUMENTS_PDF_GENERATE' => 'PDF ausgeben',
);

View File

@ -18,4 +18,12 @@ $aLang = array(
'SHOP_MODULE_GROUP_d3PdfDocumentsmain' => 'Basic settings',
'SHOP_MODULE_d3PdfDocumentsbDev' => 'Developer mode',
'D3_PDFDOCUMENTS_INVOICE' => 'Invoice',
'D3_PDFDOCUMENTS_INVOICE_WITHOUT_LOGO' => 'Invoice without logo',
'D3_PDFDOCUMENTS_DELIVERYNOTE' => 'Deliverynote',
'D3_PDFDOCUMENTS_DELIVERYNOTE_WITHOUT_LOGO' => 'Deliverynote without logo',
'D3_PDFDOCUMENTS_PDF_TYPE' => 'PDF Type',
'D3_PDFDOCUMENTS_PDF_GENERATE' => 'Create PDF',
);

View File

@ -1,18 +1,18 @@
[{if $edit && $oView->canExport()}]
[{if $edit && $oView->d3CanExport()}]
<br>
<form name="myedit2" id="myedit2" action="[{$oViewConf->getSelfLink()}]" method="post" target="expPDF">
[{$oViewConf->getHiddenSid()}]
<input type="hidden" name="cl" value="order_overview">
<input type="hidden" name="fnc" value="createPDF">
<input type="hidden" name="fnc" value="d3CreatePDF">
<input type="hidden" name="oxid" value="[{$oxid}]">
<table style="border-spacing: 0;border-collapse: collapse;padding: 5px;border : 1px #A9A9A9 solid; width:220px">
<tr>
<td rowspan="3">
<img src="[{$oViewConf->getImageUrl()}]/pdf_icon.gif" width="41" height="38" alt="" border="0" hspace="0" vspace="0" align="absmiddle">
<img src="[{$oViewConf->getImageUrl()}]/pdf_icon.gif" style="width: 41px; height: 38px; border: none;" alt="" hspace="0" vspace="0" align="absmiddle">
</td>
<td valign="top" class="edittext" align="right">
[{oxmultilang ident="ORDER_OVERVIEW_PDF_TYPE"}]:&nbsp;
<select name="pdftype" class="editinput" style="width:80px;">
<td style="vertical-align: top; text-align: right" class="edittext">
<label for="pdftype">[{oxmultilang ident="D3_PDFDOCUMENTS_PDF_TYPE"}]</label>:&nbsp;
<select id="pdftype" name="pdftype" class="editinput" style="width:80px;">
[{block name="d3_pdfdocuments_order_overview_pdfTypeOptions"}]
[{assign var="generatorList" value=$oView->d3getGeneratorList()}]
[{foreach from=$generatorList->getList() item="generator"}]
@ -23,9 +23,9 @@
</td>
</tr>
<tr>
<td align="right" class="edittext">
[{oxmultilang ident="GENERAL_LANGUAGE"}]
<select name="pdflanguage" class="saveinnewlanginput" style="width:80px;">
<td style="text-align: right" class="edittext">
<label for="pdflanguage">[{oxmultilang ident="GENERAL_LANGUAGE"}]</label>
<select id="pdflanguage" name="pdflanguage" class="saveinnewlanginput" style="width:80px;">
[{foreach from=$alangs key=lang item=slang}]
<option value="[{$lang}]" [{if $lang == "0"}]SELECTED[{/if}]>[{$slang}]</option>
[{/foreach}]
@ -33,9 +33,9 @@
</td>
</tr>
<tr>
<td align="right" class="edittext"><br/>
<input type="submit" class="edittext" name="save" value="[{oxmultilang ident="ORDER_OVERVIEW_PDF"}]">
<iframe name="expPDF" width="0" height="0" border="0" style="display:none;"></iframe>
<td style="text-align: right" class="edittext"><br/>
<input type="submit" class="edittext" name="save" value="[{oxmultilang ident="D3_PDFDOCUMENTS_PDF_GENERATE"}]">
<iframe name="expPDF" style="width: 0; height: 0; border: none; display:none;"></iframe>
</td>
</tr>
</table>

View File

@ -18,50 +18,59 @@
namespace D3\PdfDocuments\Modules\Application\Controller;
use D3\PdfDocuments\Application\Controller\orderOverviewPdfGenerator;
use D3\PdfDocuments\Application\Model\Exceptions\noBaseObjectSetException;
use D3\PdfDocuments\Application\Model\Exceptions\noPdfHandlerFoundException;
use D3\PdfDocuments\Application\Model\Exceptions\pdfGeneratorExceptionAbstract;
use D3\PdfDocuments\Application\Model\Registries\registryOrderoverview;
use D3\PdfDocuments\Modules\Application\Model\d3_Order_PdfDocuments;
use OxidEsales\Eshop\Application\Model\Order;
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\TableViewNameGenerator;
use OxidEsales\Eshop\Core\UtilsView;
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 = DatabaseProvider::getMaster();
$sOrderId = $this->getEditObjectId();
/**
* @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();
$viewNameGenerator = Registry::get(TableViewNameGenerator::class);
$sTable = $viewNameGenerator->getViewName("oxorderarticles");
$viewNameGenerator = Registry::get(TableViewNameGenerator::class);
$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)) {
/** @var d3_Order_PdfDocuments $oOrder */
$oOrder = oxNew(Order::class);
if ($oOrder->load($soxId)) {
$generator = oxNew( orderOverviewPdfGenerator::class );
$generator->generatePdf($oOrder, Registry::getRequest()->getRequestEscapedParameter("pdflanguage"));
}
$sQ = "select count(oxid) from {$sTable} where oxorderid = " . $masterDb->quote($sOrderId) . " and oxstorno = 0";
return (bool) $masterDb->getOne($sQ);
}
}
/**
* @return registryOrderoverview
* @throws noBaseObjectSetException
* @throws noPdfHandlerFoundException
* @throws pdfGeneratorExceptionAbstract
*/
public function d3getGeneratorList()
{
return oxNew(registryOrderoverview::class);
}
public function d3CreatePDF()
{
$soxId = $this->getEditObjectId();
if ($soxId != "-1" && isset($soxId)) {
/** @var d3_Order_PdfDocuments $oOrder */
$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);
}
}

View File

@ -16,9 +16,7 @@
*/
use D3\PdfDocuments\Modules\Application\Controller\d3_overview_controller_pdfdocuments;
use D3\PdfDocuments\Modules\Application\Model\d3_Order_PdfDocuments as d3_pdfdocs_OrderModel;
use OxidEsales\Eshop\Application\Controller\Admin\OrderOverview;
use OxidEsales\Eshop\Application\Model as OxidModel;
/**
* Metadata version

View File

@ -79,6 +79,7 @@ table{
}
.salutation .documenttype {
font-weight: bold;
margin-bottom: 5mm;
}
.article_table,