From 298de15213bc2b3d8df0258836f6e94209c75941 Mon Sep 17 00:00:00 2001 From: Benoit Vianin Date: Sun, 12 Mar 2023 10:51:48 +0100 Subject: [PATCH] Remove all non numeric character form invoice ref and set reference to 0 for PROV invoice --- htdocs/core/modules/facture/doc/pdf_swissqr.modules.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_swissqr.modules.php b/htdocs/core/modules/facture/doc/pdf_swissqr.modules.php index 185c249..fdee638 100644 --- a/htdocs/core/modules/facture/doc/pdf_swissqr.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_swissqr.modules.php @@ -928,15 +928,13 @@ class pdf_swissqr extends ModelePDFFactures $ref = $object->ref; - if (str_contains($ref, 'FA')) + if (str_contains($ref, 'PROV')) { - // Remove FA and - from the invoice reference - $ref = str_replace('FA', '', $ref); - $ref = str_replace('-', '', $ref); - } else { $ref = 0; } + $ref = preg_replace('/[^0-9]/', '', $ref); + // Add payment reference for QR-IBAN // This is what you will need to identify incoming payments. $referenceNumber = QrBill\Reference\QrPaymentReferenceGenerator::generate(