Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
barcodescanner.php
1<?php
2
4
11
13{
18 public function sendMobilePushAction(string $id): ?array
19 {
20 if (!Loader::includeModule('catalog') || !AccessController::getCurrent()->check(ActionDictionary::ACTION_CATALOG_READ))
21 {
22 $this->addError(new Error(Loc::getMessage('BARCODE_SCANNER_ACCESS_DENIED')));
23 return null;
24 }
25
26 if (!Loader::includeModule('pull'))
27 {
28 $this->addError(new Error(Loc::getMessage('BARCODE_SCANNER_PULL_MODULE_REQUIRED')));
29 return null;
30 }
31
35 (new \CPushManager())->sendMessage([
36 [
37 'USER_ID' => $this->getCurrentUser()->getId(),
38 'APP_ID' => 'Bitrix24',
39 'EXPIRY' => 0,
40 'PARAMS'=> [
41 'TYPE' => 'CATALOG_BARCODE_SCANNER',
42 'ID'=> $id,
43 ],
44 'ADVANCED_PARAMS' => [
45 'senderName' => Loc::getMessage('BARCODE_SCANNER_PUSH_TITLE'),
46 'senderMessage' => Loc::getMessage('BARCODE_SCANNER_PUSH_TEXT')
47 ]
48 ]
49 ]);
50
54 Event::add(
55 $this->getCurrentUser()->getId(),
56 [
57 'module_id' => 'catalog',
58 'command' => 'OpenBarcodeScanner',
59 'params' => [
60 'id' => $id,
61 ]
62 ]
63 );
64
65 return [];
66 }
67}
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29