add preAction and postAction calls to prevent wrong filenames because unset values
Dieser Commit ist enthalten in:
Ursprung
fc51664700
Commit
de22f5dd71
@ -50,6 +50,14 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
|
||||
$this->oSmarty = Registry::getUtilsView()->getSmarty();
|
||||
}
|
||||
|
||||
public function runPreAction()
|
||||
{
|
||||
}
|
||||
|
||||
public function runPostAction()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sFilename
|
||||
* @param int $iSelLang
|
||||
@ -77,8 +85,10 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
|
||||
public function downloadPdf($iLanguage = 0)
|
||||
{
|
||||
try {
|
||||
$this->runPreAction();
|
||||
$sFilename = $this->getFilename();
|
||||
$this->genPdf($sFilename, $iLanguage, self::PDF_DESTINATION_DOWNLOAD);
|
||||
$this->runPostAction();
|
||||
Registry::getUtils()->showMessageAndExit('');
|
||||
} catch (pdfGeneratorExceptionAbstract $e) {
|
||||
Registry::get(UtilsView::class)->addErrorToDisplay($e);
|
||||
@ -95,12 +105,14 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
|
||||
public function savePdfFile($path, $iLanguage = 0)
|
||||
{
|
||||
try {
|
||||
$this->runPreAction();
|
||||
$sFilename = $this->getFilename();
|
||||
$this->genPdf(
|
||||
rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$sFilename,
|
||||
$iLanguage,
|
||||
self::PDF_DESTINATION_FILE
|
||||
);
|
||||
$this->runPostAction();
|
||||
} catch (pdfGeneratorExceptionAbstract $e) {
|
||||
Registry::get(UtilsView::class)->addErrorToDisplay($e);
|
||||
Registry::getLogger()->error($e);
|
||||
@ -116,8 +128,11 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
|
||||
public function getPdfContent($iLanguage = 0)
|
||||
{
|
||||
try {
|
||||
$this->runPreAction();
|
||||
$sFilename = $this->getFilename();
|
||||
return $this->genPdf( $sFilename, $iLanguage, self::PDF_DESTINATION_STRING );
|
||||
$ret = $this->genPdf( $sFilename, $iLanguage, self::PDF_DESTINATION_STRING );
|
||||
$this->runPostAction();
|
||||
return $ret;
|
||||
} catch (pdfGeneratorExceptionAbstract $e) {
|
||||
Registry::get(UtilsView::class)->addErrorToDisplay($e);
|
||||
Registry::getLogger()->error($e);
|
||||
|
@ -43,22 +43,13 @@ class invoicePdf extends pdfdocumentsOrder implements pdfdocumentsOrderinvoiceIn
|
||||
return 'invoice';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sFilename
|
||||
* @param int $iSelLang
|
||||
* @param string $target
|
||||
*
|
||||
* @return mixed|string|void
|
||||
* @throws Html2PdfException
|
||||
* @throws noBaseObjectSetException
|
||||
*/
|
||||
public function genPdf( $sFilename, $iSelLang = 0, $target = 'I' )
|
||||
public function runPreAction()
|
||||
{
|
||||
parent::runPreAction();
|
||||
|
||||
$this->setInvoiceNumber();
|
||||
$this->setInvoiceDate();
|
||||
$this->saveOrderOnChanges();
|
||||
|
||||
return parent::genPdf( $sFilename, $iSelLang, $target );
|
||||
}
|
||||
|
||||
public function setInvoiceNumber()
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren