40 $str = preg_replace(
'/[^A-Z0-9]/',
'',
dol_strtoupper((
string) $str));
42 for ($i = 0; $i < $len; $i++) {
44 if (ctype_digit(
$c)) {
47 $out .= (string) (ord(
$c) - ord(
'A') + 10);
65 return ($check < 10) ?
'0'.$check : (string) $check;
82 $len = strlen($digits);
83 for ($i = 0; $i < $len; $i += 7) {
84 $rest = (int) ($rest.substr($digits, $i, 7)) % 97;
97 return str_replace(
' ',
'', (
string) $ref);
108 return wordwrap((
string) $ref, 4,
' ',
true);
127 $raw =
dol_strtoupper(preg_replace(
'/[^A-Za-z0-9]/',
'', (
string) $payload));
131 dol_syslog(
'dolCreditorRefGenerate: payload "'.$raw.
'" exceeds 21 chars', LOG_WARNING);
136 return 'RF'.dolCreditorRefCheckDigits($raw).$raw;
156 foreach ($parts as $part) {
157 $combined .= preg_replace(
'/[^A-Za-z0-9]/',
'', (
string) $part);
162 dol_syslog(
'dolCreditorRefGenerateFromParts: payload truncated to 21 chars', LOG_WARNING);
202 $ref = trim((
string) $ref);
207 if (strpos($ref,
'+++') === 0) {
dol_strlen($string, $stringencoding='UTF-8', $binarycount=0)
Make a strlen call.
dol_strtoupper($string, $encoding="UTF-8")
Convert a string to upper.
dol_substr($string, $start, $length=null, $stringencoding='', $trunconbytes=0)
Make a substring.
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.
dolCreditorRefGenerateFromParts($parts, $statut)
Generate an ISO 11649 reference from an ordered list of parts.
dolPayRefStrip($ref)
Remove formatting spaces from a payment reference (machine form).
dolCreditorRefAlphaToDigits($str)
Convert an alphanumeric string to its all-digit form for ISO 7064 mod-97.
dolPayRefDetectScheme($ref)
Detect which structured payment reference scheme a stored value belongs to.
dolCreditorRefMod97($digits)
Remainder of a long decimal string divided by 97.
dolCreditorRefGenerate($payload, $statut)
Generate an ISO 11649 Structured Creditor Reference from a payload.
dolPayRefFormat($ref)
Format a payment reference into groups of 4 characters (human form).
dolCreditorRefCheckDigits($raw)
Calculate the two ISO 11649 (ISO 7064 mod-97-10) check digits.