コード例 #1
0
 function checkQuantityCond($arConditions)
 {
     $bOk = false;
     $arCheckValues = array();
     $arCheckQuantityValue = array();
     foreach ($arConditions["CHILDREN"] as $child) {
         if (strlen($child["CLASS_ID"]) > 0 && !empty($child["DATA"])) {
             switch ($child["CLASS_ID"]) {
                 case 'CondQuantityValue':
                     $arCheckQuantityValue = $child["DATA"];
                     break;
                 default:
                     $arCheckValues[] = $child;
                     break;
             }
         }
     }
     $trueEventCounter = 0;
     $needTrueEvent = count($arConditions["CHILDREN"]) - 1;
     if (!empty($arCheckValues) && !empty($arCheckValues)) {
         foreach ($arCheckValues as $child) {
             switch ($child["CLASS_ID"]) {
                 case "CondIBElementProperty":
                     if (CFoodclubEventCompare::compareConditions(array("compareArrayKey" => array($this->_fields["PROPERTY_VALUES"], $child["DATA"]["logic"], $child["DATA"]["value"]), "compare" => array($arCheckQuantityValue["value"], $arCheckQuantityValue["logic"], $this->_fields["PROPERTY_VALUES"][$child["DATA"]["value"]])), $arConditions["DATA"])) {
                         $trueEventCounter++;
                     }
                     break;
                 case "CondUserProperty":
                     $user_props = self::getUserEntityFields();
                     if (CFoodclubEventCompare::compareConditions(array("compareArrayKey" => array($this->_fields, $child["DATA"]["logic"], $user_props[$child["DATA"]["value"]]["FIELD_NAME"]), "compareString" => array($arCheckQuantityValue["value"], $arCheckQuantityValue["logic"], $this->_fields[$user_props[$child["DATA"]["value"]]["FIELD_NAME"]])), $arConditions["DATA"])) {
                         $trueEventCounter++;
                     }
                     break;
             }
         }
         $bOk = CFoodclubEventCompare::checkLogic($arConditions["DATA"], $trueEventCounter, $needTrueEvent);
     }
     return $bOk;
 }