Skip to content

Commit

Permalink
Add key 'orgid_sm' to the check and sanitize functions.
Browse files Browse the repository at this point in the history
It is used to validate
GrpHdr > InitgPty > Id > OrgId > Othr > SchmeNm > Prtry
  • Loading branch information
AbcAeffchen committed Sep 7, 2021
1 parent 401bca1 commit 81d05ca
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/SepaUtilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ private static function getValFromMultiDimInput(array &$input, $keys)
* 'ultmtcdtr','ultmtdbtr','rmtinf','orgnldbtracct_iban','iban','bic',
* 'ccy','amendment', 'btchbookg','instdamt','seqtp','lclinstrm',
* 'elctrncsgntr','reqdexctndt','purp','ctgypurp','orgnldbtragt', 'adrline'
* 'ctry', 'dbtrpstladr', 'cdtrpstladr', 'pstladr'
* 'ctry', 'dbtrpstladr', 'cdtrpstladr', 'pstladr', 'orgid_id', 'orgid_sm'
* @param mixed $input
* @param array $options See `checkBIC()`, `checkIBAN()` and `checkLocalInstrument()` for
* details. In addition one can use the key `version`, which is relevant
Expand Down Expand Up @@ -681,6 +681,7 @@ public static function check(string $field, $input, array $options = null)
if(empty($input))
return false; // cannot be empty
case 'ultmtdbtrid':
case 'orgid_sm':
case 'orgid_id':
return ( self::checkLength($input, self::TEXT_LENGTH_VERY_SHORT)
&& self::checkCharset($input) )
Expand Down Expand Up @@ -864,10 +865,11 @@ public static function sanitizeText(int $length, string $input, bool $allowEmpty
}

/**
* Tries to sanitize the the input so it fits in the field.
* Tries to sanitize the input so it fits in the field.
*
* @param string $field Valid fields are: 'ultmtcdtr', 'ultmtdbtr',
* 'orgnlcdtrschmeid_nm', 'initgpty', 'cdtr', 'dbtr', 'rmtinf', 'adrline'
* 'orgid_sm', 'orgid_id'
* @param mixed $input
* @param int $flags Flags used in replaceSpecialChars()
* @return mixed|false The sanitized input or false if the input is not sanitizeable or
Expand All @@ -878,6 +880,7 @@ public static function sanitize(string $field, $input, int $flags = 0)
$field = strtolower($field);
switch($field) // fall-through's are on purpose
{
case 'orgid_sm':
case 'orgid_id':
return self::sanitizeText(self::TEXT_LENGTH_VERY_SHORT, $input, true, $flags);
case 'adrline':
Expand All @@ -888,6 +891,7 @@ public static function sanitize(string $field, $input, int $flags = 0)

return in_array(false, $input, true) ? false : $input;
}
// fallthrough on purpose
case 'ultmtcdrt': // deprecated, just here for backwards compatibility
case 'ultmtcdtr':
case 'ultmtdbtr':
Expand Down

0 comments on commit 81d05ca

Please sign in to comment.