Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
loggertrait.php
1<?php
2
4
5
10
12{
14 protected $rawData;
15
19 public function setRawData($rawData)
20 {
21 $this->rawData = $rawData;
22 }
23
27 public function getRawData()
28 {
29 return $this->rawData;
30 }
31
35 abstract public function getDirectionType();
36
41 protected function loggerEntities(array $items)
42 {
43 $result = new Result();
44
45 foreach ($items as $item)
46 {
47 if($item->hasLogging())
48 {
49 $logger = $item->getLogger();
50
51 $logger->setField('ENTITY_ID', $item->getId());
52 $logger->setField('ENTITY_TYPE_ID', $item->getOwnerTypeId());
53 $logger->setField('XML_ID', $item->getExternalId());
54 $logger->setField('DIRECTION', $this->getDirectionType());
55
56 $logger->save();
57 }
58 }
59 return $result;
60 }
61
67 protected function loggerEntitiesPackage(array $items, OrderImport $orderItem)
68 {
69 $xmlStreem = $this->getRawData();
70
71 foreach ($items as $item)
72 {
73 if($item->hasLogging())
74 {
75 $logger = $item->getLogger();
76
77 if($item instanceof OrderImport)
78 {
79 $logger->setField('MESSAGE', $xmlStreem);
80 $logger->setField('PARENT_ID', $orderItem->getId());
81 $logger->setField('MARKED', $item->isMarked()?'Y':'N');
82 $logger->setField('ENTITY_DATE_UPDATE', $item->getField('TRAITS')['DATE_UPDATE']);
83 }
84 else
85 {
86 if($item instanceof EntityImport)
87 {
88 $logger->setField('PARENT_ID', $item->getParentEntity()->getId());
89 $logger->setField('OWNER_ENTITY_ID', $orderItem->getId());
90 $logger->setField('MARKED', $item->isMarked()?'Y':'N');
91 }
92 else
93 {
94 $logger->setField('PARENT_ID', $orderItem->getId());
95 }
96 }
97 }
98 }
99 return $this->loggerEntities($items);
100 }
101}
loggerEntitiesPackage(array $items, OrderImport $orderItem)
loggerEntities(array $items)