From 5465a7eebd89103019d5f737f24ff8db3332509b Mon Sep 17 00:00:00 2001 From: Daniel Seifert Date: Tue, 26 May 2020 16:12:17 +0200 Subject: [PATCH] refactor class structure --- .../Model/Documents}/deliverynotePdf.php | 0 Application/Model/Documents/invoicePdf.php | 28 ++++++++++++++++++ .../Model/Interfaces/pdfdocuments_generic.php | 29 +++++++++++++++++++ .../Model/Interfaces/pdfdocuments_order.php | 25 ++++++++++++++++ .../pdfdocuments_orderinvoice.php} | 8 +---- .../Model/pdfDocuments_abstract.php | 21 ++++++++++++-- Modules/Application/Model/invoicePdf.php | 9 ------ 7 files changed, 102 insertions(+), 18 deletions(-) rename {Modules/Application/Model => Application/Model/Documents}/deliverynotePdf.php (100%) create mode 100644 Application/Model/Documents/invoicePdf.php create mode 100644 Application/Model/Interfaces/pdfdocuments_generic.php create mode 100644 Application/Model/Interfaces/pdfdocuments_order.php rename Application/Model/{pdfdocuments_generic.php => Interfaces/pdfdocuments_orderinvoice.php} (78%) rename Modules/Application/Model/pdfDocuments.php => Application/Model/pdfDocuments_abstract.php (78%) delete mode 100644 Modules/Application/Model/invoicePdf.php diff --git a/Modules/Application/Model/deliverynotePdf.php b/Application/Model/Documents/deliverynotePdf.php similarity index 100% rename from Modules/Application/Model/deliverynotePdf.php rename to Application/Model/Documents/deliverynotePdf.php diff --git a/Application/Model/Documents/invoicePdf.php b/Application/Model/Documents/invoicePdf.php new file mode 100644 index 0000000..1befb18 --- /dev/null +++ b/Application/Model/Documents/invoicePdf.php @@ -0,0 +1,28 @@ + + * @link http://www.oxidmodule.com + */ + +namespace D3\PdfDocuments\Modules\Application\Model; + +use D3\PdfDocuments\Application\Model\Interfaces\pdfdocuments_orderinvoice; +use D3\PdfDocuments\Application\Model\pdfDocuments_abstract; + +class invoicePdf extends pdfDocuments_abstract implements pdfdocuments_orderinvoice +{ + public function getTemplate(){ + return 'invoice.tpl'; + } +} \ No newline at end of file diff --git a/Application/Model/Interfaces/pdfdocuments_generic.php b/Application/Model/Interfaces/pdfdocuments_generic.php new file mode 100644 index 0000000..d636533 --- /dev/null +++ b/Application/Model/Interfaces/pdfdocuments_generic.php @@ -0,0 +1,29 @@ + + * @link http://www.oxidmodule.com + */ + +namespace D3\PdfDocuments\Application\Model\Interfaces; + +interface pdfdocuments_generic +{ + public function setFilename($sContent, $target, $sFilename); + + public function saveOrderOnChanges(); + + public function getTemplate(); + + public function genPdf($sFilename, $iSelLang = 0, $target = 'I'); +} \ No newline at end of file diff --git a/Application/Model/Interfaces/pdfdocuments_order.php b/Application/Model/Interfaces/pdfdocuments_order.php new file mode 100644 index 0000000..d5f3b72 --- /dev/null +++ b/Application/Model/Interfaces/pdfdocuments_order.php @@ -0,0 +1,25 @@ + + * @link http://www.oxidmodule.com + */ + +namespace D3\PdfDocuments\Application\Model\Interfaces; + +interface pdfdocuments_order extends pdfdocuments_generic +{ + public function setOrder(Order $order); + + public function getOrder(); +} \ No newline at end of file diff --git a/Application/Model/pdfdocuments_generic.php b/Application/Model/Interfaces/pdfdocuments_orderinvoice.php similarity index 78% rename from Application/Model/pdfdocuments_generic.php rename to Application/Model/Interfaces/pdfdocuments_orderinvoice.php index 37d2763..11564d4 100644 --- a/Application/Model/pdfdocuments_generic.php +++ b/Application/Model/Interfaces/pdfdocuments_orderinvoice.php @@ -17,15 +17,9 @@ namespace D3\PdfDocuments\Application\Model\Interfaces; -interface pdfdocuments_generic +interface pdfdocuments_orderinvoice extends pdfdocuments_order { - public function setFilename($sContent, $target, $sFilename); - public function setInvoiceNumber(); public function setInvoiceDate(); - - public function saveOrderOnChanges(); - - public function getTemplate(); } \ No newline at end of file diff --git a/Modules/Application/Model/pdfDocuments.php b/Application/Model/pdfDocuments_abstract.php similarity index 78% rename from Modules/Application/Model/pdfDocuments.php rename to Application/Model/pdfDocuments_abstract.php index 091d33e..ac68c49 100644 --- a/Modules/Application/Model/pdfDocuments.php +++ b/Application/Model/pdfDocuments_abstract.php @@ -1,6 +1,23 @@ + * @link http://www.oxidmodule.com + */ + +namespace D3\PdfDocuments\Application\Model; + +use D3\PdfDocuments\Application\Model\Interfaces\pdfdocuments_generic; use \OxidEsales\Eshop\Application\Model\Order; use OxidEsales\Eshop\Application\Model\Payment; use OxidEsales\Eshop\Application\Model\User; @@ -8,7 +25,7 @@ use OxidEsales\Eshop\Core\Base; use OxidEsales\Eshop\Core\Registry; use Spipu\Html2Pdf\Html2Pdf; -abstract class pdfDocuments implements albatros +abstract class pdfDocuments_abstract implements pdfdocuments_generic { public $oOrder; protected $blIsNewOrder; diff --git a/Modules/Application/Model/invoicePdf.php b/Modules/Application/Model/invoicePdf.php deleted file mode 100644 index 546d8c8..0000000 --- a/Modules/Application/Model/invoicePdf.php +++ /dev/null @@ -1,9 +0,0 @@ -