Documentation

CheckFields

Description and parameters

boolean
CCatalogDiscountCoupon::CheckFields (
string $ACTION,
array &$arFields,
int $ID = 0
);

Method checks (and correct, if possible) parameters, passed to methods CCatalogDiscountCoupon::Add and CCatalogDiscountCoupon::Update. Non-static method.

Call parameters

Parameter Description
ACTION specifies the method to be checked. Possible values:
arFields Associative array with coupon parameters. Array is passed by link and its values can be updated by the method.
Available keys:
  • DISCOUNT_ID - discount (ID) code;
  • ACTIVE - coupon active (Y/N);
  • ONE_TIME - single use coupon (Y|N);
  • COUPON - coupon code;
  • DATE_APPLY - date of applied coupon;
  • DESCRIPTION - comment.
ID Coupon (ID) code (only for CCatalogDiscountCoupon::Update).

Returned value

In case of passed parameters are correct, returns true, otherwise - false. In case method returns false, you can get error text via $APPLICATION->GetException().

Required checks

  • for CCatalogDiscountCoupon::Add
    • field DISCOUNT_ID is available and contains code (ID) for existing discount;
    • if the field ACTIVE doesn't exist or equals to N, assigned as Y;
    • if the field ONE_TIME doesn't exist or doesn't equal to N, assigned as Y;
    • field COUPON exists and contains unique code, missing in the coupon list;
    • if the field DATE_APPLY doesn't exist or doesn't contain correct date, its assigned as false.

  • for CCatalogDiscountCoupon::Update
    • if the field DISCOUNT_ID is available, it must contain code (ID) of existing discount;
    • if the field ACTIVE exists and isn't equal to N, its assigned as Y;
    • if the field ONE_TIME exists and isn't equal to N, its assigned as Y;
    • if the field COUPON exists and contains unique code, specified only for this coupon (with such ID);
    • if the field DATE_APPLY exists and contains incorrect date, its assigned as false false.

See Also



© «Bitrix24», 2001-2024
Up