Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
actionentity.php
1<?php
2
4
6
7class ActionEntity extends PoolBase
8{
9 protected static $pool = array();
10
11 const ACTION_ENTITY_SHIPMENT_COLLECTION_RESERVED_QUANTITY = 'shipment_collection_reserved_quantity';
12 const ACTION_ENTITY_SHIPMENT_RESERVED_QUANTITY = 'shipment_reserved_quantity';
13
20 public static function runActions($code, array $typeList = array())
21 {
22 $result = new Result();
23 $actionsList = static::getPoolByCode($code);
24
25 if (empty($actionsList))
26 {
27 return $result;
28 }
29
30 if (empty($typeList))
31 {
32 $typeList = array_keys($actionsList);
33 }
34
35 if (empty($typeList))
36 {
37 return $result;
38 }
39
40 foreach ($typeList as $type)
41 {
42 if (!isset($actionsList[$type]))
43 continue;
44
45 foreach ($actionsList[$type] as $actionParams)
46 {
48 $r = call_user_func_array($actionParams['METHOD'], $actionParams['PARAMS']);
49
50 if (!$r->isSuccess())
51 {
52 $result->addErrors($r->getErrors());
53 }
54
55 if ($r->hasWarnings())
56 {
57 $result->addWarnings($r->getWarnings());
58 }
59 }
60
61 static::resetPool($code, $type);
62 }
63
64 return $result;
65 }
66}