Example #1
0
 protected function __SetOldFields($strAction, &$arFields)
 {
     global $APPLICATION;
     $arMsg = array();
     $boolResult = true;
     $strAction = ToUpper($strAction);
     if (array_key_exists('CONDITIONS', $arFields) && !empty($arFields['CONDITIONS'])) {
         $arConditions = false;
         if (!is_array($arFields['CONDITIONS'])) {
             if (CheckSerializedData($arFields['CONDITIONS'])) {
                 $arConditions = unserialize($arFields['CONDITIONS']);
             }
         } else {
             $arConditions = $arFields['CONDITIONS'];
         }
         if (is_array($arConditions) && !empty($arConditions)) {
             $obCond = new CSaleCondTree();
             $boolCond = $obCond->Init(BT_COND_MODE_SEARCH, BT_COND_BUILD_SALE, array());
             if ($boolCond) {
                 $arResult = $obCond->GetConditionValues($arConditions);
             }
         }
     }
     if (array_key_exists('ACTIONS', $arFields) && !empty($arFields['ACTIONS'])) {
         $arActions = false;
         if (!is_array($arFields['ACTIONS'])) {
             if (CheckSerializedData($arFields['ACTIONS'])) {
                 $arActions = unserialize($arFields['ACTIONS']);
             }
         } else {
             $arActions = $arFields['ACTIONS'];
         }
         if (is_array($arActions) && !empty($arActions)) {
             $obAct = new CSaleActionTree();
             $boolAct = $obAct->Init(BT_COND_MODE_SEARCH, BT_COND_BUILD_SALE_ACTIONS, array());
             if ($boolAct) {
                 $arResult = $obAct->GetConditionValues($arActions);
             }
         }
     }
     if (!$boolResult) {
         $obError = new CAdminException($arMsg);
         $APPLICATION->ThrowException($obError);
     }
     return $boolResult;
 }