development mode ask for document type
# Conflicts: # Application/Model/AbstractClasses/pdfdocumentsGeneric.php # Application/Model/Interfaces/pdfdocumentsGenericInterface.php
Cette révision appartient à :
@ -15,6 +15,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace D3\PdfDocuments\Application\Controller;
|
||||
|
||||
use D3\PdfDocuments\Application\Model\Constants;
|
||||
use D3\PdfDocuments\Application\Model\Exceptions\noPdfHandlerFoundException;
|
||||
use D3\PdfDocuments\Application\Model\Exceptions\wrongPdfGeneratorInterface;
|
||||
use D3\PdfDocuments\Application\Model\Interfaces\pdfdocumentsOrderInterface;
|
||||
@ -23,6 +24,8 @@ use D3\PdfDocuments\Application\Model\Registries\registryOrderoverviewInterface;
|
||||
use OxidEsales\Eshop\Application\Model\Order;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingService;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingServiceInterface;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
@ -36,6 +39,13 @@ class orderOverviewPdfGenerator
|
||||
{
|
||||
$Pdf = $this->getPdfClass();
|
||||
|
||||
/** @var ModuleSettingService $settingsService */
|
||||
$settingsService = ContainerFactory::getInstance()->getContainer()->get(ModuleSettingServiceInterface::class);
|
||||
|
||||
$Pdf->setDevelopmentMode(
|
||||
$settingsService->getBoolean('d3PdfDocumentsbDev', Constants::OXID_MODULE_ID) &&
|
||||
Registry::getRequest()->getRequestEscapedParameter('devmode')
|
||||
);
|
||||
$Pdf->setOrder($order);
|
||||
$Pdf->downloadPdf($iSelLang);
|
||||
}
|
||||
|
@ -48,6 +48,13 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
|
||||
public string $filenameExtension = 'pdf';
|
||||
public ?string $filename = null;
|
||||
|
||||
protected $devMode = false;
|
||||
|
||||
public function setDevelopmentMode(bool $devMode)
|
||||
{
|
||||
$this->devMode = $devMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
@ -347,8 +354,7 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
|
||||
*/
|
||||
public function output(Html2Pdf $pdf, string $filename, string $target, string $html): ?string
|
||||
{
|
||||
$moduleSettings = ContainerFactory::getInstance()->getContainer()->get(ModuleSettingServiceInterface::class);
|
||||
if ($moduleSettings->getBoolean('d3PdfDocumentsbDev', Constants::OXID_MODULE_ID)) {
|
||||
if ($this->devMode) {
|
||||
return $this->outputDev($pdf, $filename, $target, $html);
|
||||
} else {
|
||||
return $pdf->output($filename, $target);
|
||||
|
@ -17,6 +17,8 @@ namespace D3\PdfDocuments\Application\Model\Interfaces;
|
||||
|
||||
interface pdfdocumentsGenericInterface
|
||||
{
|
||||
public function setDevelopmentMode(bool $devMode);
|
||||
|
||||
public function getRequestId(): string;
|
||||
|
||||
public function getTitleIdent(): string;
|
||||
|
@ -21,11 +21,11 @@ $basicAuthHelp = <<<HELP
|
||||
HELP;
|
||||
|
||||
return [
|
||||
'charset' => 'utf-8',
|
||||
'charset' => 'utf-8',
|
||||
|
||||
'SHOP_MODULE_GROUP_d3PdfDocumentsmain' => 'Grundeinstellungen',
|
||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'Entwicklermodus',
|
||||
'HELP_SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'Mit aktiviertem Entwicklermodus wird das Dokument im '.
|
||||
'SHOP_MODULE_GROUP_'. Constants::OXID_MODULE_ID.'main' => 'Grundeinstellungen',
|
||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'Entwicklermodus',
|
||||
'HELP_SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'Mit aktiviertem Entwicklermodus wird das Dokument im '.
|
||||
'HTML-Format ausgegeben. Inhaltliche Fehler können so besser nachvollzogen werden.',
|
||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'basicAuthUserName' => 'BasicAuth des Shops - Benutzername (optional)',
|
||||
'HELP_SHOP_MODULE_'. Constants::OXID_MODULE_ID.'basicAuthUserName' => $basicAuthHelp,
|
||||
@ -35,15 +35,15 @@ return [
|
||||
'SHOP_MODULE_GROUP_'. Constants::OXID_MODULE_ID.'invoice' => 'Rechnung',
|
||||
'SHOP_MODULE_invoicePaymentTerm' => 'Zahlungsziel (in Tagen)',
|
||||
|
||||
'SHOP_MODULE_GROUP_d3PdfDocumentscontents' => 'Inhalte',
|
||||
'SHOP_MODULE_d3PdfDocumentsLogoUrl' => 'Logo-Grafik URL',
|
||||
'SHOP_MODULE_d3PdfDocumentsBackgroundUrl' => 'Hintergrund-Grafik URL',
|
||||
'SHOP_MODULE_GROUP_'. Constants::OXID_MODULE_ID.'contents' => 'Inhalte',
|
||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'LogoUrl' => 'Logo-Grafik URL',
|
||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'BackgroundUrl' => 'Hintergrund-Grafik URL',
|
||||
|
||||
'SHOP_MODULE_GROUP_d3PdfDocumentsdocuments' => 'Dokumente',
|
||||
'SHOP_MODULE_d3PdfDocumentsDocInvoice' => 'Rechnung',
|
||||
'SHOP_MODULE_d3PdfDocumentsDocInvoiceNoLogo' => 'Rechnung ohne Logo',
|
||||
'SHOP_MODULE_d3PdfDocumentsDocDeliveryNote' => 'Lieferschein',
|
||||
'SHOP_MODULE_d3PdfDocumentsDocDeliveryNoteNoLogo' => 'Lieferschein ohne Logo',
|
||||
'SHOP_MODULE_GROUP_'. Constants::OXID_MODULE_ID.'documents' => 'Dokumente',
|
||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'DocInvoice' => 'Rechnung',
|
||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'DocInvoiceNoLogo' => 'Rechnung ohne Logo',
|
||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'DocDeliveryNote' => 'Lieferschein',
|
||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'DocDeliveryNoteNoLogo' => 'Lieferschein ohne Logo',
|
||||
|
||||
'D3_PDFDOCUMENTS' => 'PDF-Dokumente',
|
||||
'D3_PDFDOCUMENTS_INVOICE' => 'Rechnung',
|
||||
@ -53,6 +53,7 @@ return [
|
||||
|
||||
'D3_PDFDOCUMENTS_PDF_TYPE' => 'Dokument',
|
||||
'D3_PDFDOCUMENTS_LANGUAGE' => 'Sprache',
|
||||
'D3_PDFDOCUMENTS_SGML_GENERATE' => 'SGML erstellen',
|
||||
'D3_PDFDOCUMENTS_PDF_GENERATE' => 'Dokument erstellen',
|
||||
];
|
||||
// @codeCoverageIgnoreEnd
|
@ -23,7 +23,7 @@ $basicAuthHelp = <<<HELP
|
||||
return [
|
||||
'charset' => 'utf-8',
|
||||
|
||||
'SHOP_MODULE_GROUP_d3PdfDocumentsmain' => 'Basic settings',
|
||||
'SHOP_MODULE_GROUP_'. Constants::OXID_MODULE_ID.'main' => 'Basic settings',
|
||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'Developer mode',
|
||||
'HELP_SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'If developer mode is activated, the document is output in '.
|
||||
'HTML format. This makes it much easier to trace content errors.',
|
||||
@ -35,15 +35,15 @@ return [
|
||||
'SHOP_MODULE_GROUP_'. Constants::OXID_MODULE_ID.'invoice' => 'Invoice',
|
||||
'SHOP_MODULE_invoicePaymentTerm' => 'Payment term (in days)',
|
||||
|
||||
'SHOP_MODULE_GROUP_d3PdfDocumentscontents' => 'Contents',
|
||||
'SHOP_MODULE_d3PdfDocumentsLogoUrl' => 'Logo image URL',
|
||||
'SHOP_MODULE_d3PdfDocumentsBackgroundUrl' => 'Background image URL',
|
||||
'SHOP_MODULE_GROUP_'. Constants::OXID_MODULE_ID.'contents' => 'Contents',
|
||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'LogoUrl' => 'Logo image URL',
|
||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'BackgroundUrl' => 'Background image URL',
|
||||
|
||||
'SHOP_MODULE_GROUP_d3PdfDocumentsdocuments' => 'Documents',
|
||||
'SHOP_MODULE_d3PdfDocumentsDocInvoice' => 'Invoice',
|
||||
'SHOP_MODULE_d3PdfDocumentsDocInvoiceNoLogo' => 'Invoice without logo',
|
||||
'SHOP_MODULE_d3PdfDocumentsDocDeliveryNote' => 'Delivery note',
|
||||
'SHOP_MODULE_d3PdfDocumentsDocDeliveryNoteNoLogo' => 'Delivery note without logo',
|
||||
'SHOP_MODULE_GROUP_'. Constants::OXID_MODULE_ID.'documents' => 'Documents',
|
||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'DocInvoice' => 'Invoice',
|
||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'DocInvoiceNoLogo' => 'Invoice without logo',
|
||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'DocDeliveryNote' => 'Delivery note',
|
||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'DocDeliveryNoteNoLogo' => 'Delivery note without logo',
|
||||
|
||||
'D3_PDFDOCUMENTS' => 'PDF Documents',
|
||||
'D3_PDFDOCUMENTS_INVOICE' => 'Invoice',
|
||||
@ -53,6 +53,7 @@ return [
|
||||
|
||||
'D3_PDFDOCUMENTS_PDF_TYPE' => 'Document',
|
||||
'D3_PDFDOCUMENTS_LANGUAGE' => 'Language',
|
||||
'D3_PDFDOCUMENTS_SGML_GENERATE' => 'Create SGML',
|
||||
'D3_PDFDOCUMENTS_PDF_GENERATE' => 'Create Document',
|
||||
];
|
||||
// @codeCoverageIgnoreEnd
|
@ -14,6 +14,7 @@
|
||||
namespace D3\PdfDocuments\Modules\Application\Controller;
|
||||
|
||||
use D3\PdfDocuments\Application\Controller\orderOverviewPdfGenerator;
|
||||
use D3\PdfDocuments\Application\Model\Constants;
|
||||
use D3\PdfDocuments\Application\Model\Exceptions\noPdfHandlerFoundException;
|
||||
use D3\PdfDocuments\Application\Model\Exceptions\pdfGeneratorExceptionAbstract;
|
||||
use D3\PdfDocuments\Application\Model\Exceptions\wrongPdfGeneratorInterface;
|
||||
@ -30,6 +31,8 @@ use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\TableViewNameGenerator;
|
||||
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Database\QueryBuilderFactoryInterface;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingService;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingServiceInterface;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
@ -63,6 +66,13 @@ class d3_overview_controller_pdfdocuments extends d3_overview_controller_pdfdocu
|
||||
return parent::render();
|
||||
}
|
||||
|
||||
public function d3PdfDocsIsDevMode(): bool
|
||||
{
|
||||
/** @var ModuleSettingService $settingsService */
|
||||
$settingsService = ContainerFactory::getInstance()->getContainer()->get(ModuleSettingServiceInterface::class);
|
||||
return $settingsService->getBoolean('d3PdfDocumentsbDev', Constants::OXID_MODULE_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DBALDriverException
|
||||
*/
|
||||
|
24
metadata.php
24
metadata.php
@ -107,36 +107,36 @@ $aModule = [
|
||||
'value' => 7,
|
||||
],
|
||||
[
|
||||
'group' => $sModuleId.'contents',
|
||||
'name' => $sModuleId.'LogoUrl',
|
||||
'group' => Constants::OXID_MODULE_ID.'contents',
|
||||
'name' => Constants::OXID_MODULE_ID.'LogoUrl',
|
||||
'type' => 'str'
|
||||
],
|
||||
[
|
||||
'group' => $sModuleId.'contents',
|
||||
'name' => $sModuleId.'BackgroundUrl',
|
||||
'group' => Constants::OXID_MODULE_ID.'contents',
|
||||
'name' => Constants::OXID_MODULE_ID.'BackgroundUrl',
|
||||
'type' => 'str'
|
||||
],
|
||||
[
|
||||
'group' => $sModuleId.'documents',
|
||||
'name' => $sModuleId.'DocInvoice',
|
||||
'group' => Constants::OXID_MODULE_ID.'documents',
|
||||
'name' => Constants::OXID_MODULE_ID.'DocInvoice',
|
||||
'type' => 'bool',
|
||||
'value' => true
|
||||
],
|
||||
[
|
||||
'group' => $sModuleId.'documents',
|
||||
'name' => $sModuleId.'DocInvoiceNoLogo',
|
||||
'group' => Constants::OXID_MODULE_ID.'documents',
|
||||
'name' => Constants::OXID_MODULE_ID.'DocInvoiceNoLogo',
|
||||
'type' => 'bool',
|
||||
'value' => true
|
||||
],
|
||||
[
|
||||
'group' => $sModuleId.'documents',
|
||||
'name' => $sModuleId.'DocDeliveryNote',
|
||||
'group' => Constants::OXID_MODULE_ID.'documents',
|
||||
'name' => Constants::OXID_MODULE_ID.'DocDeliveryNote',
|
||||
'type' => 'bool',
|
||||
'value' => true
|
||||
],
|
||||
[
|
||||
'group' => $sModuleId.'documents',
|
||||
'name' => $sModuleId.'DocDeliveryNoteNoLogo',
|
||||
'group' => Constants::OXID_MODULE_ID.'documents',
|
||||
'name' => Constants::OXID_MODULE_ID.'DocDeliveryNoteNoLogo',
|
||||
'type' => 'bool',
|
||||
'value' => true
|
||||
],
|
||||
|
@ -1,10 +1,13 @@
|
||||
[{if $edit && $oView->d3CanExport()}]
|
||||
<br>
|
||||
[{assign var="devmode" value=$oView->d3PdfDocsIsDevMode()}]
|
||||
|
||||
<form name="d3CreatePdf" id="d3CreatePdf" action="[{$oViewConf->getSelfLink()}]" method="post" target="d3ExpPDF">
|
||||
[{$oViewConf->getHiddenSid()}]
|
||||
<input type="hidden" name="cl" value="order_overview">
|
||||
<input type="hidden" name="fnc" value="d3CreatePDF">
|
||||
<input type="hidden" name="oxid" value="[{$oxid}]">
|
||||
[{if $devmode}]<input type="hidden" id="devmode" name="devmode" value="0">[{/if}]
|
||||
<fieldset style="padding: 5px">
|
||||
<legend>[{oxmultilang ident="D3_PDFDOCUMENTS"}]</legend>
|
||||
<table style="width: 100%">
|
||||
@ -36,7 +39,10 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: right" class="edittext"><br/>
|
||||
<input type="submit" class="edittext" name="save" value="[{oxmultilang ident="D3_PDFDOCUMENTS_PDF_GENERATE"}]">
|
||||
[{if $devmode}]
|
||||
<input type="submit" class="edittext" name="save" value="[{oxmultilang ident="D3_PDFDOCUMENTS_SGML_GENERATE"}]" onclick="document.getElementById('devmode').value = 1;">
|
||||
[{/if}]
|
||||
<input type="submit" class="edittext" name="save" value="[{oxmultilang ident="D3_PDFDOCUMENTS_PDF_GENERATE"}]" [{if $devmode}] onclick="document.getElementById('devmode').value = 0;"[{/if}]>
|
||||
<iframe name="d3ExpPDF" style="width: 0; height: 0; border: none; display:none;"></iframe>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -1,10 +1,13 @@
|
||||
{% if edit and oView.d3CanExport() %}
|
||||
<br>
|
||||
{% set devmode = oView.d3PdfDocsIsDevMode() %}
|
||||
|
||||
<form name="d3CreatePdf" id="d3CreatePdf" action="{{ oViewConf.getSelfLink() }}" method="post" target="d3ExpPDF">
|
||||
{{ oViewConf.getHiddenSid()|raw }}
|
||||
<input type="hidden" name="cl" value="order_overview">
|
||||
<input type="hidden" name="fnc" value="d3CreatePDF">
|
||||
<input type="hidden" name="oxid" value="{{ oxid }}">
|
||||
{% if devmode %}<input type="hidden" id="devmode" name="devmode" value="0">{% endif %}
|
||||
<fieldset style="padding: 5px">
|
||||
<legend>{{ translate({ ident: "D3_PDFDOCUMENTS" }) }}</legend>
|
||||
<table style="width: 100%">
|
||||
@ -36,7 +39,10 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: right" class="edittext"><br/>
|
||||
<input type="submit" class="edittext" name="save" value="{{ translate({ ident: "D3_PDFDOCUMENTS_PDF_GENERATE" }) }}">
|
||||
{% if devmode %}
|
||||
<input type="submit" class="edittext" name="save" value="{{ translate({ ident: "D3_PDFDOCUMENTS_SGML_GENERATE" }) }}" onclick="document.getElementById('devmode').value = 1;">
|
||||
{% endif %}
|
||||
<input type="submit" class="edittext" name="save" value="{{ translate({ ident: "D3_PDFDOCUMENTS_PDF_GENERATE" }) }}" {% if devmode %} onclick="document.getElementById('devmode').value = 0;"{% endif %}>
|
||||
<iframe name="d3ExpPDF" style="width: 0; height: 0; border: none; display:none;"></iframe>
|
||||
</td>
|
||||
</tr>
|
||||
|
Référencer dans un nouveau ticket
Bloquer un utilisateur