CheckFields
boolean CCurrency::CheckFields( $ACTION, &$arFields $strCurrencyID = false );
Verifies currency fields when adding or updating. Non-static method.
Method parameters
Parameter | Description |
---|---|
ACTION | It equals ADD or UPDATE, case sensitive. If the value is in another case, or has another value - false is returned without an error text (exception). If the value equals to UPDATE, then CurrencyID is verified additionally. If the values is empty - an error is returned, if its not empty, then it will be reduced to 3 symbols. |
arFields | Keys:
|
CurrencyID | ID of the updated currency. Optional parameter. |
Returned value
If sucessful, returns true. If an error - returns false. Error text can be received via $APPLICATION->GetException()
.
Examples of use
$arFields = array( 'CURRENCY' => 'руб', 'AMOUNT_CNT' => 1, 'AMOUNT' => 0 ); $boolRes = CCurrency::CheckFields('ADD', $arFields); if (!$boolRes) { if ($ex = $APPLICATION->GetException()) { $strError = $ex->GetString(); ShowError($strError); } } /* Returns errors for CURRENCY and AMOUNT fields */
© «Bitrix24», 2001-2024