Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
order.php
1<?php
3
6Loc::loadMessages(__FILE__);
7
37class OrderTable extends Entity\DataManager
38{
39 public static function getFilePath()
40 {
41 return __FILE__;
42 }
43
44 public static function getTableName()
45 {
46 return 'b_sale_tp_order';
47 }
48
49 public static function getMap()
50 {
51 return array(
52 'ID' => array(
53 'data_type' => 'integer',
54 'primary' => true,
55 'autocomplete' => true,
56 'title' => Loc::getMessage('TRADING_PLATFORM_ORDER_ENTITY_ID_FIELD'),
57 ),
58 'ORDER_ID' => array(
59 'data_type' => 'integer',
60 'required' => true,
61 'title' => Loc::getMessage('TRADING_PLATFORM_ORDER_ENTITY_ORDER_ID_FIELD'),
62 ),
63 'ORDER' => array(
64 'data_type' => '\Bitrix\Sale\Internals\OrderTable',
65 'reference' => array('=this.ORDER_ID' => 'ref.ID'),
66 'title' => Loc::getMessage('TRADING_PLATFORM_ORDER_ENTITY_ORDER_FIELD')
67 ),
68 'EXTERNAL_ORDER_ID' => array(
69 'data_type' => 'string',
70 'required' => true,
71 'validation' => array(__CLASS__, 'validateExternalOrderId'),
72 'title' => Loc::getMessage('TRADING_PLATFORM_ORDER_ENTITY_EXTERNAL_ORDER_ID_FIELD'),
73 ),
74 'PARAMS' => array(
75 'data_type' => 'string',
76 'required' => false,
77 'serialized' => true,
78 'title' => Loc::getMessage('TRADING_PLATFORM_ORDER_ENTITY_PARAMS_FIELD'),
79 ),
80 'TRADING_PLATFORM_ID' => array(
81 'data_type' => 'integer',
82 'required' => true,
83 'title' => Loc::getMessage('TRADING_PLATFORM_ORDER_ENTITY_TRADING_PLATFORM_ID_FIELD'),
84 ),
85 'TRADING_PLATFORM' => array(
86 'data_type' => '\Bitrix\Sale\TradingPlatform',
87 'reference' => array('=this.TRADING_PLATFORM_ID' => 'ref.ID'),
88 'title' => Loc::getMessage('TRADING_PLATFORM_ORDER_ENTITY_TRADING_PLATFORM_FIELD'),
89 ),
90 'XML_ID' => array(
91 'data_type' => 'string',
92 'title' => 'XML_ID',
93 ),);
94 }
95 public static function validateExternalOrderId()
96 {
97 return array(
98 new Entity\Validator\Length(null, 100),
99 );
100 }
101
102 public static function deleteByOrderId($orderId)
103 {
104 $orderId = (int)$orderId;
105
106 if($orderId <= 0)
107 return false;
108
109 $con = \Bitrix\Main\Application::getConnection();
110 $con->queryExecute("DELETE FROM b_sale_tp_order WHERE ORDER_ID=".$orderId);
111 return true;
112 }
113}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29