70 if (!function_exists(
'dolCreditorRefCheckDigits')) {
71 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions_creditorref.lib.php';
74 if ($dias_code ===
'') {
77 $dias_code = preg_replace(
'/[^0-9]/',
'', (
string) $dias_code);
80 dol_syslog(
'dolGRCalculateCreditorReference: MAIN_INFO_SOCIETE_DIAS_CODE must be 5 digits starting with 9, got "'.$dias_code.
'"', LOG_WARNING);
87 if (!in_array((
string) $usage, array(
'8',
'9'),
true)) {
88 dol_syslog(
'dolGRCalculateCreditorReference: code usage must be 8 or 9, got "'.$usage.
'", 8 is used', LOG_WARNING);
92 $id = ltrim(preg_replace(
'/[^0-9]/',
'', (
string) $payment_id),
'0');
95 dol_syslog(
'dolGRCalculateCreditorReference: debt code "'.
$id.
'" exceeds 15 digits, only the last 15 are kept', LOG_WARNING);
99 $payload = $dias_code.$usage.str_pad(
$id, 15,
'0', STR_PAD_LEFT);
101 return 'RF'.dolCreditorRefCheckDigits($payload).$payload;
114 return (
bool) preg_match(
'/^9[0-9]{4}$/', (
string) $dias_code);
130 if (!function_exists(
'dolCreditorRefIsValid')) {
131 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions_creditorref.lib.php';
140 return (
bool) preg_match(
'/^[0-7]$/',
dol_substr($ref, 9, 1));
151 $ref = str_replace(
' ',
'', (
string) $ref);
$id
Support class for third parties, contacts, members, users or resources.
dol_strlen($string, $stringencoding='UTF-8', $binarycount=0)
Make a strlen call.
dol_substr($string, $start, $length=null, $stringencoding='', $trunconbytes=0)
Make a substring.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dolCreditorRefIsValid($ref)
Check that a string is a valid ISO 11649 Structured Creditor Reference.
dolPayRefStrip($ref)
Remove formatting spaces from a payment reference (machine form).
dolGRGetDiasCodeFromReference($ref)
Extract the DIAS code from a greek RF reference.
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.