|
dolibarr 25.0.0-alpha
|
Generation of the structured payment reference. More...
Go to the source code of this file.
Functions | |
| dolPayRefGetSchemeForCountry ($country_code) | |
| Return the payment reference scheme to use for a country. | |
| dolPayRefFormatForDisplay ($ref, $country_code='') | |
| Format a payment reference the way its country prints it. | |
| dolPayRefGetSetupWarning ($country_code, $mode='') | |
| Return the setup that is still missing before references can be generated. | |
| dolPayRefBuild ($payment_id, $statut, $country_code, $invoice_type=0) | |
| Build a structured payment reference from a payment id, for a country. | |
| dolPayRefGenerateForInvoice ($object, $user, $store=1) | |
| Generate and optionally store the payment reference of an invoice. | |
| dolPayRefGetThirdpartyBase ($thirdparty) | |
| Return the value a third party builds its payment reference from. | |
| dolPayRefCollectParts ($object) | |
| Collect the ordered parts used to build a per invoice reference. | |
| dolPayRefGetLinkedContractRef ($object) | |
| Return the reference of the first contract linked to an invoice. | |
Generation of the structured payment reference.
Definition in file paymentref.lib.php.
| dolPayRefBuild | ( | $payment_id, | |
| $statut, | |||
| $country_code, | |||
| $invoice_type = 0 ) |
Build a structured payment reference from a payment id, for a country.
This is the single place that maps a country to its national algorithm.
| string | $payment_id | Value to encode. Customer code, invoice number, or a combination, depending on mode. |
| int<0,3> | $statut Invoice status. Returns '' when lower than 1. | |
| string | $country_code | Creditor country code |
| int | $invoice_type | Invoice type, used by the belgian scheme |
Definition at line 154 of file paymentref.lib.php.
References dol_syslog(), dolBECalculateStructuredCommunication(), dolCreditorRefGenerate(), dolCreditorRefIsValid(), dolFICalculatePaymentReference(), dolFIIsValidReference(), dolGRCalculateCreditorReference(), dolGRIsAmountCheckedReference(), dolPayRefGetSchemeForCountry(), and dolPayRefStrip().
Referenced by dolPayRefGenerateForInvoice().
| dolPayRefCollectParts | ( | $object | ) |
Collect the ordered parts used to build a per invoice reference.
Parts are listed in INVOICE_PAYMENT_REF_PARTS as a comma separated list. Accepted values are 'customer_code', 'contract_ref' and 'invoice_ref'.
| CommonObject | $object | Invoice, proposal or order |
Definition at line 350 of file paymentref.lib.php.
References $object, dolPayRefGetLinkedContractRef(), and getDolGlobalString().
Referenced by dolPayRefGenerateForInvoice().
| dolPayRefFormatForDisplay | ( | $ref, | |
| $country_code = '' ) |
Format a payment reference the way its country prints it.
Presentation only. The stored value stays compact, because the QR code, the barcode and the SEPA file all need it unspaced.
| string | $ref | Stored payment reference |
| string | $country_code | Creditor country code |
Definition at line 67 of file paymentref.lib.php.
References dolPayRefDetectScheme(), dolPayRefFormat(), dolPayRefGetSchemeForCountry(), and dolPayRefStrip().
Referenced by pdf_sponge\drawInfoTable().
| dolPayRefGenerateForInvoice | ( | $object, | |
| $user, | |||
| $store = 1 ) |
Generate and optionally store the payment reference of an invoice.
Called from Facture\validate() with $store = 1, and from the invoice card with $store = 0 to show a preview on a draft.
Three modes, set with INVOICE_PAYMENT_REF_MODE in Home - Setup - Invoices:
'company' One fixed reference for the whole company. Every invoice carries the same value, taken from MAIN_INFO_SOCIETE_PAYMENT_ID. 'thirdparty' One stable reference per customer, generated once from the customer code and kept in llx_societe.tp_payment_reference, then reused on every invoice of that customer. 'invoice' One reference per invoice, built from the parts listed in INVOICE_PAYMENT_REF_PARTS.
| CommonObject | $object | Invoice, or a proposal or order used only to preview the reference the invoice will carry. Needs ->ref, ->status, ->type and ->thirdparty. |
| User | $user | User doing the action, for setValueFrom |
| int<0,1> | $store 1 to write to database, 0 for preview only |
Definition at line 233 of file paymentref.lib.php.
References $mysoc, $object, dol_strlen(), dol_syslog(), dolCreditorRefGenerateFromParts(), dolPayRefBuild(), dolPayRefCollectParts(), dolPayRefGetSchemeForCountry(), dolPayRefGetThirdpartyBase(), and getDolGlobalString().
Referenced by Facture\validate().
| dolPayRefGetLinkedContractRef | ( | $object | ) |
Return the reference of the first contract linked to an invoice.
| CommonObject | $object | Invoice, proposal or order, needs ->id and ->db |
Definition at line 385 of file paymentref.lib.php.
References $object, and dol_syslog().
Referenced by dolPayRefCollectParts().
| dolPayRefGetSchemeForCountry | ( | $country_code | ) |
Return the payment reference scheme to use for a country.
The scheme decides which country library builds the reference. It is not a user preference, it follows the national banking rules of the creditor.
| string | $country_code | ISO 3166-1 alpha-2 country code |
Definition at line 34 of file paymentref.lib.php.
References dol_strtoupper().
Referenced by dolPayRefBuild(), dolPayRefFormatForDisplay(), dolPayRefGenerateForInvoice(), and dolPayRefGetSetupWarning().
| dolPayRefGetSetupWarning | ( | $country_code, | |
| $mode = '' ) |
Return the setup that is still missing before references can be generated.
Some schemes need a value that cannot be chosen freely. The greek DIAS code is assigned by the bank, so without it nothing can be produced and the invoice would be validated with an empty reference.
| string | $country_code | Creditor country code |
| string | $mode | Mode to check. Empty checks the stored one, so a setup page can test a mode before saving it. |
Definition at line 98 of file paymentref.lib.php.
References dolCreditorRefIsValid(), dolGRIsAmountCheckedReference(), dolGRIsValidDiasCode(), dolPayRefGetSchemeForCountry(), and getDolGlobalString().
| dolPayRefGetThirdpartyBase | ( | $thirdparty | ) |
Return the value a third party builds its payment reference from.
The field follows INVOICE_PAYMENT_REF_TP_BASE from the setup. A third party that needs a different reference has it written directly on its card instead. The internal id is the last resort so a reference can always be produced.
| Societe | $thirdparty | Third party |
Definition at line 316 of file paymentref.lib.php.
References getDolGlobalString().
Referenced by dolPayRefGenerateForInvoice().