improve code
This commit is contained in:
@ -17,7 +17,6 @@ namespace D3\PdfDocuments\Application\Controller;
|
|||||||
|
|
||||||
use D3\PdfDocuments\Application\Model\Constants;
|
use D3\PdfDocuments\Application\Model\Constants;
|
||||||
use D3\PdfDocuments\Application\Model\Exceptions\noPdfHandlerFoundException;
|
use D3\PdfDocuments\Application\Model\Exceptions\noPdfHandlerFoundException;
|
||||||
use D3\PdfDocuments\Application\Model\Exceptions\wrongPdfGeneratorInterface;
|
|
||||||
use D3\PdfDocuments\Application\Model\Interfaces\pdfdocumentsOrderInterface;
|
use D3\PdfDocuments\Application\Model\Interfaces\pdfdocumentsOrderInterface;
|
||||||
use D3\PdfDocuments\Application\Model\Registries\registryOrderoverview;
|
use D3\PdfDocuments\Application\Model\Registries\registryOrderoverview;
|
||||||
use D3\PdfDocuments\Application\Model\Registries\registryOrderoverviewInterface;
|
use D3\PdfDocuments\Application\Model\Registries\registryOrderoverviewInterface;
|
||||||
@ -32,8 +31,9 @@ use Psr\Container\NotFoundExceptionInterface;
|
|||||||
class orderOverviewPdfGenerator
|
class orderOverviewPdfGenerator
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
* @throws noPdfHandlerFoundException
|
* @throws noPdfHandlerFoundException
|
||||||
* @throws wrongPdfGeneratorInterface
|
|
||||||
*/
|
*/
|
||||||
public function generatePdf(Order $order, int $iSelLang = 0): void
|
public function generatePdf(Order $order, int $iSelLang = 0): void
|
||||||
{
|
{
|
||||||
@ -51,7 +51,6 @@ class orderOverviewPdfGenerator
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws wrongPdfGeneratorInterface
|
|
||||||
* @throws ContainerExceptionInterface
|
* @throws ContainerExceptionInterface
|
||||||
* @throws NotFoundExceptionInterface
|
* @throws NotFoundExceptionInterface
|
||||||
* @throws noPdfHandlerFoundException
|
* @throws noPdfHandlerFoundException
|
||||||
|
@ -34,7 +34,7 @@ abstract class pdfdocumentsOrder extends pdfdocumentsGeneric implements orderInt
|
|||||||
public ?Order $order = null;
|
public ?Order $order = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* don't use order as constructor argument because of same method interface for all document types
|
* don't use order as constructor argument because of the same method interface for all document types
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@ -106,7 +106,6 @@ abstract class pdfdocumentsOrder extends pdfdocumentsGeneric implements orderInt
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int
|
|
||||||
* @throws ContainerExceptionInterface
|
* @throws ContainerExceptionInterface
|
||||||
* @throws NotFoundExceptionInterface
|
* @throws NotFoundExceptionInterface
|
||||||
* @throws ModuleSettingNotFountException
|
* @throws ModuleSettingNotFountException
|
||||||
@ -126,6 +125,11 @@ abstract class pdfdocumentsOrder extends pdfdocumentsGeneric implements orderInt
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws ModuleSettingNotFountException
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
|
*/
|
||||||
public function getPayableUntilDate(): false|int
|
public function getPayableUntilDate(): false|int
|
||||||
{
|
{
|
||||||
$startDate = $this->getOrder()->getFieldData('oxbilldate');
|
$startDate = $this->getOrder()->getFieldData('oxbilldate');
|
||||||
|
@ -15,7 +15,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace D3\PdfDocuments\Application\Model\Registries;
|
namespace D3\PdfDocuments\Application\Model\Registries;
|
||||||
|
|
||||||
use Assert\Assert;
|
|
||||||
use D3\PdfDocuments\Application\Model\Exceptions\wrongPdfGeneratorInterface;
|
use D3\PdfDocuments\Application\Model\Exceptions\wrongPdfGeneratorInterface;
|
||||||
use D3\PdfDocuments\Application\Model\Interfaces\pdfdocumentsGenericInterface;
|
use D3\PdfDocuments\Application\Model\Interfaces\pdfdocumentsGenericInterface;
|
||||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||||
@ -40,7 +39,6 @@ abstract class registryAbstract implements registryGenericInterface
|
|||||||
if (!$this->hasGenerator($className)) {
|
if (!$this->hasGenerator($className)) {
|
||||||
/** @var pdfdocumentsGenericInterface $generator */
|
/** @var pdfdocumentsGenericInterface $generator */
|
||||||
$generator = oxNew($className);
|
$generator = oxNew($className);
|
||||||
|
|
||||||
$this->addItem($generator);
|
$this->addItem($generator);
|
||||||
} else {
|
} else {
|
||||||
throw oxNew(StandardException::class, 'generator still exists in registry');
|
throw oxNew(StandardException::class, 'generator still exists in registry');
|
||||||
|
@ -15,39 +15,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace D3\PdfDocuments\Application\Model\Registries;
|
namespace D3\PdfDocuments\Application\Model\Registries;
|
||||||
|
|
||||||
use D3\PdfDocuments\Application\Model\Constants;
|
|
||||||
use D3\PdfDocuments\Application\Model\Documents\deliverynotePdf;
|
|
||||||
use D3\PdfDocuments\Application\Model\Documents\deliverynotewithoutlogoPdf;
|
|
||||||
use D3\PdfDocuments\Application\Model\Documents\invoicePdf;
|
|
||||||
use D3\PdfDocuments\Application\Model\Documents\invoicewithoutlogoPdf;
|
|
||||||
use D3\PdfDocuments\Application\Model\Exceptions\wrongPdfGeneratorInterface;
|
|
||||||
use D3\PdfDocuments\Application\Model\Interfaces\pdfdocumentsOrderInterface;
|
use D3\PdfDocuments\Application\Model\Interfaces\pdfdocumentsOrderInterface;
|
||||||
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
|
||||||
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingService;
|
|
||||||
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingServiceInterface;
|
|
||||||
|
|
||||||
class registryOrdermanagerActions extends registryAbstract implements registryOrdermanagerActionsInterface
|
class registryOrdermanagerActions extends registryAbstract implements registryOrdermanagerActionsInterface
|
||||||
{
|
{
|
||||||
/**
|
use registryTrait;
|
||||||
* @throws wrongPdfGeneratorInterface
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
/** @var ModuleSettingService $settingsService */
|
|
||||||
$settingsService = ContainerFactory::getInstance()->getContainer()->get(ModuleSettingServiceInterface::class);
|
|
||||||
if ($settingsService->getBoolean('d3PdfDocumentsDocInvoice', Constants::OXID_MODULE_ID)) {
|
|
||||||
$this->addGenerator(invoicePdf::class);
|
|
||||||
}
|
|
||||||
if ($settingsService->getBoolean('d3PdfDocumentsDocDeliveryNote', Constants::OXID_MODULE_ID)) {
|
|
||||||
$this->addGenerator(deliverynotePdf::class);
|
|
||||||
}
|
|
||||||
if ($settingsService->getBoolean('d3PdfDocumentsDocInvoiceNoLogo', Constants::OXID_MODULE_ID)) {
|
|
||||||
$this->addGenerator(invoicewithoutlogoPdf::class);
|
|
||||||
}
|
|
||||||
if ($settingsService->getBoolean('d3PdfDocumentsDocDeliveryNoteNoLogo', Constants::OXID_MODULE_ID)) {
|
|
||||||
$this->addGenerator(deliverynotewithoutlogoPdf::class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
|
@ -15,43 +15,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace D3\PdfDocuments\Application\Model\Registries;
|
namespace D3\PdfDocuments\Application\Model\Registries;
|
||||||
|
|
||||||
use D3\PdfDocuments\Application\Model\Constants;
|
|
||||||
use D3\PdfDocuments\Application\Model\Documents\deliverynotePdf;
|
|
||||||
use D3\PdfDocuments\Application\Model\Documents\deliverynotewithoutlogoPdf;
|
|
||||||
use D3\PdfDocuments\Application\Model\Documents\invoicePdf;
|
|
||||||
use D3\PdfDocuments\Application\Model\Documents\invoicewithoutlogoPdf;
|
|
||||||
use D3\PdfDocuments\Application\Model\Exceptions\wrongPdfGeneratorInterface;
|
|
||||||
use D3\PdfDocuments\Application\Model\Interfaces\pdfdocumentsOrderInterface;
|
use D3\PdfDocuments\Application\Model\Interfaces\pdfdocumentsOrderInterface;
|
||||||
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;
|
|
||||||
|
|
||||||
class registryOrderoverview extends registryAbstract implements registryOrderoverviewInterface
|
class registryOrderoverview extends registryAbstract implements registryOrderoverviewInterface
|
||||||
{
|
{
|
||||||
/**
|
use registryTrait;
|
||||||
* @throws ContainerExceptionInterface
|
|
||||||
* @throws NotFoundExceptionInterface
|
|
||||||
* @throws wrongPdfGeneratorInterface
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
/** @var ModuleSettingService $settingsService */
|
|
||||||
$settingsService = ContainerFactory::getInstance()->getContainer()->get(ModuleSettingServiceInterface::class);
|
|
||||||
if ($settingsService->getBoolean('d3PdfDocumentsDocInvoice', Constants::OXID_MODULE_ID)) {
|
|
||||||
$this->addGenerator(invoicePdf::class);
|
|
||||||
}
|
|
||||||
if ($settingsService->getBoolean('d3PdfDocumentsDocDeliveryNote', Constants::OXID_MODULE_ID)) {
|
|
||||||
$this->addGenerator(deliverynotePdf::class);
|
|
||||||
}
|
|
||||||
if ($settingsService->getBoolean('d3PdfDocumentsDocInvoiceNoLogo', Constants::OXID_MODULE_ID)) {
|
|
||||||
$this->addGenerator(invoicewithoutlogoPdf::class);
|
|
||||||
}
|
|
||||||
if ($settingsService->getBoolean('d3PdfDocumentsDocDeliveryNoteNoLogo', Constants::OXID_MODULE_ID)) {
|
|
||||||
$this->addGenerator(deliverynotewithoutlogoPdf::class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
|
41
Application/Model/Registries/registryTrait.php
Normal file
41
Application/Model/Registries/registryTrait.php
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace D3\PdfDocuments\Application\Model\Registries;
|
||||||
|
|
||||||
|
use D3\PdfDocuments\Application\Model\Constants;
|
||||||
|
use D3\PdfDocuments\Application\Model\Documents\deliverynotePdf;
|
||||||
|
use D3\PdfDocuments\Application\Model\Documents\deliverynotewithoutlogoPdf;
|
||||||
|
use D3\PdfDocuments\Application\Model\Documents\invoicePdf;
|
||||||
|
use D3\PdfDocuments\Application\Model\Documents\invoicewithoutlogoPdf;
|
||||||
|
use D3\PdfDocuments\Application\Model\Exceptions\wrongPdfGeneratorInterface;
|
||||||
|
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;
|
||||||
|
|
||||||
|
trait registryTrait
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
|
* @throws wrongPdfGeneratorInterface
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
/** @var ModuleSettingService $settingsService */
|
||||||
|
$settingsService = ContainerFactory::getInstance()->getContainer()->get(ModuleSettingServiceInterface::class);
|
||||||
|
if ($settingsService->getBoolean('d3PdfDocumentsDocInvoice', Constants::OXID_MODULE_ID)) {
|
||||||
|
$this->addGenerator(invoicePdf::class);
|
||||||
|
}
|
||||||
|
if ($settingsService->getBoolean('d3PdfDocumentsDocDeliveryNote', Constants::OXID_MODULE_ID)) {
|
||||||
|
$this->addGenerator(deliverynotePdf::class);
|
||||||
|
}
|
||||||
|
if ($settingsService->getBoolean('d3PdfDocumentsDocInvoiceNoLogo', Constants::OXID_MODULE_ID)) {
|
||||||
|
$this->addGenerator(invoicewithoutlogoPdf::class);
|
||||||
|
}
|
||||||
|
if ($settingsService->getBoolean('d3PdfDocumentsDocDeliveryNoteNoLogo', Constants::OXID_MODULE_ID)) {
|
||||||
|
$this->addGenerator(deliverynotewithoutlogoPdf::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -18,8 +18,6 @@ use Assert\InvalidArgumentException;
|
|||||||
use D3\PdfDocuments\Application\Controller\orderOverviewPdfGenerator;
|
use D3\PdfDocuments\Application\Controller\orderOverviewPdfGenerator;
|
||||||
use D3\PdfDocuments\Application\Model\Constants;
|
use D3\PdfDocuments\Application\Model\Constants;
|
||||||
use D3\PdfDocuments\Application\Model\Exceptions\noPdfHandlerFoundException;
|
use D3\PdfDocuments\Application\Model\Exceptions\noPdfHandlerFoundException;
|
||||||
use D3\PdfDocuments\Application\Model\Exceptions\pdfGeneratorExceptionAbstract;
|
|
||||||
use D3\PdfDocuments\Application\Model\Exceptions\wrongPdfGeneratorInterface;
|
|
||||||
use D3\PdfDocuments\Application\Model\Registries\registryOrderoverview;
|
use D3\PdfDocuments\Application\Model\Registries\registryOrderoverview;
|
||||||
use D3\PdfDocuments\Application\Model\Registries\registryOrderoverviewInterface;
|
use D3\PdfDocuments\Application\Model\Registries\registryOrderoverviewInterface;
|
||||||
use Doctrine\DBAL\Driver\Exception as DBALDriverException;
|
use Doctrine\DBAL\Driver\Exception as DBALDriverException;
|
||||||
@ -118,7 +116,8 @@ class d3_overview_controller_pdfdocuments extends d3_overview_controller_pdfdocu
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws noPdfHandlerFoundException
|
* @throws noPdfHandlerFoundException
|
||||||
* @throws pdfGeneratorExceptionAbstract
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
*/
|
*/
|
||||||
public function d3CreatePDF(): void
|
public function d3CreatePDF(): void
|
||||||
{
|
{
|
||||||
@ -162,7 +161,8 @@ class d3_overview_controller_pdfdocuments extends d3_overview_controller_pdfdocu
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return registryOrderoverview
|
* @return registryOrderoverview
|
||||||
* @throws wrongPdfGeneratorInterface
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
public function d3getGeneratorList(): registryOrderoverview
|
public function d3getGeneratorList(): registryOrderoverview
|
||||||
|
@ -15,7 +15,7 @@ Create a wide variety of static or dynamic PDF documents at the touch of a butto
|
|||||||
|
|
||||||
At the orders of your OXID shop you have the option of creating an invoice and delivery note.
|
At the orders of your OXID shop you have the option of creating an invoice and delivery note.
|
||||||
|
|
||||||
The module can be easily extended to adapt existing documents or add new ones. Even completely different document types (e.g. article data sheets) are possible.
|
The module can be easily extended to adapt existing documents or add new ones. Even completely different document types (e.g. article data sheets or pick lists) are possible.
|
||||||
|
|
||||||
## System requirements:
|
## System requirements:
|
||||||
|
|
||||||
@ -25,9 +25,7 @@ The module can be easily extended to adapt existing documents or add new ones. E
|
|||||||
|
|
||||||
## Compatibility:
|
## Compatibility:
|
||||||
|
|
||||||
The module contains the same functionality as the 'OXID Invoice PDF' module. Basically, both modules can be installed in parallel in the shop, if required.
|
The module contains the same functionality as the former 'OXID Invoice PDF' module.
|
||||||
|
|
||||||
If the `OXID Invoice PDF` module is to be completely replaced by the `D3 PDF Documents` module (e.g. because third modules also use its function), we provide [a customization](https://packagist.org/packages/d3/pdfdocuments_compat) which is installed additionally.
|
|
||||||
|
|
||||||
## Installation:
|
## Installation:
|
||||||
|
|
||||||
|
@ -9,13 +9,13 @@
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
PDF-Dokumentgenerator für OXID eShop
|
**PDF-Dokumentgenerator für OXID eShop**
|
||||||
|
|
||||||
Erstellen Sie unterschiedliche statische oder dynamische PDF-Dokumente auf Knopfdruck. Der Dokumentinhalt wird aus Templates (Smarty bzw. Twig) erstellt.
|
Erstellen Sie unterschiedliche statische oder dynamische PDF-Dokumente auf Knopfdruck. Der Dokumentinhalt wird aus Templates (Smarty bzw. Twig) erstellt.
|
||||||
|
|
||||||
An den Bestellungen Ihres OXID-Shops steht Ihnen die Erstellung von Rechnung und Lieferschein zur Verfügung.
|
An den Bestellungen Ihres OXID-Shops steht Ihnen die Erstellung von Rechnung und Lieferschein zur Verfügung.
|
||||||
|
|
||||||
Das Modul kann einfach erweitert werden, um bestehende Dokumente anzupassen oder neue hinzuzufügen. Auch komplett andere Dokumentarten (z.B. Artikeldatenblätter) sind einfach möglich.
|
Das Modul kann einfach erweitert werden, um bestehende Dokumente anzupassen oder neue hinzuzufügen. Auch komplett andere Dokumentarten (z.B. Artikeldatenblätter oder Picklisten) sind einfach möglich.
|
||||||
|
|
||||||
## Systemanforderungen:
|
## Systemanforderungen:
|
||||||
|
|
||||||
@ -25,9 +25,7 @@ Das Modul kann einfach erweitert werden, um bestehende Dokumente anzupassen oder
|
|||||||
|
|
||||||
## Kompatibilität:
|
## Kompatibilität:
|
||||||
|
|
||||||
Das Modul enthält die selbe Funktionalität wie das `OXID Invoice-PDF`-Modul. Grundsätzlich können beide Module parallel im Shop installiert werden, wenn dies erforderlich ist.
|
Das Modul enthält die selbe Funktionalität wie das ehemalige `OXID Invoice-PDF`-Modul.
|
||||||
|
|
||||||
Soll das `OXID Invoice-PDF`-Modul komplett vom `PDF Dokumente` Modul ersetzt werden (weil z.B. dritte Module ebenfalls dessen Funktion verwenden), stellen wir [eine Anpassung](https://packagist.org/packages/d3/pdfdocuments_compat) zur Verfügung, die zusätzlich installiert wird.
|
|
||||||
|
|
||||||
## Installation:
|
## Installation:
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user