Server IP : 85.193.89.191 / Your IP : 3.133.127.195 Web Server : Apache System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64 User : bitrix ( 600) PHP Version : 8.1.27 Disable Function : NONE MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/bitrix/www/bitrix/modules/catalog/lib/controller/ |
Upload File : |
<?php namespace Bitrix\Catalog\Controller; use Bitrix\Main\Error; use Bitrix\Main\Loader; use Bitrix\Main\Localization\Loc; use Bitrix\Pull\Event; use Bitrix\Catalog\Access\AccessController; use Bitrix\Catalog\Access\ActionDictionary; final class BarcodeScanner extends \Bitrix\Main\Engine\Controller { /** * @param string $id * @return array|null */ public function sendMobilePushAction(string $id): ?array { if (!Loader::includeModule('catalog') || !AccessController::getCurrent()->check(ActionDictionary::ACTION_CATALOG_READ)) { $this->addError(new Error(Loc::getMessage('BARCODE_SCANNER_ACCESS_DENIED'))); return null; } if (!Loader::includeModule('pull')) { $this->addError(new Error(Loc::getMessage('BARCODE_SCANNER_PULL_MODULE_REQUIRED'))); return null; } /** * System push waking app when it is not in active state */ (new \CPushManager())->sendMessage([ [ 'USER_ID' => $this->getCurrentUser()->getId(), 'APP_ID' => 'Bitrix24', 'EXPIRY' => 0, 'PARAMS'=> [ 'TYPE' => 'CATALOG_BARCODE_SCANNER', 'ID'=> $id, ], 'ADVANCED_PARAMS' => [ 'senderName' => Loc::getMessage('BARCODE_SCANNER_PUSH_TITLE'), 'senderMessage' => Loc::getMessage('BARCODE_SCANNER_PUSH_TEXT') ] ] ]); /** * Local push for app in active state */ Event::add( $this->getCurrentUser()->getId(), [ 'module_id' => 'catalog', 'command' => 'OpenBarcodeScanner', 'params' => [ 'id' => $id, ] ] ); return []; } }