1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
action.php
См. документацию.
1<?
2namespace Sale\Handlers\Delivery\Additional;
3
4use Bitrix\Main\Config\Option;
5use Bitrix\Main\Error;
6use Bitrix\Main\Result;
7
12class Action
13{
14 const EXECUTED_OPTION = 'handlers_dlv_add_action_executed';
15
20 public static function execute(array $params)
21 {
22 $result = new Result();
23
24 if(!isset($params['TYPE']))
25 {
26 $result->addError(new Error('Action type type is undefined'));
27 return $result;
28 }
29
30 if(!isset($params['ID']))
31 {
32 $result->addError(new Error('Action id is undefined'));
33 return $result;
34 }
35
36 if(self::isExecuted($params['ID']))
37 return $result;
38
39 switch($params['TYPE'])
40 {
41 case 'TYPE_CACHE_CLEAR':
42
43 if(!isset($params['PARAMS']['CACHE_TYPE']))
44 break;
45
46 if(!$cache = CacheManager::getItem($params['PARAMS']['CACHE_TYPE']))
47 break;
48
49 $cache->clean();
50 break;
51
52 case 'TYPE_LOCATIONS_CHANGED':
53 break;
54
55 default:
56 {
57 $result->addError(new Error('Unknown type of action: "'.$params['TYPE'].'"'));
58 return $result;
59 }
60 }
61
62 self::setExecuted($params['ID']);
63 return $result;
64 }
65
71 private static function isExecuted($id)
72 {
73 return(
74 in_array(
75 $id,
76 explode(',',Option::get('sale', self::EXECUTED_OPTION, '')
77 ))
78 );
79 }
80
85 private static function setExecuted($id)
86 {
87 if(!self::isExecuted($id))
88 {
89 $value = Option::get('sale', self::EXECUTED_OPTION, '');
90
91 if($value <> '')
92 $value .= ',';
93
94 $value .= $id;
95
96 Option::set('sale', self::EXECUTED_OPTION, $value);
97 }
98 }
99}
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$value
Определения Param.php:39
trait Error
Определения error.php:11
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799