Exemplo n.º 1
0
 /**
  * Validate and modify exist property.
  *
  * @param string $propertyCode			Property code.
  * @param array $property				Current property data.
  * @return bool
  * @throws Exception
  */
 protected static function validateExistProperty($propertyCode, $property)
 {
     $result = true;
     switch ($propertyCode) {
         case self::CODE_SKU_LINK:
             $fields = array();
             if ($property['USER_TYPE'] != self::USER_TYPE_SKU_LINK) {
                 $fields['USER_TYPE'] = self::USER_TYPE_SKU_LINK;
             }
             if ($property['XML_ID'] != self::XML_SKU_LINK) {
                 $fields['XML_ID'] = self::XML_SKU_LINK;
             }
             if (!empty($fields)) {
                 $propertyResult = Iblock\PropertyTable::update($property['ID'], $fields);
                 if (!$propertyResult->isSuccess()) {
                     self::$errors = $propertyResult->getErrorMessages();
                     $result = false;
                 }
                 unset($propertyResult);
             }
             unset($fields);
             break;
     }
     return $result;
 }