Compare commits

...

29 Commits

Author SHA1 Message Date
benvia e499522aa1
Merge pull request #25 from sinabe/v2
Transform Swiss QR into a Dolibarr module
2025-10-17 15:00:47 +02:00
Benoit Vianin 8db44d9a9b Merge branch 'master' into v2 2025-10-17 12:59:06 +00:00
Benoit Vianin 0484898601 Rename ZIP file according to module version 2025-10-17 10:13:35 +00:00
Benoit Vianin 5e86e16455 Update english translation 2025-10-17 09:07:14 +00:00
Benoit Vianin 5b3bf4a912 Update composer 2025-10-17 09:06:32 +00:00
Benoit Vianin 0fec943a52 Update readme content 2025-10-17 09:06:02 +00:00
Benoit Vianin 7cb846d4e1 Add link to check module update 2025-10-17 07:49:20 +00:00
Benoit Vianin a105f1c371 Reduve size of module by removing a set of unsed files in dependencies 2025-10-16 16:05:30 +00:00
Benoit Vianin 3ce6404a0f Update build to not include build directory in zip file 2025-10-16 13:56:07 +00:00
benvia af2c2465ae
Merge pull request #19 from gagarine/patch-1
Update README.md
2025-10-16 11:42:08 +02:00
benvia 747979f1ba
Merge pull request #24 from sinabe/v2-multicurrency
V2 multi currency
2025-08-30 15:27:23 +02:00
Benoit Vianin 92fc11e58b Fix balance and test currency 2025-08-30 13:25:59 +00:00
Benoit Vianin 5ad5a0ba56 Add support for multicurrency 2025-08-30 11:16:05 +00:00
Benoit Vianin 9678ee536d Fix set INVOICE_ADD_SWISS_QR_CODE to bottom on module activation 2025-08-30 09:00:16 +00:00
Benoit Vianin 9257144c4d Replace CH by the country code of the address 2025-08-30 08:45:37 +00:00
Simon Perdrisat f09b5bd5e8
Update README.md
- use correct terminology for SEO (QR-bill instead of QR invoice)
- remove unnecessary translations (browser handles this)
- improve language clarity and structure for readability
2025-08-29 18:25:28 +02:00
benvia a98a201c95
Merge pull request #15 from sinabe/fix-balance
Fix balance for QR
2024-08-11 13:10:11 +02:00
Benoit Vianin 39b340f874 Fix balance for QR 2024-08-11 13:08:06 +02:00
benvia c7a1ab0a72
Merge pull request #11 from sinabe/feature-qriban-ref
Feature qriban ref
2023-03-16 10:18:36 +01:00
Benoit Vianin 8129522876 Merge master 2023-03-16 10:10:58 +01:00
benvia f46bb28387
Merge pull request #7 from OdyX/no-double-swiss-qr
fix: do not allow Dolibarr's SwitzerlandQR
2023-03-16 09:12:18 +01:00
benvia 0bed9ee54e
Merge pull request #6 from OdyX/qr-always-black
fix: force QR block to have black text
2023-03-16 09:10:27 +01:00
Didier 'OdyX' Raboud 2b25307100
fix: do not allow Dolibarr's SwitzerlandQR 2023-03-12 16:54:12 +01:00
Didier 'OdyX' Raboud f23a1b40b0
fix: force QR block to have black text
In case of coloured watermark, this was not reset to black
2023-03-12 16:30:19 +01:00
Benoit Vianin 298de15213 Remove all non numeric character form invoice ref and set reference to 0 for PROV invoice 2023-03-12 10:51:48 +01:00
Benoit Vianin 8918230c1a Add check if IBAN is set before adding the QR part 2023-03-12 10:16:18 +01:00
Benoit Vianin adeb447227 Update dependencies and Readme 2023-03-04 18:09:53 +01:00
Benoit Vianin 0b5bf953d7 Add support for QR IBAN and reference 2023-03-04 17:04:33 +01:00
benvia 408b958226
Merge pull request #4 from sinabe/develop
Add multilingual support
2023-01-14 10:44:02 +01:00
6 changed files with 156 additions and 80 deletions

View File

@ -1,12 +1,29 @@
# Swiss QR Invoice for Dolibarr # Swiss QR-bill for Dolibarr
This Dolibarr module add Swiss QR invoice model to Dolibarr ERP/CRM. This module adds support for generating **Swiss QR-bill** (DE: QR-Rechnung, FR: QR-facture,IT: QR-fattura) invoices within Dolibarr ERP/CRM.
The model supports QR-IBAN or classic IBAN. It provides an additional invoice template that complies with the Swiss QR-bill standard, making it easier to issue valid invoices in Switzerland.
## Requirement For more information: https://www.six-group.com/en/products-services/banking-services/payment-standardization/standards/qr-bill.html
This module require PHP 8.1 and Dolibarr 18. ## Features
Compatible up to Dolibarr 21. - Supports both QR-IBAN and standard IBAN payment methods.
- Generates QR codes according to the official Swiss standard.
- Seamlessly integrates with Dolibarrs invoice system.
- Produces ready-to-use invoices in PDF format, including the payment slip.
- Based on Swiss QR Bill PHP library https://github.com/sprain/php-swiss-qr-bill/
## Requirements
- PHP ≥ 8.1
- Dolibarr ≥ 18, compatible up to 22
## Installation
1. Dowload the module from the Github repository
2. Use the upload function in Setup -> Modules/Applications -> Deploy/install external app/module
3. Activate the Swiss QR module
4. Activate the model in Setup -> Modules/Applications -> Invoices
5. You need to configure a bank account with an IBAN or QR-IBAN (reference number).
6. In case of QR-IBAN add the variable SI_SWISSQR_REF in Setup -> Other Setup. You receive this number from your bank (BESR-ID). For Postfinance value is 00000.
## How to build the module ## How to build the module
To build the module, follow these steps: To build the module, follow these steps:
@ -38,27 +55,25 @@ mv swissqr.zip swissqr-1.0.0.zip
``` ```
## Installation # Facture QR-Suisse pour Dolibarr
1. Dowload the module from the Github repository Ce module permet de générer des factures **QR-facture** dans Dolibarr ERP/CRM.
2. Use the upload function in Setup -> Modules/Applications -> Deploy/install external app/module Il fournit un modèle de facture complémentaire conformes à la norme Suisse QR-facture, facilitant l'émission de factures valables en Suisse.
3. Activate the Swiss QR module
4. Activate the model in Setup -> Modules/Applications -> Invoices
5. You need to configure a bank account with an IBAN or QR-IBAN (reference number).
6. In case of QR-IBAN add the variable SI_SWISSQR_REF in Setup -> Other Setup. You receive this number from your bank (BESR-ID). For Postfinance value is 00000.
## Baed on Pour plus d'informations : https://www.six-group.com/en/products-services/banking-services/payment-standardization/standards/qr-bill.html
* Swiss QR Bill (https://github.com/sprain/php-swiss-qr-bill/) ## Fonctionnalités
# QR facture suisse pour Dolibarr - Support des méthodes de paiement QR-IBAN et IBAN standard.
- Génération de codes QR conformes à la norme suisse officielle.
- Intégration fluide avec le système de facturation de Dolibarr.
- Production de factures prêtes à l'emploi au format PDF, incluant le justificatif de paiement.
- Base sur la bibliothèque PHP QR Bill : https://github.com/sprain/php-swiss-qr-bill/
Ce module Dolibarr ajoute un modèle de facture QR Suisse à Dolibarr ERP/CRM. ## Exigences
Le modèle prend en charge un IBAN traditionnel ou un IBAN QR.
## Prérequis - PHP ≥ 8.1
- Dolibarr ≥ 18, compatible jusqu'à 22
Ce module nécessite PHP 8.x et Dolibarr 16. Il est compatible jusqu'à Dolibarr 21.
## Installation ## Installation
@ -69,14 +84,25 @@ Ce module nécessite PHP 8.x et Dolibarr 16. Il est compatible jusqu'à Dolibarr
5. Vous devez configurer un compte bancaire avec un IBAN ou un IBAN QR (numéro de référence). 5. Vous devez configurer un compte bancaire avec un IBAN ou un IBAN QR (numéro de référence).
6. En cas d'utilisation d'un IBAN-QR, ajoutez la variable SI_SWISSQR_REF dans Setup -> Autres paramètres. Ce numéro provient de votre banque (BESR-ID). Pour Postfinance, la valeur est 00000. 6. En cas d'utilisation d'un IBAN-QR, ajoutez la variable SI_SWISSQR_REF dans Setup -> Autres paramètres. Ce numéro provient de votre banque (BESR-ID). Pour Postfinance, la valeur est 00000.
# Swiss QR Invoice für Dolibarr # Swiss QR-Rechnung für Dolibarr
Dieser Dolibarr-Modul fügt einen Swiss QR-Rechnungsmodell zu Dolibarr ERP/CRM hinzu. Dieses Modul ermöglicht die Erstellung von **Swiss QR-Rechnung** innerhalb von Dolibarr ERP/CRM.
Das Modell unterstützt QR-IBAN oder klassischen IBAN. Es bietet eine zusätzliche Rechnungsvorlage, die den Schweizer QR-Bill standard einhält, um rechtlich gültige Rechnungen in der Schweiz effizient zu erstellen.
## Anforderung Weitere Informationen: https://www.six-group.com/en/products-services/banking-services/payment-standardization/standards/qr-bill.html
Dieser Modul erfordert PHP 8.x und Dolibarr 16. Kompatibel bis Dolibarr 21. ## Funktionen
- Unterstützt sowohl QR-IBAN als auch Standard-IBAN-Zahlungsmethoden.
- Erzeugt QR-Codes gemäß der offiziellen Schweizer Norm.
- Integriert sich problemlos mit dem Rechnungssystem von Dolibarr.
- Erzeugt Rechnungen im PDF-Format, die direkt verwendet werden können, inklusive des Zahlungsnachweises.
- Basiert auf der PHP-Bibliothek Swiss QR Bill: https://github.com/sprain/php-swiss-qr-bill/
## Anforderungen
- PHP ≥ 8.1
- Dolibarr ≥ 18, kompatibel bis 22
## Installation ## Installation
@ -87,14 +113,25 @@ Dieser Modul erfordert PHP 8.x und Dolibarr 16. Kompatibel bis Dolibarr 21.
5. Sie müssen ein Bankkonto mit IBAN oder QR-IBAN (Referenznummer) konfigurieren. 5. Sie müssen ein Bankkonto mit IBAN oder QR-IBAN (Referenznummer) konfigurieren.
6. Falls Sie QR-IBAN verwenden, fügen Sie die Variable SI_SWISSQR_REF in Setup -> Andere Einstellungen hinzu. Sie erhalten diese Nummer von Ihrer Bank (BESR-ID). Für Postfinance ist der Wert 00000. 6. Falls Sie QR-IBAN verwenden, fügen Sie die Variable SI_SWISSQR_REF in Setup -> Andere Einstellungen hinzu. Sie erhalten diese Nummer von Ihrer Bank (BESR-ID). Für Postfinance ist der Wert 00000.
# Fattura QR svizzera per Dolibarr # Swiss QR-fattura per Dolibarr
Questo modulo Dolibarr aggiunge un modello di fattura QR Svizzera a Dolibarr ERP/CRM. Questo modulo aggiunge supporto per la generazione di **Swiss QR-fattura** all'interno di Dolibarr ERP/CRM.
Il modello supporta IBAN classico o QR-IBAN. Fornisce un modello di fattura aggiuntivo che rispetta lo standard Swiss QR-Bill, rendendo più semplice l'emissione di fatture valide in Svizzera.
Per ulteriori informazioni: https://www.six-group.com/en/products-services/banking-services/payment-standardization/standards/qr-bill.html
## Funzionalità
- Supporta sia i metodi di pagamento QR-IBAN che i metodi standard IBAN.
- Genera codici QR in conformità con lo standard svizzero ufficiale.
- Si integra in modo fluido con il sistema di fatturazione di Dolibarr.
- Produce fatture pronte all'uso in formato PDF, inclusi i documenti di pagamento.
- Basato sulla libreria PHP Swiss QR Bill: https://github.com/sprain/php-swiss-qr-bill/
## Requisiti ## Requisiti
Questo modulo richiede PHP 8.x e Dolibarr 16. Compatibile fino a Dolibarr 21. - PHP ≥ 8.1
- Dolibarr ≥ 18, compatibile fino a 22
## Installazione ## Installazione

View File

@ -1,5 +1,9 @@
#!/bin/bash #!/bin/bash
# Extract version of the module
file=$(pwd)"/core/modules/modSwissqr.class.php"
version=$(grep -oE '[0-9]+\.[0-9]+\.[0-9]+' "$file" 2>/dev/null)
docker run --rm --interactive --tty --volume ./includes:/app composer update --ignore-platform-req=ext-bcmath docker run --rm --interactive --tty --volume ./includes:/app composer update --ignore-platform-req=ext-bcmath
# Clean up vendor directory # Clean up vendor directory
@ -8,9 +12,35 @@ if [ -d includes/vendor/sprain/swiss-qr-bill/example ]; then
rm -rf includes/vendor/sprain/swiss-qr-bill/example rm -rf includes/vendor/sprain/swiss-qr-bill/example
fi fi
if [ -d includes/vendor/symfony/intl/Resources/data/currencies ]; then
rm -rf includes/vendor/symfony/intl/Resources/data/currencies
fi
if [ -d includes/vendor/symfony/intl/Resources/data/languages ]; then
rm -rf includes/vendor/symfony/intl/Resources/data/languages
fi
if [ -d includes/vendor/symfony/intl/Resources/data/timezones ]; then
rm -rf includes/vendor/symfony/intl/Resources/data/timezones
fi
if [ -d includes/vendor/symfony/intl/Resources/data/transliterator ]; then
rm -rf includes/vendor/symfony/intl/Resources/data/transliterator
fi
if [ -d includes/vendor/endroid/qr-code/assets ]; then
rm -rf includes/vendor/endroid/qr-code/assets
fi
cd .. cd ..
if [ -f swissqr.zip ]; then if [ -f swissqr.zip ]; then
rm swissqr.zip rm swissqr.zip
fi fi
zip -r swissqr.zip swissqr -x "swissqr/.git*"
zip -r swissqr.zip swissqr -x "swissqr/.git*" "swissqr/build/*"
# Rename ZIP file
if [ -f swissqr.zip ]; then
mv "swissqr.zip" "swissqr-${version}.zip"
fi

View File

@ -101,7 +101,7 @@ class pdf_swissqr extends pdf_sponge
'', '',
$object->account->owner_zip, $object->account->owner_zip,
$object->account->owner_town, $object->account->owner_town,
'CH' $object->account->country_code
) )
); );
} else { } else {
@ -112,7 +112,7 @@ class pdf_swissqr extends pdf_sponge
'', '',
$this->emetteur->zip, $this->emetteur->zip,
$this->emetteur->town, $this->emetteur->town,
'CH' $this->emetteur->country_code
) )
); );
} }
@ -166,26 +166,35 @@ class pdf_swissqr extends pdf_sponge
'', '',
$object->thirdparty->zip, $object->thirdparty->zip,
$object->thirdparty->town, $object->thirdparty->town,
'CH' $object->thirdparty->country_code
)); ));
// Calculate total with taxes // Calculate total with taxes
$deja_regle = $object->getSommePaiement((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0); $deja_regle = $object->getSommePaiement((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0);
$creditnoteamount = $object->getSumCreditNotesUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0); // Warning, this also include excess received $amount_credit_notes_included = $object->getSumCreditNotesUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0);
$depositsamount = $object->getSumDepositsUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0); $amount_deposits_included = $object->getSumDepositsUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0);
$balance = price2num($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT'); $total_ttc = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
$balance = price2num($total_ttc - $deja_regle - $amount_credit_notes_included - $amount_deposits_included, 'MT');
if ($balance < 0) { if ($balance < 0) {
$balance = 0; $balance = 0;
} }
$currencyinvoicecode = $object->multicurrency_code ? $object->multicurrency_code : $conf->currency;
if ($currencyinvoicecode == "CHF" || $currencyinvoicecode == "EUR") {
// Add payment amount information // Add payment amount information
// What amount is to be paid? // What amount is to be paid?
$qrBill->setPaymentAmountInformation( $qrBill->setPaymentAmountInformation(
QrBill\DataGroup\Element\PaymentAmountInformation::create( QrBill\DataGroup\Element\PaymentAmountInformation::create(
'CHF', $currencyinvoicecode,
$balance $balance
)); ));
} else {
$this->error = "Only CHF or EUR currencies accepted";
return false;
}
// Optionally, add some human-readable information about what the bill is for. // Optionally, add some human-readable information about what the bill is for.
$qrBill->setAdditionalInformation( $qrBill->setAdditionalInformation(

View File

@ -77,7 +77,7 @@ class modSwissqr extends DolibarrModules
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated', 'experimental_deprecated' or a version string like 'x.y.z' // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated', 'experimental_deprecated' or a version string like 'x.y.z'
$this->version = '2.0.0'; $this->version = '2.0.0';
// Url to the file with your last numberversion of this module // Url to the file with your last numberversion of this module
//$this->url_last_version = 'http://www.example.com/versionmodule.txt'; $this->url_last_version = 'https://modules-dolibarr.sinabe.ch/swissqr/versionmodule.txt';
// Key used in llx_const table to save module status enabled/disabled (where SWISSQR is value of property name of module in uppercase) // Key used in llx_const table to save module status enabled/disabled (where SWISSQR is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
@ -153,7 +153,7 @@ class modSwissqr extends DolibarrModules
// 2 => array('SWISSQR_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1) // 2 => array('SWISSQR_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1)
// ); // );
$this->const = array( $this->const = array(
1 => array('INVOICE_ADD_SWISS_QR_CODE', 'chaine', 'bottom', '', 1) 1 => array('INVOICE_ADD_SWISS_QR_CODE', 'chaine', 'bottom', '', 0, 'current', 1)
); );
// error_log("You messed up!", 0); // error_log("You messed up!", 0);
} }

36
includes/composer.lock generated
View File

@ -62,16 +62,16 @@
}, },
{ {
"name": "dasprid/enum", "name": "dasprid/enum",
"version": "1.0.6", "version": "1.0.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/DASPRiD/Enum.git", "url": "https://github.com/DASPRiD/Enum.git",
"reference": "8dfd07c6d2cf31c8da90c53b83c026c7696dda90" "reference": "b5874fa9ed0043116c72162ec7f4fb50e02e7cce"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/DASPRiD/Enum/zipball/8dfd07c6d2cf31c8da90c53b83c026c7696dda90", "url": "https://api.github.com/repos/DASPRiD/Enum/zipball/b5874fa9ed0043116c72162ec7f4fb50e02e7cce",
"reference": "8dfd07c6d2cf31c8da90c53b83c026c7696dda90", "reference": "b5874fa9ed0043116c72162ec7f4fb50e02e7cce",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -106,9 +106,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/DASPRiD/Enum/issues", "issues": "https://github.com/DASPRiD/Enum/issues",
"source": "https://github.com/DASPRiD/Enum/tree/1.0.6" "source": "https://github.com/DASPRiD/Enum/tree/1.0.7"
}, },
"time": "2024-08-09T14:30:48+00:00" "time": "2025-09-16T12:23:56+00:00"
}, },
{ {
"name": "endroid/qr-code", "name": "endroid/qr-code",
@ -371,16 +371,16 @@
}, },
{ {
"name": "symfony/intl", "name": "symfony/intl",
"version": "v6.4.24", "version": "v6.4.26",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/intl.git", "url": "https://github.com/symfony/intl.git",
"reference": "c0938cd29804e65308051a42d1387f0dd57e1eaf" "reference": "0cd11e99e8c505f7ee7c6f0ccc8bccb8e14e652f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/intl/zipball/c0938cd29804e65308051a42d1387f0dd57e1eaf", "url": "https://api.github.com/repos/symfony/intl/zipball/0cd11e99e8c505f7ee7c6f0ccc8bccb8e14e652f",
"reference": "c0938cd29804e65308051a42d1387f0dd57e1eaf", "reference": "0cd11e99e8c505f7ee7c6f0ccc8bccb8e14e652f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -434,7 +434,7 @@
"localization" "localization"
], ],
"support": { "support": {
"source": "https://github.com/symfony/intl/tree/v6.4.24" "source": "https://github.com/symfony/intl/tree/v6.4.26"
}, },
"funding": [ "funding": [
{ {
@ -454,7 +454,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-07-10T08:14:14+00:00" "time": "2025-09-07T21:26:26+00:00"
}, },
{ {
"name": "symfony/polyfill-ctype", "name": "symfony/polyfill-ctype",
@ -872,16 +872,16 @@
}, },
{ {
"name": "symfony/validator", "name": "symfony/validator",
"version": "v6.4.24", "version": "v6.4.26",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/validator.git", "url": "https://github.com/symfony/validator.git",
"reference": "297a24dccf13cc09f1d03207b20807f528f088cc" "reference": "3ed456b3cd04e61fc7ed2601805fee3c1130663a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/validator/zipball/297a24dccf13cc09f1d03207b20807f528f088cc", "url": "https://api.github.com/repos/symfony/validator/zipball/3ed456b3cd04e61fc7ed2601805fee3c1130663a",
"reference": "297a24dccf13cc09f1d03207b20807f528f088cc", "reference": "3ed456b3cd04e61fc7ed2601805fee3c1130663a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -949,7 +949,7 @@
"description": "Provides tools to validate values", "description": "Provides tools to validate values",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/validator/tree/v6.4.24" "source": "https://github.com/symfony/validator/tree/v6.4.26"
}, },
"funding": [ "funding": [
{ {
@ -969,7 +969,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-07-29T18:08:45+00:00" "time": "2025-09-25T15:37:27+00:00"
} }
], ],
"packages-dev": [], "packages-dev": [],

View File

@ -20,4 +20,4 @@
# Module label 'ModuleSwissqrName' # Module label 'ModuleSwissqrName'
ModuleSwissqrName = Swissqr ModuleSwissqrName = Swissqr
# Module description 'ModuleSwissqrDesc' # Module description 'ModuleSwissqrDesc'
ModuleSwissqrDesc = Swiss QR Invoice for Dolibarr ModuleSwissqrDesc = Swiss QR bill for Dolibarr