1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
provider.php
См. документацию.
1<?php
2namespace Bitrix\Sale\Cashbox\Internals\Analytics;
3
4use Bitrix\Main;
5use Bitrix\Sale;
6
13{
14 private const TYPE = 'cashbox';
15
16 private const CASHBOX_HANDLERS = [
17 Sale\Cashbox\CashboxOrangeData::class,
18 Sale\Cashbox\CashboxCheckbox::class,
19 Sale\Cashbox\CashboxBusinessRu::class,
20 Sale\Cashbox\CashboxBusinessRuV5::class,
21 Sale\Cashbox\CashboxOrangeDataFfd12::class,
22 ];
23
25 private $check;
26
28 private $cashboxHandler;
29
30 public function __construct(Sale\Cashbox\AbstractCheck $check)
31 {
32 $this->check = $check;
33
34 $cashboxId = $check->getField('CASHBOX_ID');
35 $this->cashboxHandler = Sale\Cashbox\Manager::getObjectById($cashboxId);
36 }
37
41 public static function getCode(): string
42 {
43 return self::TYPE;
44 }
45
46 protected function needProvideData(): bool
47 {
48 $cashboxHandlerCode = $this->cashboxHandler::getCode();
49
50 $isCashboxHandlerExists = (bool)array_filter(
51 self::CASHBOX_HANDLERS,
52 static function ($cashboxHandler) use ($cashboxHandlerCode) {
53 return $cashboxHandlerCode === $cashboxHandler::getCode();
54 }
55 );
56
57 return $isCashboxHandlerExists && $this->check->getField('STATUS') === 'Y';
58 }
59
63 protected function getProviderData(): array
64 {
65 $checkData = $this->getCheckData();
66 return [
67 'cashbox' => $this->cashboxHandler::getCode(),
68 'date_time' => $checkData['date_time'],
69 'client_login' => $this->getClientLogin(),
70 ];
71 }
72
73 private function getClientLogin(): ?string
74 {
75 $cashboxHandlerCode = $this->cashboxHandler::getCode();
76 if (
77 $cashboxHandlerCode === Sale\Cashbox\CashboxBusinessRu::getCode()
78 || $cashboxHandlerCode === Sale\Cashbox\CashboxBusinessRuV5::getCode()
79 )
80 {
81 return $this->cashboxHandler->getValueFromSettings('AUTH', 'LOGIN');
82 }
83
84 return null;
85 }
86
90 private function getCheckData(): array
91 {
92 $dateTime = $this->check->getField('DATE_PRINT_END');
93 if (!($dateTime instanceof Main\Type\DateTime))
94 {
95 $dateTime = new Main\Type\DateTime();
96 }
97
98 return [
99 'date_time' => $dateTime->format('Y-m-d H:i:s'),
100 ];
101 }
102}
static getCode()
Определения cashbox.php:42
__construct(Sale\Cashbox\AbstractCheck $check)
Определения provider.php:30
static getObjectById($id)
Определения manager.php:165
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
Определения collection.php:2