if (Input\File::isDeletedSingle($file)) { unset($files[$i]); } else { if (Input\File::isUploadedSingle($file) && ($fileId = \CFile::SaveFile(array('MODULE_ID' => 'sale') + $file, 'sale/order/properties/default')) && is_numeric($fileId)) { $file = $fileId; $savedFiles[] = $fileId; } $files[$i] = Input\File::loadInfoSingle($file); } } $property['DEFAULT_VALUE'] = $files; } // prepare property for database & set defaults $propertyForDB = array(); foreach ($commonSettings + $inputSettings + $stringSettings + $locationSettings as $name => $input) { $propertyForDB[$name] = Input\Manager::getValue($input, $property[$name]); } $propertyForDB['SETTINGS'] = array_intersect_key($propertyForDB, $inputSettings); $propertyForDB = array_diff_key($propertyForDB, $propertyForDB['SETTINGS']); // 1. update property if ($propertyId) { $update = OrderPropsTable::update($propertyId, array_diff_key($propertyForDB, array('ID' => 1))); if ($update->isSuccess()) { $propertyCode = ($v = $property['CODE']) ? $v : false; $result = CSaleOrderPropsValue::GetList($b = 'ID', $o = 'ASC', array('ORDER_PROPS_ID' => $propertyId, '!CODE' => $propertyCode)); while ($row = $result->Fetch()) { CSaleOrderPropsValue::Update($row['ID'], array('CODE' => $propertyCode)); } } else { $errors[] = loc::getMessage('ERROR_EDIT_PROP') . ': ' . implode(', ', $update->getErrorMessages()); }