diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 77605da1dca..250eb50b495 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -452,8 +452,14 @@ class pdf_crabe extends ModelePDFFactures $qrcodestring = ''; if (getDolGlobalString('INVOICE_ADD_ZATCA_QR_CODE')) { $qrcodestring = $object->buildZATCAQRString(); - } elseif (getDolGlobalString('INVOICE_ADD_SWISS_QR_CODE') == '1') { - $qrcodestring = $object->buildSwitzerlandQRString(); + } elseif (getDolGlobalString('INVOICE_ADD_SWISS_QR_CODE') == '1' && (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR')) { + if ($object->fk_account > 0 || $object->fk_bank > 0 || getDolGlobalInt('FACTURE_RIB_NUMBER')) { + $qrcodestring = $object->buildSwitzerlandQRString(); + } + } elseif (getDolGlobalString('INVOICE_ADD_EPC_QR_CODE') == '1' && (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR')) { + if ($object->fk_account > 0 || $object->fk_bank > 0 || getDolGlobalInt('FACTURE_RIB_NUMBER')) { + $qrcodestring = $object->buildEPCQrCodeString(); + } } if ($qrcodestring) { @@ -468,6 +474,15 @@ class pdf_crabe extends ModelePDFFactures 'module_height' => 1 // height of a single module in points ); $pdf->write2DBarcode($qrcodestring, 'QRCODE,M', $this->marge_gauche, $tab_top - 5, 25, 25, $styleQr, 'N'); + + if (getDolGlobalString('INVOICE_ADD_EPC_QR_CODE') == '1' && (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR')) { + if ($object->fk_account > 0 || $object->fk_bank > 0 || getDolGlobalInt('FACTURE_RIB_NUMBER')) { + $pdf->SetXY($this->marge_gauche + 30, $pdf->GetY() - 15); + $pdf->SetFont('', '', $default_font_size - 4); + $pdf->MultiCell(40, 3, $langs->transnoentitiesnoconv("INVOICE_ADD_EPC_QR_CODEPay"), 0, 'L', 0); + } + } + $extra_under_address_shift += 25; } diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 9a2a1740960..26c46f341e8 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -461,9 +461,16 @@ class pdf_sponge extends ModelePDFFactures $qrcodestring = ''; if (getDolGlobalString('INVOICE_ADD_ZATCA_QR_CODE')) { $qrcodestring = $object->buildZATCAQRString(); - } elseif (getDolGlobalString('INVOICE_ADD_SWISS_QR_CODE') == '1') { - $qrcodestring = $object->buildSwitzerlandQRString(); + } elseif (getDolGlobalString('INVOICE_ADD_SWISS_QR_CODE') == '1' && (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR')) { + if ($object->fk_account > 0 || $object->fk_bank > 0 || getDolGlobalInt('FACTURE_RIB_NUMBER')) { + $qrcodestring = $object->buildSwitzerlandQRString(); + } + } elseif (getDolGlobalString('INVOICE_ADD_EPC_QR_CODE') == '1' && (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR')) { + if ($object->fk_account > 0 || $object->fk_bank > 0 || getDolGlobalInt('FACTURE_RIB_NUMBER')) { + $qrcodestring = $object->buildEPCQrCodeString(); + } } + if ($qrcodestring) { $qrcodecolor = array('25', '25', '25'); // set style for QR-code @@ -476,6 +483,15 @@ class pdf_sponge extends ModelePDFFactures 'module_height' => 1 // height of a single module in points ); $pdf->write2DBarcode($qrcodestring, 'QRCODE,M', $this->marge_gauche, $this->tab_top - 5, 25, 25, $styleQr, 'N'); + + if (getDolGlobalString('INVOICE_ADD_EPC_QR_CODE') == '1' && (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR')) { + if ($object->fk_account > 0 || $object->fk_bank > 0 || getDolGlobalInt('FACTURE_RIB_NUMBER')) { + $pdf->SetXY($this->marge_gauche + 30, $pdf->GetY() - 15); + $pdf->SetFont('', '', $default_font_size - 4); + $pdf->MultiCell(40, 3, $langs->transnoentitiesnoconv("INVOICE_ADD_EPC_QR_CODEPay"), 0, 'L', 0); + } + } + $extra_under_address_shift += 25; } @@ -1215,7 +1231,7 @@ class pdf_sponge extends ModelePDFFactures // If France, show VAT mention if not applicable if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj)) { - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); if ($mysoc->forme_juridique_code == 92) { $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoiceAsso"), 0, 'L', 0); @@ -1234,7 +1250,7 @@ class pdf_sponge extends ModelePDFFactures // Show payments conditions if ($object->type != 2 && ($object->cond_reglement_code || $object->cond_reglement)) { - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentConditions").':'; $pdf->MultiCell($posxval - $this->marge_gauche, 4, $titre, 0, 'L'); @@ -1250,7 +1266,7 @@ class pdf_sponge extends ModelePDFFactures // Show category of operations if (getDolGlobalInt('INVOICE_CATEGORY_OF_OPERATION') == 2 && $this->categoryOfOperation >= 0) { - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); $categoryOfOperationTitle = $outputlangs->transnoentities("MentionCategoryOfOperations").' : '; $pdf->MultiCell($posxval - $this->marge_gauche, 4, $categoryOfOperationTitle, 0, 'L'); @@ -1276,7 +1292,7 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetTextColor(200, 0, 0); - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - 2); $this->error = $outputlangs->transnoentities("ErrorPaymentModeDefinedToWithoutSetup", $object->mode_reglement_code); $pdf->MultiCell($posxend - $this->marge_gauche, 3, $this->error, 0, 'L', 0); $pdf->SetTextColor(0, 0, 0); @@ -1288,7 +1304,7 @@ class pdf_sponge extends ModelePDFFactures if (!empty($object->mode_reglement_code) && $object->mode_reglement_code != 'CHQ' && $object->mode_reglement_code != 'VIR') { - $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); $titre = $outputlangs->transnoentities("PaymentMode").':'; $pdf->MultiCell($posxend - $this->marge_gauche, 5, $titre, 0, 'L'); @@ -1405,7 +1421,7 @@ class pdf_sponge extends ModelePDFFactures // If payment mode not forced or forced to VIR, show payment with BAN if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') { if ($object->fk_account > 0 || $object->fk_bank > 0 || getDolGlobalInt('FACTURE_RIB_NUMBER')) { - $bankid = ($object->fk_account <= 0 ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account); + $bankid = ($object->fk_account <= 0 ? getDolGlobalInt('FACTURE_RIB_NUMBER') : $object->fk_account); if ($object->fk_bank > 0) { $bankid = $object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank } @@ -1420,7 +1436,7 @@ class pdf_sponge extends ModelePDFFactures $posy += 2; // SHOW EPC QR CODE - if (getDolGlobalString('INVOICE_ADD_EPC_QR_CODE')) { + if (getDolGlobalString('INVOICE_ADD_EPC_QR_CODE') == 'bottom') { $qrPosX = 120; $qrPosY = $posy; $qrCodeColor = array('25', '25', '25'); diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index 123ced406da..322bf6b406a 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -165,8 +165,7 @@ class mod_facture_mercure extends ModeleNumRefFactures // Get entities $entity = getEntity('invoicenumber', 1, $invoice); - - $numFinal = get_next_value($db, $mask, 'facture', 'ref', $where, $objsoc, $invoice->date, $mode, false, null, $entity); + $numFinal = get_next_value($db, $mask, 'facture', 'ref', $where, $objsoc, (empty($invoice) ? dol_now() : $invoice->date), $mode, false, null, $entity); if (!preg_match('/([0-9])+/', $numFinal)) { $this->error = $numFinal; } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 0ec52e59b8f..b1e9c2e5f6c 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2361,11 +2361,11 @@ IconOnlyTextOnHover=Icon only - Text of icon appears under icon on mouse over th IconOnly=Icon only - Text on tooltip only INVOICE_ADD_ZATCA_QR_CODE=Show the ZATCA QR code on invoices INVOICE_ADD_ZATCA_QR_CODEMore=Some Arabic countries need this QR Code on their invoices -INVOICE_ADD_SWISS_QR_CODE=Show the swiss QR-Bill code on invoices +INVOICE_ADD_SWISS_QR_CODE=Show the swiss QR-Bill code on invoices (with a bank account defined for credit transfer) INVOICE_ADD_SWISS_QR_CODEMore=Switzerland's standard for invoices; make sure ZIP & City are filled and that the accounts have valid Swiss/Liechtenstein IBANs. -INVOICE_ADD_EPC_QR_CODE=Show the EPC QR code on invoices +INVOICE_ADD_EPC_QR_CODE=Show the EPC QR code on invoices (with a bank account defined for credit transfer) INVOICE_ADD_EPC_QR_CODEMore=This feature allows you to add or remove an EPC QR Code on your invoices, which facilitates automatic SEPA credit transfers. Enabling this option helps your clients make payments easily by scanning the QR code, reducing manual entry errors. Use this feature if you have clients in countries like Austria, Belgium, Finland, Germany, and the Netherlands where this system is supported. Disable it if it's not required for your business operations or client base. -INVOICE_ADD_EPC_QR_CODEPay=Scan this QR code to pay with your mobile phone. +INVOICE_ADD_EPC_QR_CODEPay=Scan this QR code to pay with a smartphone supporting payment with EPC QR code. INVOICE_SHOW_SHIPPING_ADDRESS=Show shipping address INVOICE_SHOW_SHIPPING_ADDRESSMore=Compulsory indication in some countries (France, ...) UrlSocialNetworksDesc=Url link of social network. Use {socialid} for the variable part that contains the social network ID.