Compare commits

...

3 Commits

17 changed files with 142 additions and 77 deletions

View File

@ -10,6 +10,7 @@
namespace D3\PdfDocuments\Application\Model\AbstractClasses;
use Assert\InvalidArgumentException;
use D3\ModCfg\Application\Model\d3filesystem;
use D3\PdfDocuments\Application\Model\Exceptions\pdfGeneratorExceptionAbstract;
use D3\PdfDocuments\Application\Model\Interfaces\pdfdocumentsGenericInterface as genericInterface;
@ -94,6 +95,9 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
} catch (pdfGeneratorExceptionAbstract $e) {
Registry::get(UtilsView::class)->addErrorToDisplay($e);
Registry::getLogger()->error($e);
} catch (InvalidArgumentException $e) {
Registry::get(UtilsView::class)->addErrorToDisplay($e);
Registry::getLogger()->error($e);
}
}
@ -117,6 +121,9 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
} catch (pdfGeneratorExceptionAbstract $e) {
Registry::get(UtilsView::class)->addErrorToDisplay($e);
Registry::getLogger()->error($e);
} catch (InvalidArgumentException $e) {
Registry::get(UtilsView::class)->addErrorToDisplay($e);
Registry::getLogger()->error($e);
}
}
@ -137,6 +144,9 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
} catch (pdfGeneratorExceptionAbstract $e) {
Registry::get(UtilsView::class)->addErrorToDisplay($e);
Registry::getLogger()->error($e);
} catch (InvalidArgumentException $e) {
Registry::get(UtilsView::class)->addErrorToDisplay($e);
Registry::getLogger()->error($e);
}
return null;
@ -159,6 +169,7 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
* @param int $iSelLang
*
* @return mixed
* @throws InvalidArgumentException
*/
public function getHTMLContent($iSelLang = 0)
{
@ -242,7 +253,7 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
{
$extension = $this->filenameExtension;
$extensionLength = (strlen($extension) + 1) * -1;
if ((bool) strlen($extension) && substr($filename, $extensionLength) != '.'.$extension) {
if (strlen($extension) && substr($filename, $extensionLength) != '.'.$extension) {
$filename .= '.'.$extension;
}

View File

@ -10,9 +10,10 @@
namespace D3\PdfDocuments\Application\Model\AbstractClasses;
use D3\PdfDocuments\Application\Model\Exceptions\noBaseObjectSetException;
use Assert\Assert;
use Assert\InvalidArgumentException;
use D3\PdfDocuments\Application\Model\Interfaces\pdfdocumentsOrderInterface as orderInterface;
use \OxidEsales\Eshop\Application\Model\Order;
use OxidEsales\Eshop\Application\Model\Order;
use OxidEsales\Eshop\Application\Model\Payment;
use OxidEsales\Eshop\Application\Model\User;
use OxidEsales\Eshop\Core\Registry;
@ -22,6 +23,14 @@ abstract class pdfdocumentsOrder extends pdfdocumentsGeneric implements orderInt
/** @var Order */
public $oOrder;
/**
* don't use order as constructor argument because of same method interface for all document types
*/
public function __construct()
{
parent::__construct();
}
/**
* @param Order $order
*/
@ -31,15 +40,22 @@ abstract class pdfdocumentsOrder extends pdfdocumentsGeneric implements orderInt
}
/**
* @throws InvalidArgumentException
* @return Order
*/
public function getOrder()
{
Assert::lazy()
->that($this->oOrder)->isInstanceOf(Order::class, 'no order for pdf generator set')
->that($this->oOrder->isLoaded())->true('given order is not loaded')
->verifyNow();
return $this->oOrder;
}
/**
* @param int $iSelLang
* @throws InvalidArgumentException
*/
public function setSmartyVars($iSelLang)
{
@ -58,6 +74,7 @@ abstract class pdfdocumentsOrder extends pdfdocumentsGeneric implements orderInt
/**
* @return string
* @throws InvalidArgumentException
*/
public function getFilename()
{
@ -86,21 +103,6 @@ abstract class pdfdocumentsOrder extends pdfdocumentsGeneric implements orderInt
);
}
/**
* @param $sFilename
* @param int $iSelLang
* @param string $target
* @return mixed|string|null
*/
public function genPdf($sFilename, $iSelLang = 0, $target = 'I')
{
if (false == $this->getOrder()) {
throw oxNew(noBaseObjectSetException::class);
}
return parent::genPdf($sFilename, $iSelLang, $target);
}
/**
* @return int
*/
@ -115,6 +117,7 @@ abstract class pdfdocumentsOrder extends pdfdocumentsGeneric implements orderInt
/**
* @return false|string
* @throws InvalidArgumentException
*/
public function getPayableUntilDate()
{

View File

@ -10,10 +10,9 @@
namespace D3\PdfDocuments\Application\Model\Documents;
use Assert\InvalidArgumentException;
use D3\PdfDocuments\Application\Model\AbstractClasses\pdfdocumentsOrder;
use D3\PdfDocuments\Application\Model\Exceptions\noBaseObjectSetException;
use D3\PdfDocuments\Application\Model\Interfaces\pdfdocumentsOrderinvoiceInterface;
use Spipu\Html2Pdf\Exception\Html2PdfException;
class invoicePdf extends pdfdocumentsOrder implements pdfdocumentsOrderinvoiceInterface
{
@ -43,6 +42,10 @@ class invoicePdf extends pdfdocumentsOrder implements pdfdocumentsOrderinvoiceIn
return 'invoice';
}
/**
* @return void
* @throws InvalidArgumentException
*/
public function runPreAction()
{
parent::runPreAction();
@ -52,6 +55,10 @@ class invoicePdf extends pdfdocumentsOrder implements pdfdocumentsOrderinvoiceIn
$this->saveOrderOnChanges();
}
/**
* @return void
* @throws InvalidArgumentException
*/
public function setInvoiceNumber()
{
if (!$this->getOrder()->getFieldData('oxbillnr')) {
@ -61,6 +68,10 @@ class invoicePdf extends pdfdocumentsOrder implements pdfdocumentsOrderinvoiceIn
}
}
/**
* @return void
* @throws InvalidArgumentException
*/
public function setInvoiceDate()
{
if ($this->getOrder()->getFieldData('oxbilldate') == '0000-00-00') {
@ -72,6 +83,10 @@ class invoicePdf extends pdfdocumentsOrder implements pdfdocumentsOrderinvoiceIn
}
}
/**
* @return void
* @throws InvalidArgumentException
*/
public function saveOrderOnChanges()
{
if ($this->blIsNewOrder) {
@ -85,6 +100,7 @@ class invoicePdf extends pdfdocumentsOrder implements pdfdocumentsOrderinvoiceIn
/**
* @return string
* @throws InvalidArgumentException
*/
public function getFilename()
{

View File

@ -1,21 +0,0 @@
<?php
/**
* See LICENSE file for license details.
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link http://www.oxidmodule.com
*/
namespace D3\PdfDocuments\Application\Model\Exceptions;
use Exception;
class noBaseObjectSetException extends pdfGeneratorExceptionAbstract
{
public function __construct( $sMessage = "no base object (e.g. order) for pdf generator set", $iCode = 0, Exception $previous = null )
{
parent::__construct( $sMessage, $iCode, $previous );
}
}

View File

@ -10,8 +10,6 @@
namespace D3\PdfDocuments\Application\Model\Interfaces;
use D3\PdfDocuments\Application\Model\Exceptions\noBaseObjectSetException;
interface pdfdocumentsGenericInterface
{
/**
@ -58,7 +56,6 @@ interface pdfdocumentsGenericInterface
* @param string $target
*
* @return mixed
* @throws noBaseObjectSetException
*/
public function genPdf($sFilename, $iSelLang = 0, $target = 'I');

View File

@ -10,6 +10,7 @@
namespace D3\PdfDocuments\Application\Model\Interfaces;
use Assert\InvalidArgumentException;
use OxidEsales\Eshop\Application\Model\Order;
interface pdfdocumentsOrderInterface extends pdfdocumentsGenericInterface
@ -20,6 +21,7 @@ interface pdfdocumentsOrderInterface extends pdfdocumentsGenericInterface
public function setOrder(Order $order);
/**
* @throws InvalidArgumentException
* @return Order
*/
public function getOrder();

View File

@ -1,7 +1,7 @@
[{assign var="defaultPagePadding" value=","|explode:"45,15,25,25"}] [{* top, right, bottom, left *}]
[{assign var="pagePadding" value=$pagePadding|default:$defaultPagePadding}]
<style type="text/css">
<style>
.marks {
position: absolute;
left: [{math equation="left - padding" left=5 padding=$pagePadding.3}]mm ;

View File

@ -4,7 +4,7 @@
[{* rulers *}]
[{* include file="d3pdfrulers.tpl" pagePadding=$pagePadding *}]
<style type="text/css">
<style>
.rulerItemHorizontal {
position: absolute;
top: -[{$pagePadding.0}]mm;

View File

@ -4,7 +4,7 @@
[{assign var="defaultPagePadding" value=","|explode:"45,15,25,25"}] [{* top, right, bottom, left *}]
[{assign var="pagePadding" value=$pagePadding|default:$defaultPagePadding}]
<style type="text/css">
<style>
[{foreach from=$pdfBlock_style item="_block"}]
[{$_block}]
[{/foreach}]

View File

@ -11,11 +11,9 @@
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\Controller\Admin\OrderOverview;
use OxidEsales\Eshop\Application\Model\Order;
use OxidEsales\Eshop\Core\DatabaseProvider;
@ -45,12 +43,11 @@ class d3_overview_controller_pdfdocuments extends d3_overview_controller_pdfdocu
$viewNameGenerator = Registry::get(TableViewNameGenerator::class);
$sTable = $viewNameGenerator->getViewName("oxorderarticles");
$sQ = "select count(oxid) from {$sTable} where oxorderid = " . $masterDb->quote($sOrderId) . " and oxstorno = 0";
$sQ = "select count(oxid) from $sTable where oxorderid = " . $masterDb->quote($sOrderId) . " and oxstorno = 0";
return (bool) $masterDb->getOne($sQ);
}
/**
* @throws noBaseObjectSetException
* @throws noPdfHandlerFoundException
* @throws pdfGeneratorExceptionAbstract
*/
@ -58,7 +55,7 @@ class d3_overview_controller_pdfdocuments extends d3_overview_controller_pdfdocu
{
$soxId = $this->getEditObjectId();
if ($soxId != "-1" && isset($soxId)) {
/** @var d3_Order_PdfDocuments $oOrder */
/** @var Order $oOrder */
$oOrder = oxNew(Order::class);
if ($oOrder->load($soxId)) {
$generator = oxNew( orderOverviewPdfGenerator::class );

View File

@ -4,7 +4,7 @@
PDF-Dokumentgenerator fĂĽr OXID eShop
Erstellen Sie unterschiedlichste statische oder dynamische PDF-Dokument auf Kopfdruck. Der Dokumentinhalt wird aus Smartytemplates erstellt.
Erstellen Sie unterschiedliche statische oder dynamische PDF-Dokumente auf Kopfdruck. Der Dokumentinhalt wird aus Smartytemplates erstellt.
An den Bestellungen Ihres OXID-Shops steht Ihnen die Erstellung von Rechnung und Lieferschein zur VerfĂĽgung.

View File

@ -34,7 +34,8 @@
"php": "^7.0 || ^8.0",
"oxid-esales/oxideshop-ce": "6.3 - 6.14",
"spipu/html2pdf": "^5.2",
"d3/modcfg": "^5.3.6.000 || ^6"
"d3/modcfg": "^5.3.6.000 || ^6",
"beberlei/assert": "^3.3.2"
},
"autoload": {
"psr-4": {

View File

@ -2,22 +2,30 @@
title: Changelog
---
## 1.0.3.1 - (2023-05-09)
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased](https://git.d3data.de/D3Public/pdfdokumente/compare/1.0.4.0...rel_1.x)
## [1.0.4.0](https://git.d3data.de/D3Public/pdfdokumente/compare/1.0.3.1...1.0.4.0) - 2023-12-22
### Added
- installierbar in OXID 6.5.2 + 6.5.3 (CE 6.14)
- Modullogo
### Changed
- behandelt fehlende Bestellung bei auf Bestellungen basierenden Dokumenten
## [1.0.3.1](https://git.d3data.de/D3Public/pdfdokumente/compare/1.0.3.0...1.0.3.1) - 2023-05-09
### Fixed
- fix multiple documents at once
---
## 1.0.3.0 - (2023-01-04)
- kann mehrere Dokumente auf einmal generieren
## [1.0.3.0](https://git.d3data.de/D3Public/pdfdokumente/compare/1.0.2.0...1.0.3.0) - 2023-01-04
### Added
- installierbar in OXID 6.4 und 6.5
---
## 1.0.2.0 - (2021-04-30)
## [1.0.2.0](https://git.d3data.de/D3Public/pdfdokumente/compare/1.0.1.0...1.0.2.0) - 2021-04-30
### Added
- installierbar in OXID 6.2.4 und 6.3.0
- Dateinamen werden auf GĂĽltigkeit hin korrigiert
@ -25,17 +33,11 @@ title: Changelog
### Fixed
- Setzen der Rechnungsnummer setzt den "neue Bestellung"-Status nicht zurĂĽck
---
## 1.0.1.0 - (2020-08-20)
## [1.0.1.0](https://git.d3data.de/D3Public/pdfdokumente/compare/1.0.0.0...1.0.1.0) - 2020-08-20
### Changed
- Dokumentid fĂĽr "Rechnung ohne Logo" angepasst
---
## 1.0.0.0 - (2020-08-13)
## [1.0.1.0](https://git.d3data.de/D3Public/pdfdokumente/tag/1.0.0.0) - 2020-08-13
#### Added
- Framework zur Erstellung unterschiedlichster PDF Dokumente
- ermöglicht Generierung von Rechnungen und Lieferscheinen für Bestellungen aus dem Adminbereich

View File

@ -1,9 +1,9 @@
{
"title": "<i class='fab fa-d3 d3fa-color-blue'></i> PDF Dokumente",
"moduleversion": "1.0.3.1",
"moduleversion": "1.0.4.0",
"titledesc": "fĂĽr den Oxid eShop",
"author": "DÂł Data Development",
"moduledate": "09.05.2023",
"moduledate": "22.12.2023",
"editors": "",
"tagline": "",
"image": "",

BIN
logo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -28,15 +28,15 @@ $aModule = [
'de' => $logo.' PDF-Dokumente',
'en' => $logo.' PDF documents',
],
'version' => '1.0.3.1',
'version' => '1.0.4.0',
'author' => 'D&sup3; Data Development (Inh.: Thomas Dartsch)',
'email' => 'support@shopmodule.com',
'url' => 'http://www.oxidmodule.com/',
'url' => 'https://www.oxidmodule.com/',
'extend' => [
OrderOverview::class => d3_overview_controller_pdfdocuments::class
],
'controllers' => [],
'thumbnail' => 'logo.png',
'thumbnail' => 'picture.svg',
'templates' => [
'd3orderoverview_pdfform.tpl' => 'd3/pdfdocuments/Application/views/tpl/admin/orderoverview_pdfform.tpl',

57
picture.svg Normal file
View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="201px" height="124px" viewBox="0 0 201 124" enable-background="new 0 0 201 124" xml:space="preserve">
<g>
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="47.0591" y1="67.5117" x2="47.0591" y2="54.6143">
<stop offset="0.0056" style="stop-color:#3266A9"/>
<stop offset="1" style="stop-color:#0099FF"/>
</linearGradient>
<path fill="url(#SVGID_1_)" d="M50.282,55.502c-0.784-0.592-2.104-0.888-3.961-0.888h-1.376l-2.283,12.898h1.779
c3.76,0,6.032-2.245,6.815-6.733c0.134-0.871,0.202-1.642,0.202-2.313C51.457,57.081,51.064,56.093,50.282,55.502z"/>
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="65.9609" y1="49.104" x2="65.9609" y2="36.9434">
<stop offset="0.0056" style="stop-color:#3266A9"/>
<stop offset="1" style="stop-color:#0099FF"/>
</linearGradient>
<path fill="url(#SVGID_2_)" d="M65.72,40.482c1.074,0,1.611,0.381,1.611,1.143c0,0.701-0.321,1.201-0.962,1.5
c-0.209,0.119-0.366,0.194-0.471,0.224c-0.065,0.019-0.158,0.037-0.271,0.056c1.98,1.621,3.702,3.544,5.097,5.699
c0.117-0.321,0.21-0.658,0.277-1.013l0.09-1.008c0-1.223-0.568-2.081-1.701-2.574c0.776-0.402,1.376-0.94,1.801-1.611
c0.425-0.672,0.638-1.418,0.638-2.239c0-0.642-0.198-1.265-0.593-1.868c-0.396-0.605-0.98-1.049-1.757-1.333
c-0.433-0.193-0.876-0.328-1.332-0.402c-0.456-0.075-1.003-0.113-1.645-0.113c-0.82,0-1.663,0.124-2.529,0.37
c-0.865,0.246-1.6,0.563-2.204,0.952s-1.13,0.907-1.578,1.557c-0.036,0.052-0.066,0.109-0.101,0.163
c1.196,0.534,2.341,1.163,3.426,1.874C63.947,40.943,64.68,40.482,65.72,40.482z"/>
<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="50.0576" y1="87.0566" x2="50.0576" y2="37.8525">
<stop offset="0.0056" style="stop-color:#3266A9"/>
<stop offset="1" style="stop-color:#0099FF"/>
</linearGradient>
<path fill="url(#SVGID_3_)" d="M70.725,49.104c-0.433,1.189-1.208,2.147-2.331,2.871c-1.425,0.918-3.182,1.377-5.271,1.377
c-1.179,0-2.175-0.176-2.988-0.525c-0.813-0.35-1.444-0.864-1.891-1.543c-0.448-0.678-0.671-1.481-0.671-2.405l0.022-0.694
l0.156-0.693h4.367l-0.028,0.179v0.179v0.246c0,1.164,0.628,1.746,1.884,1.746c0.635,0,1.201-0.217,1.696-0.649
c0.495-0.434,0.742-0.94,0.742-1.522c0-0.522-0.194-0.887-0.582-1.097c-0.329-0.208-1.007-0.313-2.036-0.313l0.47-2.754
l1.141-0.067c0.083-0.011,0.154-0.022,0.221-0.033c-0.674-0.551-1.378-1.067-2.11-1.546c-0.044,0.096-0.087,0.195-0.125,0.302
h-4.185c0.192-0.837,0.49-1.56,0.884-2.175c-3.064-1.372-6.46-2.133-10.034-2.133c-13.588,0-24.603,11.014-24.603,24.601
c0,13.59,11.015,24.604,24.603,24.604S74.66,76.043,74.66,62.453C74.66,57.532,73.214,52.949,70.725,49.104z M59.413,59.233
l-0.168,1.275c-0.538,2.953-1.511,5.404-2.921,7.35c-1.298,1.835-3.016,3.179-5.153,4.028c-2.138,0.851-4.494,1.274-7.067,1.274
H33.731l4.264-24.198h10.441c1.141,0,2.204,0.073,3.189,0.218c0.984,0.146,1.868,0.364,2.651,0.655
c1.611,0.537,2.887,1.471,3.827,2.802c0.94,1.332,1.41,2.992,1.41,4.984L59.413,59.233z"/>
</g>
<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="107.3027" y1="105.8555" x2="93.0727" y2="16.0106">
<stop offset="0" style="stop-color:#B2B2B2;stop-opacity:0"/>
<stop offset="0.2" style="stop-color:#B2B2B2"/>
<stop offset="0.8" style="stop-color:#B2B2B2"/>
<stop offset="1" style="stop-color:#B2B2B2;stop-opacity:0"/>
</linearGradient>
<rect x="99.875" y="14.933" fill="url(#SVGID_4_)" width="0.625" height="92"/>
<script xmlns=""></script>
<path d="M126.531,43.25c0-3.446,2.801-6.25,6.25-6.25h15.624v12.5c0,1.729,1.398,3.125,3.126,3.125h12.5v14.063h-20.313
c-3.448,0-6.25,2.801-6.25,6.25V87h-4.688c-3.449,0-6.25-2.801-6.25-6.248V43.25z M164.031,49.5h-12.5V37L164.031,49.5z
M143.719,71.375h3.125c3.018,0,5.469,2.451,5.469,5.469s-2.451,5.471-5.469,5.471h-1.563v3.123c0,0.861-0.702,1.563-1.563,1.563
c-0.861,0-1.563-0.701-1.563-1.563v-4.686v-7.814C142.156,72.076,142.857,71.375,143.719,71.375z M146.844,79.188
c1.3,0,2.343-1.043,2.343-2.344c0-1.299-1.043-2.344-2.343-2.344h-1.563v4.688H146.844z M156.218,71.375h3.125
c2.589,0,4.688,2.102,4.688,4.688v6.252c0,2.586-2.1,4.686-4.688,4.686h-3.125c-0.86,0-1.562-0.701-1.562-1.563v-12.5
C154.656,72.076,155.357,71.375,156.218,71.375z M159.343,83.875c0.861,0,1.563-0.703,1.563-1.561v-6.252
c0-0.861-0.702-1.563-1.563-1.563h-1.563v9.375H159.343z M167.155,72.938c0-0.861,0.703-1.563,1.563-1.563h4.688
c0.861,0,1.563,0.701,1.563,1.563s-0.701,1.563-1.563,1.563h-3.124v3.125h3.124c0.861,0,1.563,0.703,1.563,1.563
s-0.701,1.564-1.563,1.564h-3.124v4.686c0,0.861-0.703,1.563-1.563,1.563c-0.859,0-1.563-0.701-1.563-1.563v-6.25V72.938z"/>
</svg>

After

Width:  |  Height:  |  Size: 4.8 KiB