67 return 'b_catalog_rounding';
75 public static function getMap(): array
82 'autocomplete' =>
true,
146 [
'=this.CREATED_BY' =>
'ref.ID'],
147 [
'join_type' =>
'LEFT']
152 [
'=this.MODIFIED_BY' =>
'ref.ID'],
153 [
'join_type' =>
'LEFT']
169 $modifyFieldList = [];
178 static::setTimestamp(
187 if (!empty($modifyFieldList))
189 $result->modifyFields($modifyFieldList);
191 unset($modifyFieldList);
204 if (!static::isAllowedClearCache())
209 self::$priceTypeIds[$data[
'CATALOG_GROUP_ID']] = $data[
'CATALOG_GROUP_ID'];
211 static::clearCache();
225 $modifyFieldList = [];
233 static::setTimestamp(
241 if (!empty($modifyFieldList))
243 $result->modifyFields($modifyFieldList);
245 unset($modifyFieldList);
258 if (!static::isAllowedClearCache())
263 $rule = static::getRow([
274 self::$priceTypeIds[$rule[
'CATALOG_GROUP_ID']] = $rule[
'CATALOG_GROUP_ID'];
275 if (isset($data[
'CATALOG_GROUP_ID']))
277 self::$priceTypeIds[$data[
'CATALOG_GROUP_ID']] = $data[
'CATALOG_GROUP_ID'];
291 static::clearCache();
302 if (!static::isAllowedClearCache())
306 $rule = static::getRow([
317 self::$priceTypeIds[$rule[
'CATALOG_GROUP_ID']] = $rule[
'CATALOG_GROUP_ID'];
330 static::clearCache();
340 return (self::$clearCache >= 0);
370 self::$priceTypeIds = array();
381 if (!is_array($priceTypes))
383 $priceTypes = [$priceTypes => $priceTypes];
386 if (!empty($priceTypes) && is_array($priceTypes))
388 self::$priceTypeIds = (
389 empty(self::$priceTypeIds)
391 : array_merge(self::$priceTypeIds, $priceTypes)
403 if (!static::isAllowedClearCache() || empty(self::$priceTypeIds))
407 foreach (self::$priceTypeIds as $priceType)
409 Product\Price::clearRoundRulesCache($priceType);
412 static::clearPriceTypeIds();
423 $priceType = (int)$priceType;
428 $conn = Main\Application::getConnection();
429 $helper = $conn->getSqlHelper();
431 'delete from '.$helper->quote(self::getTableName()).
' where '.$helper->quote(
'CATALOG_GROUP_ID').
' = '.$priceType
433 unset($helper, $conn);
434 Product\Price::clearRoundRulesCache($priceType);
500 protected static function setUserId(array &$result, array $data, array $keys): void
502 static $currentUserID =
false;
503 if ($currentUserID ===
false)
507 $currentUserID = (isset($USER) && $USER instanceof \CUser ? (int)$USER->getID() :
null);
509 foreach ($keys as $index)
512 if (array_key_exists($index, $data))
514 $setField = ($data[$index] !==
null && (int)$data[$index] <= 0);
519 $result[$index] = $currentUserID;
533 protected static function setTimestamp(array &$result, array $data, array $keys): void
535 foreach ($keys as $index)
538 if (array_key_exists($index, $data))
540 $setField = ($data[$index] !==
null && !is_object($data[$index]));
static isAllowedClearCache()
static onAfterUpdate(Event $event)
static clearPriceTypeIds()
static onDelete(Event $event)
static onAfterAdd(Event $event)
static disallowClearCache()
static array $priceTypeIds
static onBeforeAdd(Event $event)
static deleteByPriceType(string|int $priceType)
static getRoundTypes(bool $full=false)
static onAfterDelete(Event $event)
static getPresetRoundingValues()
static setUserId(array &$result, array $data, array $keys)
static setTimestamp(array &$result, array $data, array $keys)
static onBeforeUpdate(Event $event)
static onUpdate(Event $event)
static setPriceTypeIds(string|int|array $priceTypes)
static getMessage($code, $replace=null, $language=null)