Skip to content

Commit 81d05ca

Browse files
committed
Add key 'orgid_sm' to the check and sanitize functions.
It is used to validate GrpHdr > InitgPty > Id > OrgId > Othr > SchmeNm > Prtry
1 parent 401bca1 commit 81d05ca

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/SepaUtilities.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ private static function getValFromMultiDimInput(array &$input, $keys)
643643
* 'ultmtcdtr','ultmtdbtr','rmtinf','orgnldbtracct_iban','iban','bic',
644644
* 'ccy','amendment', 'btchbookg','instdamt','seqtp','lclinstrm',
645645
* 'elctrncsgntr','reqdexctndt','purp','ctgypurp','orgnldbtragt', 'adrline'
646-
* 'ctry', 'dbtrpstladr', 'cdtrpstladr', 'pstladr'
646+
* 'ctry', 'dbtrpstladr', 'cdtrpstladr', 'pstladr', 'orgid_id', 'orgid_sm'
647647
* @param mixed $input
648648
* @param array $options See `checkBIC()`, `checkIBAN()` and `checkLocalInstrument()` for
649649
* details. In addition one can use the key `version`, which is relevant
@@ -681,6 +681,7 @@ public static function check(string $field, $input, array $options = null)
681681
if(empty($input))
682682
return false; // cannot be empty
683683
case 'ultmtdbtrid':
684+
case 'orgid_sm':
684685
case 'orgid_id':
685686
return ( self::checkLength($input, self::TEXT_LENGTH_VERY_SHORT)
686687
&& self::checkCharset($input) )
@@ -864,10 +865,11 @@ public static function sanitizeText(int $length, string $input, bool $allowEmpty
864865
}
865866

866867
/**
867-
* Tries to sanitize the the input so it fits in the field.
868+
* Tries to sanitize the input so it fits in the field.
868869
*
869870
* @param string $field Valid fields are: 'ultmtcdtr', 'ultmtdbtr',
870871
* 'orgnlcdtrschmeid_nm', 'initgpty', 'cdtr', 'dbtr', 'rmtinf', 'adrline'
872+
* 'orgid_sm', 'orgid_id'
871873
* @param mixed $input
872874
* @param int $flags Flags used in replaceSpecialChars()
873875
* @return mixed|false The sanitized input or false if the input is not sanitizeable or
@@ -878,6 +880,7 @@ public static function sanitize(string $field, $input, int $flags = 0)
878880
$field = strtolower($field);
879881
switch($field) // fall-through's are on purpose
880882
{
883+
case 'orgid_sm':
881884
case 'orgid_id':
882885
return self::sanitizeText(self::TEXT_LENGTH_VERY_SHORT, $input, true, $flags);
883886
case 'adrline':
@@ -888,6 +891,7 @@ public static function sanitize(string $field, $input, int $flags = 0)
888891

889892
return in_array(false, $input, true) ? false : $input;
890893
}
894+
// fallthrough on purpose
891895
case 'ultmtcdrt': // deprecated, just here for backwards compatibility
892896
case 'ultmtcdtr':
893897
case 'ultmtdbtr':

0 commit comments

Comments
 (0)