improve code
This commit is contained in:
parent
efdc63225e
commit
895ea19f89
@ -36,19 +36,17 @@ class orderOverviewPdfGenerator
|
|||||||
*/
|
*/
|
||||||
public function generatePdf(Order $order, $sFilename, $iSelLang = 0, $target = 'I')
|
public function generatePdf(Order $order, $sFilename, $iSelLang = 0, $target = 'I')
|
||||||
{
|
{
|
||||||
$Pdf= $this->getPdfClass($order);
|
$Pdf= $this->getPdfClass();
|
||||||
|
|
||||||
$Pdf->setOrder($order);
|
$Pdf->setOrder($order);
|
||||||
$Pdf->genPdf($sFilename, $iSelLang, $target);
|
$Pdf->genPdf($sFilename, $iSelLang, $target);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Order $order
|
|
||||||
*
|
|
||||||
* @return pdfdocumentsOrderInterface
|
* @return pdfdocumentsOrderInterface
|
||||||
* @throws noPdfHandlerFoundException
|
* @throws noPdfHandlerFoundException
|
||||||
*/
|
*/
|
||||||
public function getPdfClass(Order $order)
|
public function getPdfClass()
|
||||||
{
|
{
|
||||||
$requestedType = Registry::getRequest()->getRequestParameter('pdftype');
|
$requestedType = Registry::getRequest()->getRequestParameter('pdftype');
|
||||||
|
|
||||||
|
@ -15,9 +15,11 @@
|
|||||||
|
|
||||||
namespace D3\PdfDocuments\Application\Model\Exceptions;
|
namespace D3\PdfDocuments\Application\Model\Exceptions;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
|
||||||
class noBaseObjectSetException extends pdfGeneratorExceptionAbstract
|
class noBaseObjectSetException extends pdfGeneratorExceptionAbstract
|
||||||
{
|
{
|
||||||
public function __construct( $sMessage = "no base object (e.g. order) for pdf generator set", $iCode = 0, \Exception $previous = null )
|
public function __construct( $sMessage = "no base object (e.g. order) for pdf generator set", $iCode = 0, Exception $previous = null )
|
||||||
{
|
{
|
||||||
parent::__construct( $sMessage, $iCode, $previous );
|
parent::__construct( $sMessage, $iCode, $previous );
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
namespace D3\PdfDocuments\Application\Model\Exceptions;
|
namespace D3\PdfDocuments\Application\Model\Exceptions;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
|
||||||
class noPdfHandlerFoundException extends pdfGeneratorExceptionAbstract
|
class noPdfHandlerFoundException extends pdfGeneratorExceptionAbstract
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -23,9 +25,9 @@ class noPdfHandlerFoundException extends pdfGeneratorExceptionAbstract
|
|||||||
* @param $requestId
|
* @param $requestId
|
||||||
* @param string $sMessage
|
* @param string $sMessage
|
||||||
* @param int $iCode
|
* @param int $iCode
|
||||||
* @param \Exception|null $previous
|
* @param Exception|null $previous
|
||||||
*/
|
*/
|
||||||
public function __construct( $requestId, $sMessage = "no pdf handler defined for given request id", $iCode = 0, \Exception $previous = null )
|
public function __construct( $requestId, $sMessage = "no pdf handler defined for given request id", $iCode = 0, Exception $previous = null )
|
||||||
{
|
{
|
||||||
$sMessage .= ' "'.$requestId.'"';
|
$sMessage .= ' "'.$requestId.'"';
|
||||||
parent::__construct( $sMessage, $iCode, $previous );
|
parent::__construct( $sMessage, $iCode, $previous );
|
||||||
|
@ -15,9 +15,11 @@
|
|||||||
|
|
||||||
namespace D3\PdfDocuments\Application\Model\Exceptions;
|
namespace D3\PdfDocuments\Application\Model\Exceptions;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
|
||||||
class wrongPdfGeneratorInterface extends pdfGeneratorExceptionAbstract
|
class wrongPdfGeneratorInterface extends pdfGeneratorExceptionAbstract
|
||||||
{
|
{
|
||||||
public function __construct( $requiredInterface, $sMessage = "generator class doesn't fulfilled the interface", $iCode = 0, \Exception $previous = null ) {
|
public function __construct( $requiredInterface, $sMessage = "generator class doesn't fulfilled the interface", $iCode = 0, Exception $previous = null ) {
|
||||||
|
|
||||||
$sMessage .= $requiredInterface;
|
$sMessage .= $requiredInterface;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user