%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 3.137.223.82 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/sale/lib/cashbox/restrictions/ |
Upload File : |
<?php namespace Bitrix\Sale\Cashbox\Restrictions; use Bitrix\Main\Localization\Loc; use Bitrix\Sale\Internals\Entity; use Bitrix\Sale; use Bitrix\Sale\Services\Base\Restriction; Loc::loadMessages(__FILE__); /** * Class Company * @package Bitrix\Sale\Cashbox\Restrictions */ class Company extends Restriction { public static $easeSort = 200; protected static $preparedData = array(); /** * @return string */ public static function getClassTitle() { return Loc::getMessage("SALE_CASHBOX_RSTR_BY_COMPANY_TITLE"); } /** * @return string */ public static function getClassDescription() { return Loc::getMessage("SALE_CASHBOX_RSTR_BY_COMPANY_DESC"); } /** * @param $params * @param array $restrictionParams * @param int $serviceId * @return bool */ public static function check($params, array $restrictionParams, $serviceId = 0) { if (is_array($restrictionParams) && isset($restrictionParams['COMPANY'])) { $diff = array_diff($params, $restrictionParams['COMPANY']); return empty($diff); } return true; } /** * @param Entity $entity * @return array */ protected static function extractParams(Entity $entity) { $result = array(); if ($entity instanceof Sale\Payment || $entity instanceof Sale\Shipment || $entity instanceof Sale\Order ) { $result[] = $entity->getField('COMPANY_ID'); } return $result; } /** * @return array|null */ protected static function getCompanyList() { static $result = null; if($result !== null) return $result; $result = array(); $dbResultList = Sale\Services\Company\Manager::getList(array( 'select' => array("ID", "NAME", "ACTIVE"), 'filter' => array("ACTIVE" => "Y"), 'order' => array("SORT"=>"ASC", "NAME"=>"ASC") )); while ($item = $dbResultList->fetch()) $result[$item["ID"]] = $item["NAME"]; return $result; } /** * @param int $entityId * @return array */ public static function getParamsStructure($entityId = 0) { $result = array( "COMPANY" => array( "TYPE" => "ENUM", 'MULTIPLE' => 'Y', "LABEL" => Loc::getMessage("SALE_CASHBOX_RSTR_BY_COMPANY"), "OPTIONS" => self::getCompanyList() ) ); return $result; } /** * @param int $mode - RestrictionManager::MODE_CLIENT | RestrictionManager::MODE_MANAGER * @return int */ public static function getSeverity($mode) { return Manager::SEVERITY_STRICT; } /** * @return bool */ public static function isAvailable() { return IsModuleInstalled('crm') ? false : true; } }