static function getMap()
{
return array(
'ID' => new MainEntityIntegerField('ID', array(
'primary' => true,
'autocomplete' => true,
'title' => Loc::getMessage('DISCOUNT_ENTITY_ID_FIELD')
)),
'XML_ID' => new MainEntityStringField('XML_ID', array(
'validation' => array(__CLASS__, 'validateXmlId'),
'title' => Loc::getMessage('DISCOUNT_ENTITY_XML_ID_FIELD')
)),
'SITE_ID' => new MainEntityStringField('SITE_ID', array(
'required' => true,
'validation' => array(__CLASS__, 'validateSiteId'),
'title' => Loc::getMessage('DISCOUNT_ENTITY_SITE_ID_FIELD')
)),
'TYPE' => new MainEntityIntegerField('TYPE', array(
'required' => true,
'default_value' => self::TYPE_DISCOUNT,
'validation' => array(__CLASS__, 'validateType'),
'title' => Loc::getMessage('DISCOUNT_ENTITY_TYPE_FIELD')
)),
'ACTIVE' => new MainEntityBooleanField('ACTIVE', array(
'values' => array('N', 'Y'),
'default_value' => 'Y',
'title' => Loc::getMessage('DISCOUNT_ENTITY_ACTIVE_FIELD')
)),
'ACTIVE_FROM' => new MainEntityDatetimeField('ACTIVE_FROM', array(
'default_value' => null,
'title' => Loc::getMessage('DISCOUNT_ENTITY_ACTIVE_FROM_FIELD')
)),
'ACTIVE_TO' => new MainEntityDatetimeField('ACTIVE_TO', array(
'default_value' => null,
'title' => Loc::getMessage('DISCOUNT_ENTITY_ACTIVE_TO_FIELD')
)),
'RENEWAL' => new MainEntityBooleanField('RENEWAL', array(
'values' => array('N', 'Y'),
'default_value' => 'N',
'title' => Loc::getMessage('DISCOUNT_ENTITY_RENEWAL_FIELD')
)),
'NAME' => new MainEntityStringField('NAME', array(
'required' => true,
'validation' => array(__CLASS__, 'validateName'),
'title' => Loc::getMessage('DISCOUNT_ENTITY_NAME_FIELD')
)),
'SORT' => new MainEntityIntegerField('SORT', array(
'title' => Loc::getMessage('DISCOUNT_ENTITY_SORT_FIELD')
)),
'MAX_DISCOUNT' => new MainEntityFloatField('MAX_DISCOUNT', array(
'title' => Loc::getMessage('DISCOUNT_ENTITY_MAX_DISCOUNT_FIELD')
)),
'VALUE_TYPE' => new MainEntityEnumField('VALUE_TYPE', array(
'required' => true,
'values' => array(self::VALUE_TYPE_PERCENT, self::VALUE_TYPE_FIX, self::VALUE_TYPE_SALE),
'default_value' => self::VALUE_TYPE_PERCENT,
'title' => Loc::getMessage('DISCOUNT_ENTITY_VALUE_TYPE_FIELD')
)),
'VALUE' => new MainEntityFloatField('VALUE', array(
'required' => true,
'title' => Loc::getMessage('DISCOUNT_ENTITY_VALUE_FIELD')
)),
'CURRENCY' => new MainEntityStringField('CURRENCY', array(
'required' => true,
'validation' => array(__CLASS__, 'validateCurrency'),
'title' => Loc::getMessage('DISCOUNT_ENTITY_CURRENCY_FIELD')
)),
'TIMESTAMP_X' => new MainEntityDatetimeField('TIMESTAMP_X', array(
'required' => true,
'default_value' => function()
{
return new MainTypeDateTime();
},
'title' => Loc::getMessage('DISCOUNT_ENTITY_TIMESTAMP_X_FIELD')
)),
'COUNT_PERIOD' => new MainEntityEnumField('COUNT_PERIOD', array(
'values' => array(self::COUNT_PERIOD_TYPE_ALL, self::COUNT_PERIOD_TYPE_INTERVAL, self::COUNT_PERIOD_TYPE_PERIOD),
'default_value' => self::COUNT_PERIOD_TYPE_ALL
)),
'COUNT_SIZE' => new MainEntityIntegerField('COUNT_SIZE', array(
'default_value' => 0
)),
'COUNT_TYPE' => new MainEntityEnumField('COUNT_TYPE', array(
'values' => array(self::COUNT_TYPE_SIZE_DAY, self::COUNT_TYPE_SIZE_MONTH, self::COUNT_TYPE_SIZE_YEAR),
'default_value' => self::COUNT_TYPE_SIZE_YEAR
)),
'COUNT_FROM' => new MainEntityDatetimeField('COUNT_FROM', array(
'default_value' => null
)),
'COUNT_TO' => new MainEntityDatetimeField('COUNT_TO', array(
'default_value' => null
)),
'ACTION_SIZE' => new MainEntityIntegerField('ACTION_SIZE', array(
'default_value' => 0
)),
'ACTION_TYPE' => new MainEntityEnumField('ACTION_TYPE', array(
'values' => array(self::ACTION_TYPE_SIZE_DAY, self::ACTION_TYPE_SIZE_MONTH, self::ACTION_TYPE_SIZE_YEAR),
'default_value' => self::ACTION_TYPE_SIZE_YEAR
)),
'MODIFIED_BY' => new MainEntityIntegerField('MODIFIED_BY', array(
'title' => Loc::getMessage('DISCOUNT_ENTITY_MODIFIED_BY_FIELD')
)),
'DATE_CREATE' => new MainEntityDatetimeField('DATE_CREATE', array(
'default_value' => null,
'title' => Loc::getMessage('DISCOUNT_ENTITY_DATE_CREATE_FIELD')
)),
'CREATED_BY' => new MainEntityIntegerField('CREATED_BY', array(
'title' => Loc::getMessage('DISCOUNT_ENTITY_CREATED_BY_FIELD')
)),
'PRIORITY' => new MainEntityIntegerField('PRIORITY', array(
'default_value' => 1,
'title' => Loc::getMessage('DISCOUNT_ENTITY_PRIORITY_FIELD')
)),
'LAST_DISCOUNT' => new MainEntityBooleanField('LAST_DISCOUNT', array(
'values' => array('N', 'Y'),
'default_value' => 'Y',
'title' => Loc::getMessage('DISCOUNT_ENTITY_LAST_DISCOUNT_FIELD')
)),
'VERSION' => new MainEntityEnumField('VERSION', array(
'values' => array(self::OLD_VERSION, self::ACTUAL_VERSION),
'default_value' => self::ACTUAL_VERSION
)),
'NOTES' => new MainEntityStringField('NOTES', array(
'validation' => array(__CLASS__, 'validateNotes'),
'title' => Loc::getMessage('DISCOUNT_ENTITY_NOTES_FIELD')
)),
'CONDITIONS' => new MainEntityTextField('CONDITIONS', array()),
'CONDITIONS_LIST' => new MainEntityTextField('CONDITIONS_LIST', array(
'serialized' => true,
'column_name' => 'CONDITIONS',
'title' => Loc::getMessage('DISCOUNT_ENTITY_CONDITIONS_LIST_FIELD')
)),
'UNPACK' => new MainEntityTextField('UNPACK', array()),
'USE_COUPONS' => new MainEntityBooleanField('USE_COUPONS', array(
'values' => array('N', 'Y'),
'default_value' => 'N',
'title' => Loc::getMessage('DISCOUNT_ENTITY_USE_COUPONS_FIELD')
)),
'SALE_ID' => new MainEntityIntegerField('SALE_ID'),
'CREATED_BY_USER' => new MainEntityReferenceField(
'CREATED_BY_USER',
'BitrixMainUser',
array('=this.CREATED_BY' => 'ref.ID')
),
'MODIFIED_BY_USER' => new MainEntityReferenceField(
'MODIFIED_BY_USER',
'BitrixMainUser',
array('=this.MODIFIED_BY' => 'ref.ID')
),
'SALE_DISCOUNT' => new MainEntityReferenceField(
'SALE_DISCOUNT',
'BitrixSaleInternalsDiscountTable',
array('=this.SALE_ID' => 'ref.ID')
)
);
}