1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
propertyvaluecollection.php
См. документацию.
1<?php
8
9namespace Bitrix\Sale;
10
11use Bitrix\Main;
12use Bitrix\Sale\Internals\Input;
13use Bitrix\Main\Entity;
14use Bitrix\Main\Localization\Loc;
15
16
17Loc::loadMessages(__FILE__);
18
24{
28 protected static function getEntityType(): string
29 {
30 return \Bitrix\Sale\Registry::ENTITY_ORDER;
31 }
32
39 public function save()
40 {
41 $isChanged = $this->isChanged();
42
44 if (!$order = $this->getOrder())
45 {
46 throw new Main\ObjectNotFoundException('Entity "Order" not found');
47 }
48
49 $result = parent::save();
50
51 if ($isChanged && $order->getId() > 0)
52 {
53 $registry = Registry::getInstance(static::getRegistryType());
55 $orderHistory = $registry->getOrderHistoryClassName();
56
57 if ($result->isSuccess())
58 {
59 $orderHistory::addAction(
60 'PROPERTY',
61 $order->getId(),
62 'PROPERTY_SAVED',
63 null,
64 null,
65 [],
67 );
68 }
69
70 $orderHistory::collectEntityFields('PROPERTY', $order->getId());
71 }
72
73 return $result;
74 }
75
80 protected function callEventOnSalePropertyValueDeleted($values)
81 {
82 parent::callEventOnSalePropertyValueDeleted($values);
83
85 if (!$order = $this->getOrder())
86 {
87 throw new Main\ObjectNotFoundException('Entity "Order" not found');
88 }
89
90 if ($order->getId() > 0)
91 {
92 $registry = Registry::getInstance(static::getRegistryType());
93
95 $orderHistory = $registry->getOrderHistoryClassName();
96 $orderHistory::addAction(
97 'PROPERTY',
98 $order->getId(),
99 'PROPERTY_REMOVE',
100 $values['ID'],
101 null,
102 [
103 'NAME' => $values['NAME'],
104 'CODE' => $values['CODE'],
105 'VALUE' => $values['VALUE'],
106 ]
107 );
108 }
109 }
110
111 public static function initJs(): void
112 {
114 \CJSCore::RegisterExt('SaleOrderProperties', [
115 'js' => '/bitrix/js/sale/orderproperties.js',
116 'lang' => '/bitrix/modules/sale/lang/'.LANGUAGE_ID.'/lib/propertyvaluecollection.php',
117 'rel' => ['input'],
118 ]
119 );
120 \CJSCore::Init(['SaleOrderProperties']);
121 }
122}
static initJs()
Определения input.php:18
const SALE_ORDER_HISTORY_ACTION_LOG_LEVEL_1
Определения orderhistory.php:29
static getInstance($type)
Определения registry.php:183
static Init($arExt=array(), $bReturn=false)
Определения jscore.php:66
static RegisterExt($name, $arPaths)
Определения jscore.php:28
$result
Определения get_property_values.php:14
$order
Определения payment.php:8