Bitrix-D7  20.5.0
shipmentextraservice.php
См. документацию.
1 <?php
2 namespace Bitrix\Sale\Internals;
3 
4 use Bitrix\Main;
6 Loc::loadMessages(__FILE__);
7 
8 /**
9  * Class ShipmentExtraServiceTable
10  *
11  * Fields:
12  * <ul>
13  * <li> ID int mandatory
14  * <li> SHIPMENT_ID int mandatory
15  * <li> EXTRA_SERVICE_ID int mandatory
16  * <li> VALUE string(255) optional
17  * </ul>
18  *
19  * @package Bitrix\Sale\Internals
20  **/
21 
22 class ShipmentExtraServiceTable extends Main\Entity\DataManager
23 {
24  public static function getFilePath()
25  {
26  return __FILE__;
27  }
28 
29  public static function getTableName()
30  {
31  return 'b_sale_order_delivery_es';
32  }
33 
34  public static function getMap()
35  {
36  return array(
37  'ID' => array(
38  'data_type' => 'integer',
39  'primary' => true,
40  'autocomplete' => true,
41  'title' => Loc::getMessage('ORDER_DELIVERY_EXTRA_SERVICES_ENTITY_ID_FIELD'),
42  ),
43  'SHIPMENT_ID' => array(
44  'data_type' => 'integer',
45  'required' => true,
46  'title' => Loc::getMessage('ORDER_DELIVERY_EXTRA_SERVICES_ENTITY_SHIPMENT_ID_FIELD'),
47  ),
48  'EXTRA_SERVICE_ID' => array(
49  'data_type' => 'integer',
50  'required' => true,
51  'title' => Loc::getMessage('ORDER_DELIVERY_EXTRA_SERVICES_ENTITY_EXTRA_SERVICE_ID_FIELD'),
52  ),
53  'VALUE' => array(
54  'data_type' => 'string',
55  'validation' => array(__CLASS__, 'validateValue'),
56  'title' => Loc::getMessage('ORDER_DELIVERY_EXTRA_SERVICES_ENTITY_VALUE_FIELD'),
57  ),
58  );
59  }
60  public static function validateValue()
61  {
62  return array(
63  new Main\Entity\Validator\Length(null, 255),
64  );
65  }
66 
67  public static function deleteByShipmentId($shipmentId)
68  {
69  if(intval($shipmentId) > 0)
70  {
72  $sqlHelper = $con->getSqlHelper();
73  $strSql = "DELETE FROM ".self::getTableName()." WHERE SHIPMENT_ID=".$sqlHelper->forSql($shipmentId);
74  $con->queryExecute($strSql);
75  }
76  }
77 }
static getConnection($name="")
Static method returns database connection for the specified name.
static loadMessages($file)
Loads language messages for specified file in a lazy way.
Definition: loc.php:67
static getMessage($code, $replace=null, $language=null)
Returns translation by message code.
Definition: loc.php:29