Merge remote-tracking branch 'remotes/origin/modules/dev_mod_pdfDocumentsFull_ordermanager' into modules/rel_mod_pdfDocumentsFull
This commit is contained in:
commit
3d0128ed0e
@ -28,10 +28,12 @@ use Spipu\Html2Pdf\Html2Pdf;
|
||||
|
||||
abstract class pdfdocumentsGeneric extends Base implements genericInterface
|
||||
{
|
||||
const PDF_DESTINATION_DOWNLOAD = 'D'; // force download in browser
|
||||
const PDF_DESTINATION_STDOUT = 'I'; // show in browser plugin if available, otherwise download
|
||||
const PDF_DESTINATION_FILE = 'F'; // save as local file
|
||||
const PDF_DESTINATION_STRING = 'S'; // output as string
|
||||
const PDF_DESTINATION_DOWNLOAD = 'D'; // force download in browser
|
||||
const PDF_DESTINATION_STDOUT = 'I'; // show in browser plugin if available, otherwise download
|
||||
const PDF_DESTINATION_FILE = 'F'; // save as local file
|
||||
const PDF_DESTINATION_FILEANDSTDOUT = 'FI'; // output as local file and show in browser plugin
|
||||
const PDF_DESTINATION_FILEANDDOWNLOAD = 'FD'; // output as local file and force download in browser
|
||||
const PDF_DESTINATION_STRING = 'S'; // output as string
|
||||
|
||||
const PDF_ORIENTATION_PORTRAIT = 'P';
|
||||
const PDF_ORIENTATION_LANDSCAPE = 'L';
|
||||
@ -59,14 +61,20 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
|
||||
* @param $sFilename
|
||||
* @param int $iSelLang
|
||||
* @param string $target
|
||||
*
|
||||
* @return mixed|string
|
||||
* @throws Html2PdfException
|
||||
*/
|
||||
public function genPdf($sFilename, $iSelLang = 0, $target = self::PDF_DESTINATION_STDOUT)
|
||||
{
|
||||
$sFilename = $this->getFilename();
|
||||
$oPdf = oxNew(Html2Pdf::class, ...$this->getPdfProperties());
|
||||
$oPdf->setTestIsImage(false);
|
||||
$oPdf->writeHTML($this->getHTMLContent($iSelLang));
|
||||
$oPdf->output($sFilename, $target);
|
||||
$oPdf->pdf->SetAuthor(Registry::getConfig()->getActiveShop()->getFieldData('oxname'));
|
||||
$oPdf->pdf->SetTitle(Registry::getLang()->translateString($this->getTitleIdent()));
|
||||
$oPdf->pdf->SetCreator('D³ PDF Documents for OXID eShop');
|
||||
$oPdf->pdf->SetSubject(NULL);
|
||||
return $oPdf->output($sFilename, $target);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -84,6 +92,46 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
* @param int $iLanguage
|
||||
*
|
||||
* @throws Html2PdfException
|
||||
*/
|
||||
public function savePdfFile($path, $iLanguage = 0)
|
||||
{
|
||||
try {
|
||||
$sFilename = $this->getFilename();
|
||||
$this->genPdf(
|
||||
rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$sFilename,
|
||||
$iLanguage,
|
||||
self::PDF_DESTINATION_FILE
|
||||
);
|
||||
} catch (pdfGeneratorExceptionAbstract $e) {
|
||||
Registry::get(UtilsView::class)->addErrorToDisplay($e);
|
||||
Registry::getLogger()->error($e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iLanguage
|
||||
*
|
||||
* @return null|string
|
||||
* @throws Html2PdfException
|
||||
*/
|
||||
public function getPdfContent($iLanguage = 0)
|
||||
{
|
||||
try {
|
||||
$sFilename = $this->getFilename();
|
||||
return $this->genPdf( $sFilename, $iLanguage, self::PDF_DESTINATION_STRING );
|
||||
} catch (pdfGeneratorExceptionAbstract $e) {
|
||||
Registry::get(UtilsView::class)->addErrorToDisplay($e);
|
||||
Registry::getLogger()->error($e);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function setSmartyVars()
|
||||
{
|
||||
$this->oSmarty->assign('oConfig', Registry::getSession()->getConfig());
|
||||
@ -99,6 +147,7 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
|
||||
*/
|
||||
public function getHTMLContent($iSelLang = 0)
|
||||
{
|
||||
$blCurrentRenderFromAdmin = self::$_blIsAdmin;
|
||||
self::$_blIsAdmin = $this->renderTemplateFromAdmin();
|
||||
|
||||
$lang = Registry::getLang();
|
||||
@ -112,6 +161,8 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
|
||||
|
||||
$lang->setTplLanguage($currTplLang);
|
||||
|
||||
self::$_blIsAdmin = $blCurrentRenderFromAdmin;
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@ use D3\PdfDocuments\Application\Model\Interfaces\pdfdocumentsOrderInterface as o
|
||||
use \OxidEsales\Eshop\Application\Model\Order;
|
||||
use OxidEsales\Eshop\Application\Model\Payment;
|
||||
use OxidEsales\Eshop\Application\Model\User;
|
||||
use Spipu\Html2Pdf\Exception\Html2PdfException;
|
||||
|
||||
abstract class pdfdocumentsOrder extends pdfdocumentsGeneric implements orderInterface
|
||||
{
|
||||
@ -86,9 +87,12 @@ 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
|
||||
*/
|
||||
public function genPdf($sFilename, $iSelLang = 0, $target = 'I')
|
||||
@ -98,6 +102,6 @@ abstract class pdfdocumentsOrder extends pdfdocumentsGeneric implements orderInt
|
||||
throw $e;
|
||||
}
|
||||
|
||||
parent::genPdf($sFilename, $iSelLang, $target);
|
||||
return parent::genPdf($sFilename, $iSelLang, $target);
|
||||
}
|
||||
}
|
@ -35,6 +35,14 @@ class deliverynotewithoutlogoPdf extends deliverynotePdf
|
||||
return "ORDER_OVERVIEW_PDF_DNOTE_WITHOUT_LOGO";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTypeForFilename()
|
||||
{
|
||||
return 'delnote-nl';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
@ -20,6 +20,7 @@ namespace D3\PdfDocuments\Application\Model\Documents;
|
||||
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
|
||||
{
|
||||
@ -51,10 +52,12 @@ class invoicePdf extends pdfdocumentsOrder implements pdfdocumentsOrderinvoiceIn
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sFilename
|
||||
* @param int $iSelLang
|
||||
* @param $sFilename
|
||||
* @param int $iSelLang
|
||||
* @param string $target
|
||||
* @return void
|
||||
*
|
||||
* @return mixed|string|void
|
||||
* @throws Html2PdfException
|
||||
* @throws noBaseObjectSetException
|
||||
*/
|
||||
public function genPdf( $sFilename, $iSelLang = 0, $target = 'I' )
|
||||
@ -63,7 +66,7 @@ class invoicePdf extends pdfdocumentsOrder implements pdfdocumentsOrderinvoiceIn
|
||||
$this->setInvoiceDate();
|
||||
$this->saveOrderOnChanges();
|
||||
|
||||
parent::genPdf( $sFilename, $iSelLang, $target );
|
||||
return parent::genPdf( $sFilename, $iSelLang, $target );
|
||||
}
|
||||
|
||||
public function setInvoiceNumber()
|
||||
|
@ -36,6 +36,14 @@ class invoicewithoutlogoPdf extends invoicePdf
|
||||
return "ORDER_OVERVIEW_PDF_STANDART_WITHOUT_LOGO";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTypeForFilename()
|
||||
{
|
||||
return 'invoice-nl';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
@ -46,6 +46,19 @@ interface pdfdocumentsGenericInterface
|
||||
*/
|
||||
public function downloadPdf($iLanguage = 0);
|
||||
|
||||
/**
|
||||
* @param int $iLanguage
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPdfContent($iLanguage = 0);
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
* @param int $iLanguage
|
||||
*/
|
||||
public function savePdfFile($path, $iLanguage = 0);
|
||||
|
||||
/**
|
||||
* @param $sFilename
|
||||
* @param int $iSelLang
|
||||
|
50
Application/Model/Registries/registryOrdermanagerActions.php
Normal file
50
Application/Model/Registries/registryOrdermanagerActions.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This Software is the property of Data Development and is protected
|
||||
* by copyright law - it is NOT Freeware.
|
||||
* Any unauthorized use of this software without a valid license
|
||||
* is a violation of the license agreement and will be prosecuted by
|
||||
* civil and criminal law.
|
||||
* http://www.shopmodule.com
|
||||
*
|
||||
* @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\Registries;
|
||||
|
||||
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\Interfaces\pdfdocumentsOrderInterface;
|
||||
|
||||
class registryOrdermanagerActions extends registryAbstract implements registryOrdermanagerActionsInterface
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->addGenerator(invoicePdf::class);
|
||||
$this->addGenerator(deliverynotePdf::class);
|
||||
$this->addGenerator(invoicewithoutlogoPdf::class);
|
||||
$this->addGenerator(deliverynotewithoutlogoPdf::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getRequiredGeneratorInterfaceClassName()
|
||||
{
|
||||
return pdfdocumentsOrderInterface::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $className * generator fully qualified class name
|
||||
* @return pdfdocumentsOrderInterface
|
||||
*/
|
||||
public function getGenerator($className)
|
||||
{
|
||||
return $this->_aRegistry[$className];
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This Software is the property of Data Development and is protected
|
||||
* by copyright law - it is NOT Freeware.
|
||||
*
|
||||
* Any unauthorized use of this software without a valid license
|
||||
* is a violation of the license agreement and will be prosecuted by
|
||||
* civil and criminal law.
|
||||
*
|
||||
* http://www.shopmodule.com
|
||||
*
|
||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||
* @author D3 Data Development - Max Buhe <support@shopmodule.com>
|
||||
* @link http://www.oxidmodule.com
|
||||
*/
|
||||
|
||||
namespace D3\PdfDocuments\Application\Model\Registries;
|
||||
|
||||
interface registryOrdermanagerActionsInterface extends registryGenericInterface
|
||||
{
|
||||
/**
|
||||
* @param $className * generator fully qualified class name
|
||||
*/
|
||||
public function addGenerator($className);
|
||||
}
|
6
Application/views/tpl/documents/inc/din5008.tpl
Normal file
6
Application/views/tpl/documents/inc/din5008.tpl
Normal file
@ -0,0 +1,6 @@
|
||||
[{* fold marks *}]
|
||||
<div style="position: absolute; top: [{math equation="tpos - tpad" tpos=87 tpad=35}]mm; left: [{math equation="lpos - lpad" tpos=5 tpad=10}]mm; margin-left: -10mm; width: 7px; height: 0; border-top: 1px solid silver"></div>
|
||||
<div style="position: absolute; top: [{math equation="tpos - tpad" tpos=192 tpad=35}]mm; left: [{math equation="lpos - lpad" tpos=5 tpad=10}]mm; margin-left: -10mm; width: 7px; height: 0; border-top: 1px solid silver"></div>
|
||||
|
||||
[{* punch mark *}]
|
||||
<div style="position: absolute; top: [{math equation="tpos - tpad" tpos=148.5 tpad=35}]mm; left: [{math equation="lpos - lpad" tpos=5 tpad=10}]mm; margin-left: -10mm; width: 7px; height: 0; border-top: 1px solid silver"></div>
|
@ -6,7 +6,7 @@
|
||||
[{include file="d3pdfstyle.css"}]
|
||||
</style>
|
||||
|
||||
<page backtop="30mm" backbottom="30mm" backleft="10mm" backright="10mm" pageset="new">
|
||||
<page backtop="30mm" backbottom="30mm" backleft="10mm" backright="10mm" pageset="new" orientation="P" format="A4">
|
||||
<page_header>
|
||||
[{block name="pdfTopingFile"}]
|
||||
[{include file="d3pdfheader.tpl" showLogo=true}]
|
||||
@ -18,6 +18,11 @@
|
||||
[{/block}]
|
||||
</page_footer>
|
||||
|
||||
[{* +++++ fold and punch marks +++++ *}]
|
||||
[{block name="pdfDIN5008Markings"}]
|
||||
[{include file="d3din5008.tpl"}]
|
||||
[{/block}]
|
||||
|
||||
[{* +++++ main page part +++++ *}]
|
||||
[{block name="pdfHeadingFile"}]
|
||||
[{block name="pdfHeaderFile"}]
|
||||
|
@ -28,7 +28,7 @@ $sMetadataVersion = '2.0';
|
||||
|
||||
$logo = (class_exists(d3utils::class) ? d3utils::getInstance()->getD3Logo() : 'D³');
|
||||
|
||||
$sModuleId = 'pdfDocuments';
|
||||
$sModuleId = 'd3PdfDocuments';
|
||||
/**
|
||||
* Module information
|
||||
*/
|
||||
@ -38,7 +38,6 @@ $aModule = [
|
||||
'de' => $logo.' PDF-Dokumente aus HTML-Templates',
|
||||
'en' => $logo.' PDF documents from HTML templates',
|
||||
],
|
||||
'thumbnail' => 'picture.png',
|
||||
'version' => '1.0',
|
||||
'author' => 'D³ Data Development (Inh.: Thomas Dartsch)',
|
||||
'email' => 'support@shopmodule.com',
|
||||
@ -64,6 +63,7 @@ $aModule = [
|
||||
|
||||
'd3pdfheader.tpl' => 'd3/pdfdocuments/Application/views/tpl/documents/inc/header.tpl',
|
||||
'd3pdffooter.tpl' => 'd3/pdfdocuments/Application/views/tpl/documents/inc/footer.tpl',
|
||||
'd3din5008.tpl' => 'd3/pdfdocuments/Application/views/tpl/documents/inc/din5008.tpl',
|
||||
'd3pdfstyle.css' => 'd3/pdfdocuments/out/src/css/pdfStyling.css'
|
||||
],
|
||||
'events' => [],
|
||||
|
Loading…
Reference in New Issue
Block a user