Bitrix-D7  20.0.0
internals/shipmentitem.php
См. документацию.
1 <?php
2 /**
3  * Bitrix Framework
4  * @package bitrix
5  * @subpackage sale
6  * @copyright 2001-2012 Bitrix
7  */
8 namespace Bitrix\Sale\Internals;
9 
10 use Bitrix\Main;
12 
13 Loc::loadMessages(__FILE__);
14 
15 /**
16  * Class OrderDeliveryBasketTable
17  *
18  * Fields:
19  * <ul>
20  * <li> ID int mandatory
21  * <li> ORDER_DELIVERY_ID int mandatory
22  * <li> BASKET_ID int mandatory
23  * <li> QUANTITY unknown mandatory
24  * <li> RESERVED_QUANTITY unknown mandatory
25  * </ul>
26  *
27  * @package Bitrix\Sale
28  **/
29 
30 class ShipmentItemTable extends Main\Entity\DataManager
31 {
32 
33  /**
34  * Returns path to the file which contains definition of the class.
35  *
36  * @return string
37  */
38  public static function getFilePath()
39  {
40  return __FILE__;
41  }
42 
43 
44  /**
45  * @param $id
46  * @return Main\Entity\DeleteResult
47  * @throws Main\ArgumentException
48  */
49  public static function deleteWithItems($id)
50  {
51  $id = intval($id);
52  if ($id <= 0)
53  throw new Main\ArgumentNullException("id");
54 
55  $itemsFromDbList = ShipmentItemStoreTable::getList(
56  array(
57  "filter" => array(
58  'ORDER_DELIVERY_BASKET_ID' => $id,
59  ),
60  "select" => array("ID")
61  )
62  );
63  while ($itemsFromDbItem = $itemsFromDbList->fetch())
64  ShipmentItemStoreTable::delete($itemsFromDbItem['ID']);
65 
66  return ShipmentItemTable::delete($id);
67  }
68 
69  /**
70  * Returns DB table name for entity.
71  *
72  * @return string
73  */
74  public static function getTableName()
75  {
76  return 'b_sale_order_dlv_basket';
77  }
78 
79  /**
80  * Returns entity map definition.
81  *
82  * @return array
83  */
84  public static function getMap()
85  {
86  global $DB;
87 
88  return array(
89  'ID' => array(
90  'data_type' => 'integer',
91  'primary' => true,
92  'autocomplete' => true,
93  'title' => Loc::getMessage('ORDER_DELIVERY_BASKET_ENTITY_ID_FIELD'),
94  ),
95  'ORDER_DELIVERY_ID' => array(
96  'data_type' => 'integer',
97  'required' => true,
98  'title' => Loc::getMessage('ORDER_DELIVERY_BASKET_ENTITY_ORDER_DELIVERY_ID_FIELD'),
99  ),
100  'DELIVERY' => array(
101  'data_type' => 'Shipment',
102  'reference' => array(
103  '=this.ORDER_DELIVERY_ID' => 'ref.ID'
104  )
105  ),
106  'BASKET_ID' => array(
107  'data_type' => 'integer',
108  'required' => true,
109  'title' => Loc::getMessage('ORDER_DELIVERY_BASKET_ENTITY_BASKET_ID_FIELD'),
110  ),
111  'BASKET' => array(
112  'data_type' => 'Bitrix\Sale\Internals\Basket',
113  'reference' => array(
114  '=this.BASKET_ID' => 'ref.ID'
115  )
116  ),
117  'DATE_INSERT' => array(
118  'data_type' => 'datetime'
119  ),
120  'DATE_INSERT_SHORT' => array(
121  'data_type' => 'datetime',
122  'expression' => array(
123  $DB->datetimeToDateFunction('%s'), 'DATE_INSERT'
124  )
125  ),
126  'QUANTITY' => array(
127  'data_type' => 'float',
128  'required' => true,
129  'title' => Loc::getMessage('ORDER_DELIVERY_BASKET_ENTITY_QUANTITY_FIELD'),
130  ),
131  'RESERVED_QUANTITY' => array(
132  'data_type' => 'float',
133  'required' => true,
134  'title' => Loc::getMessage('ORDER_DELIVERY_BASKET_ENTITY_RESERVED_QUANTITY_FIELD'),
135  ),
136  'XML_ID' => array('data_type' => 'string'),
137  );
138  }
139 }
Bitrix\Sale\Internals\ShipmentItemTable
Definition: internals/shipmentitem.php:30
Bitrix\Sale\Internals\ShipmentItemTable\getFilePath
static getFilePath()
Returns path to the file which contains definition of the class.
Definition: internals/shipmentitem.php:38
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Returns translation by message code.
Definition: loc.php:29
Bitrix\Main
Bitrix\Sale\Internals
Definition: accountnumber.php:3
Bitrix\Sale\Internals\ShipmentItemTable\getTableName
static getTableName()
Returns DB table name for entity.
Definition: internals/shipmentitem.php:74
Bitrix\Main\Localization\Loc
Definition: loc.php:10
Bitrix\Main\ArgumentNullException
Exception is thrown when "empty" value is passed to a function that does not accept it as a valid arg...
Definition: main/lib/exception.php:53
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Loads language messages for specified file in a lazy way.
Definition: loc.php:67
Bitrix\Sale\Internals\ShipmentItemTable\getMap
static getMap()
Returns entity map definition.
Definition: internals/shipmentitem.php:84
Bitrix\Sale\Internals\ShipmentItemTable\deleteWithItems
static deleteWithItems($id)
Definition: internals/shipmentitem.php:49