make valid filenames

Cette révision appartient à :
Daniel Seifert 2020-06-17 09:05:49 +02:00
Parent a6e09a7f95
révision 471d78986f
3 fichiers modifiés avec 27 ajouts et 11 suppressions

Voir le fichier

@ -199,10 +199,18 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
{
// forced filename from setFilename()
if ($this->filename) {
return $this->addFilenameExtension($this->filename);
return $this->addFilenameExtension(
$this->makeValidFileName(
$this->filename
)
);
}
return $this->addFilenameExtension($this->getTypeForFilename());
return $this->addFilenameExtension(
$this->makeValidFileName(
$this->getTypeForFilename()
)
);
}
/**

Voir le fichier

@ -69,19 +69,25 @@ abstract class pdfdocumentsOrder extends pdfdocumentsGeneric implements orderInt
{
// forced filename from setFilename()
if ($this->filename) {
return $this->addFilenameExtension($this->filename);
return $this->addFilenameExtension(
$this->makeValidFileName(
$this->filename
)
);
}
$sTrimmedBillName = trim($this->getOrder()->getFieldData('oxbilllname'));
return $this->addFilenameExtension(
implode(
'_',
[
$this->getTypeForFilename(),
$this->getOrder()->getFieldData('oxordernr'),
$sTrimmedBillName
]
$this->makeValidFileName(
implode(
'_',
[
$this->getTypeForFilename(),
$this->getOrder()->getFieldData('oxordernr'),
$sTrimmedBillName
]
)
)
);
}

Voir le fichier

@ -111,10 +111,12 @@ class invoicePdf extends pdfdocumentsOrder implements pdfdocumentsOrderinvoiceIn
{
$filename = parent::getFilename();
return str_replace(
$filename = str_replace(
$this->getOrder()->getFieldData('oxordernr'),
$this->getOrder()->getFieldData('oxbillnr'),
$filename
);
return $this->makeValidFileName($filename);
}
}