|
dolibarr 25.0.0-alpha
|
ISO 11649 Structured Creditor Reference (RF) functions. More...
Go to the source code of this file.
Functions | |
| dolCreditorRefAlphaToDigits ($str) | |
| Convert an alphanumeric string to its all-digit form for ISO 7064 mod-97. | |
| dolCreditorRefCheckDigits ($raw) | |
| Calculate the two ISO 11649 (ISO 7064 mod-97-10) check digits. | |
| dolCreditorRefMod97 ($digits) | |
| Remainder of a long decimal string divided by 97. | |
| dolPayRefStrip ($ref) | |
| Remove formatting spaces from a payment reference (machine form). | |
| dolPayRefFormat ($ref) | |
| Format a payment reference into groups of 4 characters (human form). | |
| dolCreditorRefGenerate ($payload, $statut) | |
| Generate an ISO 11649 Structured Creditor Reference from a payload. | |
| dolCreditorRefGenerateFromParts ($parts, $statut) | |
| Generate an ISO 11649 reference from an ordered list of parts. | |
| dolCreditorRefIsValid ($ref) | |
| Check that a string is a valid ISO 11649 Structured Creditor Reference. | |
| dolPayRefDetectScheme ($ref) | |
| Detect which structured payment reference scheme a stored value belongs to. | |
ISO 11649 Structured Creditor Reference (RF) functions.
Shared by all countries that use the RF standard (DE, GR, CH, NL, AT, FI, and any other SEPA country). Country-specific variants live in functions_<cc>.lib.php.
Definition in file functions_creditorref.lib.php.
| dolCreditorRefAlphaToDigits | ( | $str | ) |
Convert an alphanumeric string to its all-digit form for ISO 7064 mod-97.
Letters A-Z map to 10-35. Digits are kept. Anything else is dropped.
| string | $str | Input string |
Definition at line 35 of file functions_creditorref.lib.php.
References $c, dol_strlen(), and dol_strtoupper().
Referenced by dolCreditorRefCheckDigits().
| dolCreditorRefCheckDigits | ( | $raw | ) |
Calculate the two ISO 11649 (ISO 7064 mod-97-10) check digits.
Leading zeros in the payload do not change the result, so a padded and an unpadded payload give the same check digits.
| string | $raw | Raw alphanumeric payload, no spaces |
Definition at line 62 of file functions_creditorref.lib.php.
References dolCreditorRefAlphaToDigits(), and dolCreditorRefMod97().
Referenced by dolCreditorRefIsValid().
| dolCreditorRefGenerate | ( | $payload, | |
| $statut ) |
Generate an ISO 11649 Structured Creditor Reference from a payload.
Result is 'RF' + 2 check digits + payload, at most 25 characters. The payload must be 1 to 21 alphanumeric characters after sanitisation.
| string | $payload | Alphanumeric payload, max 21 chars after cleaning |
| int<0,3> | $statut Object status. Returns '' when lower than 1. |
Definition at line 121 of file functions_creditorref.lib.php.
References dol_strlen(), dol_strtoupper(), and dol_syslog().
Referenced by dolCreditorRefGenerateFromParts(), and dolPayRefBuild().
| dolCreditorRefGenerateFromParts | ( | $parts, | |
| $statut ) |
Generate an ISO 11649 reference from an ordered list of parts.
Parts are cleaned and concatenated in order. The combined payload is truncated to 21 characters if needed.
| string[] | $parts | Ordered parts to combine |
| int<0,3> | $statut Object status |
Definition at line 149 of file functions_creditorref.lib.php.
References dol_strlen(), dol_strtoupper(), dol_substr(), dol_syslog(), and dolCreditorRefGenerate().
Referenced by dolPayRefGenerateForInvoice().
| dolCreditorRefIsValid | ( | $ref | ) |
Check that a string is a valid ISO 11649 Structured Creditor Reference.
| string | $ref | Reference to validate, with or without spaces |
Definition at line 175 of file functions_creditorref.lib.php.
References dol_strlen(), dol_substr(), dolCreditorRefCheckDigits(), and dolPayRefStrip().
Referenced by CompanyBankAccount\checkPaymentReference(), dolGRIsAmountCheckedReference(), dolPayRefBuild(), and dolPayRefGetSetupWarning().
| dolCreditorRefMod97 | ( | $digits | ) |
Remainder of a long decimal string divided by 97.
The numbers used by ISO 7064 are far larger than an integer can hold, so the string is consumed in small pieces and only the remainder is carried over. Pieces of 7 digits keep every intermediate value below 2^31, so this works on a 32 bit build and needs no extension.
| string | $digits | Decimal string, digits only |
Definition at line 79 of file functions_creditorref.lib.php.
Referenced by dolCreditorRefCheckDigits(), and dolFICalculatePaymentReference().
| dolPayRefDetectScheme | ( | $ref | ) |
Detect which structured payment reference scheme a stored value belongs to.
Used by the SEPA XML builder and the QR code builders so no extra database column is needed to remember how a reference was produced.
| string | $ref | Stored payment reference |
Definition at line 200 of file functions_creditorref.lib.php.
References dol_substr(), and dolPayRefStrip().
Referenced by CommonInvoice\buildSwitzerlandQRString(), CompanyBankAccount\checkPaymentReference(), dolPayRefFormatForDisplay(), and BonPrelevement\EnregDestinataireSEPA().
| dolPayRefFormat | ( | $ref | ) |
Format a payment reference into groups of 4 characters (human form).
| string | $ref | Reference without spaces |
Definition at line 106 of file functions_creditorref.lib.php.
Referenced by dolPayRefFormatForDisplay().
| dolPayRefStrip | ( | $ref | ) |
Remove formatting spaces from a payment reference (machine form).
| string | $ref | Reference, with or without spaces |
Definition at line 95 of file functions_creditorref.lib.php.
Referenced by CommonInvoice\buildSwitzerlandQRString(), CompanyBankAccount\cleanPaymentReference(), dolCreditorRefIsValid(), dolGRIsAmountCheckedReference(), dolPayRefBuild(), dolPayRefDetectScheme(), dolPayRefFormatForDisplay(), and BonPrelevement\EnregDestinataireSEPA().