add ordermanager combination

This commit is contained in:
Daniel Seifert 2020-06-08 16:39:33 +02:00
parent 5232b1e5a5
commit 7eb770440d
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
5 changed files with 109 additions and 3 deletions

View File

@ -66,7 +66,7 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
$sFilename = $this->getFilename();
$oPdf = oxNew(Html2Pdf::class, ...$this->getPdfProperties());
$oPdf->writeHTML($this->getHTMLContent($iSelLang));
$oPdf->output($sFilename, $target);
return $oPdf->output($sFilename, $target);
}
/**
@ -84,6 +84,30 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
}
}
/**
* @param int $iLanguage
*
* @return null|string
* @throws Html2PdfException
*/
public function getPdfContent($iLanguage = 0)
{
try {
$sFilename = $this->getFilename();
ob_start();
//$this->genPdf( $sFilename, $iLanguage, self::PDF_DESTINATION_STDOUT );
$this->genPdf( $sFilename, $iLanguage, self::PDF_DESTINATION_STRING );
return ob_get_contents();
} catch (pdfGeneratorExceptionAbstract $e) {
Registry::get(UtilsView::class)->addErrorToDisplay($e);
Registry::getLogger()->error($e);
} catch (\Exception $e) {
dumpvar($e->getMessage());
}
return null;
}
public function setSmartyVars()
{
$this->oSmarty->assign('oConfig', Registry::getSession()->getConfig());

View File

@ -46,6 +46,13 @@ interface pdfdocumentsGenericInterface
*/
public function downloadPdf($iLanguage = 0);
/**
* @param int $iLanguage
*
* @return string|null
*/
public function getPdfContent($iLanguage = 0);
/**
* @param $sFilename
* @param int $iSelLang

View 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];
}
}

View File

@ -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);
}

View File

@ -28,7 +28,7 @@ $sMetadataVersion = '2.0';
$logo = (class_exists(d3utils::class) ? d3utils::getInstance()->getD3Logo() : 'D&sup3;');
$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&sup3; Data Development (Inh.: Thomas Dartsch)',
'email' => 'support@shopmodule.com',