mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge branch '16.0' of git@github.com:Dolibarr/dolibarr.git into 17.0
This commit is contained in:
commit
3069a97a46
|
|
@ -24,6 +24,6 @@ Method to encode/decode ZATCA string is available in test/phpunit/BarcodeTest.ph
|
|||
|
||||
* FOR QR-Bill in switzerland
|
||||
----------------------------
|
||||
Syntax of QR Code https://www.swiss-qr-invoice.org/fr/
|
||||
Syntax of QR Code - See file ig-qr-bill-v2.2-fr.pdf (more doc on https://www.swiss-qr-invoice.org/downloads/)
|
||||
Syntax of complentary field named "structured information of invoice S1": https://www.swiss-qr-invoice.org/downloads/qr-bill-s1-syntax-fr.pdf
|
||||
To test/validate: https://www.swiss-qr-invoice.org/validator/
|
||||
|
|
|
|||
71291
dev/resources/iso-normes/qr-bar-codes/ig-qr-bill-v2.2-fr.pdf
Normal file
71291
dev/resources/iso-normes/qr-bar-codes/ig-qr-bill-v2.2-fr.pdf
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -1760,30 +1760,44 @@ abstract class CommonInvoice extends CommonObject
|
|||
$complementaryinfo .= '/30/'.$this->thirdparty->tva_intra;
|
||||
}
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
$bankaccount = new Account($this->db);
|
||||
|
||||
// Header
|
||||
$s = '';
|
||||
$s .= "SPC\n";
|
||||
$s .= "0200\n";
|
||||
$s .= "1\n";
|
||||
// Info Seller ("Compte / Payable à")
|
||||
if ($this->fk_account > 0) {
|
||||
// Bank BAN if country is LI or CH
|
||||
// TODO Add
|
||||
$bankaccount = new Account($this->db);
|
||||
// Bank BAN if country is LI or CH. TODO Add a test to check than IBAN start with CH or LI
|
||||
$bankaccount->fetch($this->fk_account);
|
||||
$s .= $bankaccount->iban."\n";
|
||||
} else {
|
||||
$s .= "\n";
|
||||
}
|
||||
// Seller
|
||||
$s .= "S\n";
|
||||
$s .= dol_trunc($mysoc->name, 70, 'right', 'UTF-8', 1)."\n";
|
||||
$addresslinearray = explode("\n", $mysoc->address);
|
||||
$s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1
|
||||
$s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2
|
||||
$s .= dol_trunc($mysoc->zip, 16, 'right', 'UTF-8', 1)."\n";
|
||||
$s .= dol_trunc($mysoc->town, 35, 'right', 'UTF-8', 1)."\n";
|
||||
$s .= dol_trunc($mysoc->country_code, 2, 'right', 'UTF-8', 1)."\n";
|
||||
// Final seller
|
||||
if ($bankaccount->id > 0 && getDolGlobalString('PDF_SWISS_QRCODE_USE_OWNER_OF_ACCOUNT_AS_CREDITOR')) {
|
||||
// If a bank account is prodived and we ask to use it as creditor, we use the bank address
|
||||
// TODO In a future, we may always use this address, and if name/address/zip/town/country differs from $mysoc, we can use the address of $mysoc into the final seller field ?
|
||||
$s .= "S\n";
|
||||
$s .= dol_trunc($bankaccount->proprio, 70, 'right', 'UTF-8', 1)."\n";
|
||||
$addresslinearray = explode("\n", $bankaccount->owner_address);
|
||||
$s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1
|
||||
$s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2
|
||||
/*$s .= dol_trunc($mysoc->zip, 16, 'right', 'UTF-8', 1)."\n";
|
||||
$s .= dol_trunc($mysoc->town, 35, 'right', 'UTF-8', 1)."\n";
|
||||
$s .= dol_trunc($mysoc->country_code, 2, 'right', 'UTF-8', 1)."\n";*/
|
||||
} else {
|
||||
$s .= "S\n";
|
||||
$s .= dol_trunc($mysoc->name, 70, 'right', 'UTF-8', 1)."\n";
|
||||
$addresslinearray = explode("\n", $mysoc->address);
|
||||
$s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1
|
||||
$s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2
|
||||
$s .= dol_trunc($mysoc->zip, 16, 'right', 'UTF-8', 1)."\n";
|
||||
$s .= dol_trunc($mysoc->town, 35, 'right', 'UTF-8', 1)."\n";
|
||||
$s .= dol_trunc($mysoc->country_code, 2, 'right', 'UTF-8', 1)."\n";
|
||||
}
|
||||
// Final seller (Ultimate seller) ("Créancier final" = "En faveur de")
|
||||
$s .= "\n";
|
||||
$s .= "\n";
|
||||
$s .= "\n";
|
||||
|
|
@ -1805,13 +1819,18 @@ abstract class CommonInvoice extends CommonObject
|
|||
$s .= dol_trunc($this->thirdparty->country_code, 2, 'right', 'UTF-8', 1)."\n";
|
||||
// ID of payment
|
||||
$s .= "NON\n"; // NON or QRR
|
||||
$s .= "\n"; // QR Code if previous field is QRR
|
||||
$s .= "\n"; // QR Code reference if previous field is QRR
|
||||
// Free text
|
||||
if ($complementaryinfo) {
|
||||
$s .= $complementaryinfo."\n";
|
||||
} else {
|
||||
$s .= "\n";
|
||||
}
|
||||
$s .= "EPD\n";
|
||||
// More text, complementary info
|
||||
if ($complementaryinfo) {
|
||||
$s .= $complementaryinfo."\n";
|
||||
}
|
||||
$s .= "\n";
|
||||
//var_dump($s);exit;
|
||||
return $s;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user