Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
orderround.php
1<?php
3
6Loc::loadMessages(__FILE__);
7
40class OrderRoundTable extends Main\Entity\DataManager
41{
45
51 public static function getTableName()
52 {
53 return 'b_sale_order_round';
54 }
55
61 public static function getMap()
62 {
63 return array(
64 'ID' => new Main\Entity\IntegerField('ID', array(
65 'primary' => true,
66 'autocomplete' => true,
67 'title' => Loc::getMessage('ORDER_ROUND_ENTITY_ID_FIELD')
68 )),
69 'ORDER_ID' => new Main\Entity\IntegerField('ORDER_ID', array(
70 'required' => true,
71 'title' => Loc::getMessage('ORDER_ROUND_ENTITY_ORDER_ID_FIELD')
72 )),
73 'APPLY_BLOCK_COUNTER' => new Main\Entity\IntegerField('APPLY_BLOCK_COUNTER', array(
74 'required' => true,
75 )),
76 'ORDER_ROUND' => new Main\Entity\BooleanField('ORDER_ROUND', array(
77 'required' => true,
78 'values' => array('N', 'Y'),
79 'default_value' => 'Y',
80 'title' => Loc::getMessage('ORDER_ROUND_ENTITY_ORDER_ROUND_FIELD')
81 )),
82 'ENTITY_TYPE' => new Main\Entity\EnumField('ENTITY_TYPE', array(
83 'required' => true,
84 'values' => array(self::ENTITY_TYPE_BASKET_ITEM),
85 'title' => Loc::getMessage('ORDER_ROUND_ENTITY_ENTITY_TYPE_FIELD')
86 )),
87 'ENTITY_ID' => new Main\Entity\IntegerField('ENTITY_ID', array(
88 'required' => true,
89 'title' => Loc::getMessage('ORDER_ROUND_ENTITY_ENTITY_ID_FIELD')
90 )),
91 'ENTITY_VALUE' => new Main\Entity\StringField('ENTITY_VALUE', array(
92 'validation' => array(__CLASS__, 'validateEntityValue'),
93 'title' => Loc::getMessage('ORDER_ROUND_ENTITY_ENTITY_VALUE_FIELD')
94 )),
95 'APPLY' => new Main\Entity\BooleanField('APPLY', array(
96 'required' => true,
97 'values' => array('N', 'Y'),
98 'title' => Loc::getMessage('ORDER_ROUND_ENTITY_APPLY_FIELD')
99 )),
100 'ROUND_RULE' => new Main\Entity\TextField('ROUND_RULE', array(
101 'required' => true,
102 'serialized' => true
103 ))
104 );
105 }
106
112 public static function validateEntityValue()
113 {
114 return array(
115 new Main\Entity\Validator\Length(null, 255),
116 );
117 }
118
125 public static function clearByOrder($order)
126 {
127 $order = (int)$order;
128 if ($order <= 0)
129 return false;
130
131 $conn = Main\Application::getConnection();
132 $helper = $conn->getSqlHelper();
133 $conn->queryExecute('delete from '.$helper->quote(self::getTableName()).' where '.$helper->quote('ORDER_ID').' = '.$order);
134 unset($helper, $conn);
135
136 return true;
137 }
138}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29