dolibarr 25.0.0-alpha
functions_gr.lib.php File Reference

A set of greek functions for Dolibarr. More...

Go to the source code of this file.

Functions

 dolGRCalculateCreditorReference ($payment_id, $statut, $dias_code='', $usage='')
 Calculate a greek DIAS RF Structured Creditor Reference.
 
 dolGRIsValidDiasCode ($dias_code)
 Check a DIAS creditor code.
 
 dolGRIsAmountCheckedReference ($ref)
 Tell if a greek DIAS reference asks the paying bank for an amount check.
 
 dolGRGetDiasCodeFromReference ($ref)
 Extract the DIAS code from a greek RF reference.
 

Detailed Description

A set of greek functions for Dolibarr.

DIAS Structured Creditor Reference (RF) for invoice payments.

Definition in file functions_gr.lib.php.

Function Documentation

◆ dolGRCalculateCreditorReference()

dolGRCalculateCreditorReference ( $payment_id,
$statut,
$dias_code = '',
$usage = '' )

Calculate a greek DIAS RF Structured Creditor Reference.

Greek RF references routed through the DIAS interbank system follow the RI18 standard of the DIAS DCT Creditor manual (DIAS-ORG02, appendix B). They are always exactly 25 characters:

RF (2) + check digits (2) + DIAS code (5) + code usage (1) + debt code (15) = 25

The DIAS code is the 9nnnn creditor code assigned by DIAS when the company registers through its greek bank. It cannot be chosen freely and must be set in Home - Setup - Company as MAIN_INFO_SOCIETE_DIAS_CODE.

The code usage digit tells the paying bank how to check the payment: 8 same code for credit transfer and direct debit, no amount check 9 separate codes for credit transfer and direct debit, no amount check 0-7 credit transfer with an amount check digit, not produced here Only 8 and 9 are produced, set by MAIN_INFO_SOCIETE_DIAS_CODE_USAGE, 8 by default. A reference with 0 to 7 there would make the bank check the amount against that digit and refuse most payments.

The company controls the 15 digit debt code, left padded with zeros. Depending on the configured mode this is the customer code, the invoice number, or a single fixed company value.

Example with DIAS code 92192, code usage 8 and debt code 3015873: payload = 921928000000003015873 result = RF20921928000000003015873

Parameters
string$payment_idDebt code. Non numeric characters are removed. Only the last 15 digits are kept, where the counter of a reference or a code changes.
int<0,3>$statut Invoice status. Returns '' when lower than 1.
string$dias_codeDIAS code, 5 digits starting with 9. Empty reads the value from MAIN_INFO_SOCIETE_DIAS_CODE.
string$usageCode usage digit, 8 or 9. Empty reads the value from MAIN_INFO_SOCIETE_DIAS_CODE_USAGE.
Returns
string 25 character reference, or '' on error

Definition at line 64 of file functions_gr.lib.php.

References $id, dol_strlen(), dol_substr(), dol_syslog(), dolGRIsValidDiasCode(), and getDolGlobalString().

Referenced by dolPayRefBuild().

◆ dolGRGetDiasCodeFromReference()

dolGRGetDiasCodeFromReference ( $ref)

Extract the DIAS code from a greek RF reference.

Parameters
string$refGreek RF reference
Returns
string 5 digit DIAS code, or '' when the reference is not a greek RF

Definition at line 149 of file functions_gr.lib.php.

References dol_strlen(), and dol_substr().

◆ dolGRIsAmountCheckedReference()

dolGRIsAmountCheckedReference ( $ref)

Tell if a greek DIAS reference asks the paying bank for an amount check.

Digit 10 of a DIAS reference (code usage) set to 0 to 7 is an amount check digit: the paying bank refuses any other amount than the one it was computed from. Such a reference fits one payment of one amount, never a reference reused on several invoices, see the DIAS DCT Creditor manual, appendix B.

Parameters
string$refPayment reference
Returns
bool True for a valid DIAS reference with 0 to 7 at digit 10

Definition at line 128 of file functions_gr.lib.php.

References dol_strlen(), dol_substr(), dolCreditorRefIsValid(), dolGRIsValidDiasCode(), and dolPayRefStrip().

Referenced by dolPayRefBuild(), and dolPayRefGetSetupWarning().

◆ dolGRIsValidDiasCode()

dolGRIsValidDiasCode ( $dias_code)

Check a DIAS creditor code.

DIAS assigns codes of the form 9nnnn, see the DIAS DCT Creditor manual.

Parameters
string$dias_codeCode to check
Returns
bool True when the code is 5 digits starting with 9

Definition at line 112 of file functions_gr.lib.php.

Referenced by dolGRCalculateCreditorReference(), dolGRIsAmountCheckedReference(), and dolPayRefGetSetupWarning().