116 'autocomplete' =>
true,
120 'validation' => array(__CLASS__,
'validateXmlId'),
125 'validation' => array(__CLASS__,
'validateSiteId'),
130 'default_value' => self::TYPE_DISCOUNT,
131 'validation' => array(__CLASS__,
'validateType'),
135 'values' => array(
'N',
'Y'),
136 'default_value' =>
'Y',
140 'default_value' =>
null,
144 'default_value' =>
null,
148 'values' => array(
'N',
'Y'),
149 'default_value' =>
'N',
154 'validation' => array(__CLASS__,
'validateName'),
165 'values' => array(self::VALUE_TYPE_PERCENT, self::VALUE_TYPE_FIX, self::VALUE_TYPE_SALE),
166 'default_value' => self::VALUE_TYPE_PERCENT,
175 'validation' => array(__CLASS__,
'validateCurrency'),
180 'default_value' =>
function()
186 'COUNT_PERIOD' =>
new Main\Entity\EnumField(
'COUNT_PERIOD', array(
187 'values' => array(self::COUNT_PERIOD_TYPE_ALL, self::COUNT_PERIOD_TYPE_INTERVAL, self::COUNT_PERIOD_TYPE_PERIOD),
188 'default_value' => self::COUNT_PERIOD_TYPE_ALL
190 'COUNT_SIZE' =>
new Main\Entity\IntegerField(
'COUNT_SIZE', array(
193 'COUNT_TYPE' =>
new Main\Entity\EnumField(
'COUNT_TYPE', array(
194 'values' => array(self::COUNT_TYPE_SIZE_DAY, self::COUNT_TYPE_SIZE_MONTH, self::COUNT_TYPE_SIZE_YEAR),
195 'default_value' => self::COUNT_TYPE_SIZE_YEAR
197 'COUNT_FROM' =>
new Main\Entity\DatetimeField(
'COUNT_FROM', array(
198 'default_value' =>
null
200 'COUNT_TO' =>
new Main\Entity\DatetimeField(
'COUNT_TO', array(
201 'default_value' =>
null
203 'ACTION_SIZE' =>
new Main\Entity\IntegerField(
'ACTION_SIZE', array(
206 'ACTION_TYPE' =>
new Main\Entity\EnumField(
'ACTION_TYPE', array(
207 'values' => array(self::ACTION_TYPE_SIZE_DAY, self::ACTION_TYPE_SIZE_MONTH, self::ACTION_TYPE_SIZE_YEAR),
208 'default_value' => self::ACTION_TYPE_SIZE_YEAR
210 'MODIFIED_BY' =>
new Main\Entity\IntegerField(
'MODIFIED_BY', array(
213 'DATE_CREATE' =>
new Main\Entity\DatetimeField(
'DATE_CREATE', array(
214 'default_value' =>
null,
217 'CREATED_BY' =>
new Main\Entity\IntegerField(
'CREATED_BY', array(
220 'PRIORITY' =>
new Main\Entity\IntegerField(
'PRIORITY', array(
221 'default_value' => 1,
224 'LAST_DISCOUNT' =>
new Main\Entity\BooleanField(
'LAST_DISCOUNT', array(
225 'values' => array(
'N',
'Y'),
226 'default_value' =>
'Y',
229 'VERSION' =>
new Main\Entity\EnumField(
'VERSION', array(
230 'values' => array(self::OLD_VERSION, self::ACTUAL_VERSION),
231 'default_value' => self::ACTUAL_VERSION
233 'NOTES' =>
new Main\Entity\StringField(
'NOTES', array(
234 'validation' => array(__CLASS__,
'validateNotes'),
237 'CONDITIONS' =>
new Main\Entity\TextField(
'CONDITIONS', array()),
238 'CONDITIONS_LIST' =>
new Main\Entity\TextField(
'CONDITIONS_LIST', array(
239 'serialized' =>
true,
240 'column_name' =>
'CONDITIONS',
243 'UNPACK' =>
new Main\Entity\TextField(
'UNPACK', array()),
244 'USE_COUPONS' =>
new Main\Entity\BooleanField(
'USE_COUPONS', array(
245 'values' => array(
'N',
'Y'),
246 'default_value' =>
'N',
249 'SALE_ID' =>
new Main\Entity\IntegerField(
'SALE_ID'),
250 'CREATED_BY_USER' =>
new Main\Entity\ReferenceField(
253 array(
'=this.CREATED_BY' =>
'ref.ID')
255 'MODIFIED_BY_USER' =>
new Main\Entity\ReferenceField(
258 array(
'=this.MODIFIED_BY' =>
'ref.ID')
260 'SALE_DISCOUNT' =>
new Main\Entity\ReferenceField(
262 'Bitrix\Sale\Internals\DiscountTable',
263 array(
'=this.SALE_ID' =>
'ref.ID')
444 if (!is_array($discountList))
445 $discountList = array($discountList);
447 if ($use !==
'Y' && $use !==
'N')
449 Main\Type\Collection::normalizeArrayValuesByInt($discountList);
450 if (empty($discountList))
452 $conn = Main\Application::getConnection();
453 $helper = $conn->getSqlHelper();
455 'update '.$helper->quote(self::getTableName()).
456 ' set '.$helper->quote(
'USE_COUPONS').
' = \''.$use.
'\' where
'.
457 $helper->quote('ID
').' in (
'.implode(',
', $discountList).')
'
459 unset($helper, $conn);