Fix error management

This commit is contained in:
Laurent Destailleur 2023-05-26 20:13:37 +02:00
parent 32101ea885
commit 066df875bc
2 changed files with 10 additions and 3 deletions

View File

@ -907,7 +907,11 @@ class pdf_crabe extends ModelePDFFactures
}
if (getDolGlobalString('INVOICE_ADD_SWISS_QR_CODE') == 'bottom') {
$this->addBottomQRInvoice($pdf, $object, $outputlangs);
$result = $this->addBottomQRInvoice($pdf, $object, $outputlangs);
if (!$result) {
$pdf->Close();
return 0;
}
}
$pdf->Close();

View File

@ -89,14 +89,17 @@ abstract class ModelePDFFactures extends CommonDocGenerator
*/
private function getSwissQrBill(Facture $object, Translate $langs)
{
global $conf;
if (getDolGlobalString('INVOICE_ADD_SWISS_QR_CODE') != 'bottom') {
return false;
}
if ($object->mode_reglement_code != 'VIR') {
$this->error = $langs->transnoentities("SwissQrOnlyVIR");
return false;
}
if (empty($conf->global->INVOICE_ADD_SWISS_QR_CODE)) {
if (empty($object->fk_account)) {
$this->error = 'Bank account must be defined to use this experimental feature';
return false;
}