Compare commits

..

No commits in common. "master" and "v2.0.0-beta.1" have entirely different histories.

6 changed files with 80 additions and 156 deletions

View File

@ -1,29 +1,12 @@
# Swiss QR-bill for Dolibarr # Swiss QR Invoice for Dolibarr
This module adds support for generating **Swiss QR-bill** (DE: QR-Rechnung, FR: QR-facture,IT: QR-fattura) invoices within Dolibarr ERP/CRM. This Dolibarr module add Swiss QR invoice model to Dolibarr ERP/CRM.
It provides an additional invoice template that complies with the Swiss QR-bill standard, making it easier to issue valid invoices in Switzerland. The model supports QR-IBAN or classic IBAN.
For more information: https://www.six-group.com/en/products-services/banking-services/payment-standardization/standards/qr-bill.html ## Requirement
## Features This module require PHP 8.1 and Dolibarr 18.
- Supports both QR-IBAN and standard IBAN payment methods. Compatible up to Dolibarr 21.
- 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:
@ -55,25 +38,27 @@ mv swissqr.zip swissqr-1.0.0.zip
``` ```
# Facture QR-Suisse pour Dolibarr ## Installation
Ce module permet de générer des factures **QR-facture** dans Dolibarr ERP/CRM. 1. Dowload the module from the Github repository
Il fournit un modèle de facture complémentaire conformes à la norme Suisse QR-facture, facilitant l'émission de factures valables en Suisse. 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.
Pour plus d'informations : https://www.six-group.com/en/products-services/banking-services/payment-standardization/standards/qr-bill.html ## Baed on
## Fonctionnalités * Swiss QR Bill (https://github.com/sprain/php-swiss-qr-bill/)
- Support des méthodes de paiement QR-IBAN et IBAN standard. # QR facture suisse pour Dolibarr
- 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/
## Exigences Ce module Dolibarr ajoute un modèle de facture QR Suisse à Dolibarr ERP/CRM.
Le modèle prend en charge un IBAN traditionnel ou un IBAN QR.
- PHP ≥ 8.1 ## Prérequis
- Dolibarr ≥ 18, compatible jusqu'à 22
Ce module nécessite PHP 8.x et Dolibarr 16. Il est compatible jusqu'à Dolibarr 21.
## Installation ## Installation
@ -84,25 +69,14 @@ Pour plus d'informations : https://www.six-group.com/en/products-services/bankin
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-Rechnung für Dolibarr # Swiss QR Invoice für Dolibarr
Dieses Modul ermöglicht die Erstellung von **Swiss QR-Rechnung** innerhalb von Dolibarr ERP/CRM. Dieser Dolibarr-Modul fügt einen Swiss QR-Rechnungsmodell zu Dolibarr ERP/CRM hinzu.
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. Das Modell unterstützt QR-IBAN oder klassischen IBAN.
Weitere Informationen: https://www.six-group.com/en/products-services/banking-services/payment-standardization/standards/qr-bill.html ## Anforderung
## Funktionen Dieser Modul erfordert PHP 8.x und Dolibarr 16. Kompatibel bis Dolibarr 21.
- 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
@ -113,25 +87,14 @@ Weitere Informationen: https://www.six-group.com/en/products-services/banking-se
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.
# Swiss QR-fattura per Dolibarr # Fattura QR svizzera per Dolibarr
Questo modulo aggiunge supporto per la generazione di **Swiss QR-fattura** all'interno di Dolibarr ERP/CRM. Questo modulo Dolibarr aggiunge un modello di fattura QR Svizzera a Dolibarr ERP/CRM.
Fornisce un modello di fattura aggiuntivo che rispetta lo standard Swiss QR-Bill, rendendo più semplice l'emissione di fatture valide in Svizzera. Il modello supporta IBAN classico o QR-IBAN.
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
- PHP ≥ 8.1 Questo modulo richiede PHP 8.x e Dolibarr 16. Compatibile fino a Dolibarr 21.
- Dolibarr ≥ 18, compatibile fino a 22
## Installazione ## Installazione

View File

@ -1,9 +1,5 @@
#!/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
@ -12,35 +8,9 @@ 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,
$object->account->country_code 'CH'
) )
); );
} else { } else {
@ -112,7 +112,7 @@ class pdf_swissqr extends pdf_sponge
'', '',
$this->emetteur->zip, $this->emetteur->zip,
$this->emetteur->town, $this->emetteur->town,
$this->emetteur->country_code 'CH'
) )
); );
} }
@ -166,35 +166,26 @@ class pdf_swissqr extends pdf_sponge
'', '',
$object->thirdparty->zip, $object->thirdparty->zip,
$object->thirdparty->town, $object->thirdparty->town,
$object->thirdparty->country_code 'CH'
)); ));
// 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);
$amount_credit_notes_included = $object->getSumCreditNotesUsed((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_deposits_included = $object->getSumDepositsUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0); $depositsamount = $object->getSumDepositsUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0);
$total_ttc = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $balance = price2num($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
$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(
$currencyinvoicecode, 'CHF',
$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 = 'https://modules-dolibarr.sinabe.ch/swissqr/versionmodule.txt'; //$this->url_last_version = 'http://www.example.com/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', '', 0, 'current', 1) 1 => array('INVOICE_ADD_SWISS_QR_CODE', 'chaine', 'bottom', '', 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.7", "version": "1.0.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/DASPRiD/Enum.git", "url": "https://github.com/DASPRiD/Enum.git",
"reference": "b5874fa9ed0043116c72162ec7f4fb50e02e7cce" "reference": "8dfd07c6d2cf31c8da90c53b83c026c7696dda90"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/DASPRiD/Enum/zipball/b5874fa9ed0043116c72162ec7f4fb50e02e7cce", "url": "https://api.github.com/repos/DASPRiD/Enum/zipball/8dfd07c6d2cf31c8da90c53b83c026c7696dda90",
"reference": "b5874fa9ed0043116c72162ec7f4fb50e02e7cce", "reference": "8dfd07c6d2cf31c8da90c53b83c026c7696dda90",
"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.7" "source": "https://github.com/DASPRiD/Enum/tree/1.0.6"
}, },
"time": "2025-09-16T12:23:56+00:00" "time": "2024-08-09T14:30:48+00:00"
}, },
{ {
"name": "endroid/qr-code", "name": "endroid/qr-code",
@ -371,16 +371,16 @@
}, },
{ {
"name": "symfony/intl", "name": "symfony/intl",
"version": "v6.4.26", "version": "v6.4.24",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/intl.git", "url": "https://github.com/symfony/intl.git",
"reference": "0cd11e99e8c505f7ee7c6f0ccc8bccb8e14e652f" "reference": "c0938cd29804e65308051a42d1387f0dd57e1eaf"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/intl/zipball/0cd11e99e8c505f7ee7c6f0ccc8bccb8e14e652f", "url": "https://api.github.com/repos/symfony/intl/zipball/c0938cd29804e65308051a42d1387f0dd57e1eaf",
"reference": "0cd11e99e8c505f7ee7c6f0ccc8bccb8e14e652f", "reference": "c0938cd29804e65308051a42d1387f0dd57e1eaf",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -434,7 +434,7 @@
"localization" "localization"
], ],
"support": { "support": {
"source": "https://github.com/symfony/intl/tree/v6.4.26" "source": "https://github.com/symfony/intl/tree/v6.4.24"
}, },
"funding": [ "funding": [
{ {
@ -454,7 +454,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-09-07T21:26:26+00:00" "time": "2025-07-10T08:14:14+00:00"
}, },
{ {
"name": "symfony/polyfill-ctype", "name": "symfony/polyfill-ctype",
@ -872,16 +872,16 @@
}, },
{ {
"name": "symfony/validator", "name": "symfony/validator",
"version": "v6.4.26", "version": "v6.4.24",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/validator.git", "url": "https://github.com/symfony/validator.git",
"reference": "3ed456b3cd04e61fc7ed2601805fee3c1130663a" "reference": "297a24dccf13cc09f1d03207b20807f528f088cc"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/validator/zipball/3ed456b3cd04e61fc7ed2601805fee3c1130663a", "url": "https://api.github.com/repos/symfony/validator/zipball/297a24dccf13cc09f1d03207b20807f528f088cc",
"reference": "3ed456b3cd04e61fc7ed2601805fee3c1130663a", "reference": "297a24dccf13cc09f1d03207b20807f528f088cc",
"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.26" "source": "https://github.com/symfony/validator/tree/v6.4.24"
}, },
"funding": [ "funding": [
{ {
@ -969,7 +969,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-09-25T15:37:27+00:00" "time": "2025-07-29T18:08:45+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 bill for Dolibarr ModuleSwissqrDesc = Swiss QR Invoice for Dolibarr