Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
userconsent.php
1<?php
2
3namespace Bitrix\Sale;
4
8
10{
11 const PROVIDER_CODE = 'sale/order';
12 const DATA_PROVIDER_CODE = 'sale/company';
13
19 public static function onProviderList()
20 {
21 $parameters = array(
22 array(
23 'CODE' => self::PROVIDER_CODE,
24 'NAME' => Loc::getMessage('SALE_USER_CONSENT_PROVIDER_NAME'),
25 'DATA' => function ($id = null)
26 {
27 return array(
28 'NAME' => Loc::getMessage('SALE_USER_CONSENT_PROVIDER_ITEM_NAME', array('%id%' => $id)),
29 'URL' => str_replace('%id%', $id, '/bitrix/admin/sale_order_view.php?ID=%id%')
30 );
31 }
32 )
33 );
34
35 return new EventResult(EventResult::SUCCESS, $parameters, 'sale');
36 }
37
43 public static function onDataProviderList()
44 {
45 $parameters = array(
46 array(
47 'CODE' => self::DATA_PROVIDER_CODE,
48 'NAME' => Loc::getMessage('SALE_USER_CONSENT_DATA_PROVIDER_NAME'),
49 'EDIT_URL' => '/bitrix/admin/sale_company.php',
50 'DATA' => function ()
51 {
52 $data = array();
53 $companyNames = array();
54 $companyAddresses = array();
55
56 $dbRes = Manager::getList(array(
57 'select' => array('NAME', 'ADDRESS'),
58 'filter' => array('ACTIVE' => 'Y'),
59 'order' => array('SORT' => 'ASC', 'ID' => 'ASC')
60 ));
61 while ($company = $dbRes->fetch())
62 {
63 $companyNames[] = $company['NAME'];
64 $companyAddresses[] = $company['ADDRESS'];
65 }
66
67 if (!empty($companyNames))
68 {
69 $data = array(
70 'COMPANY_NAME' => implode('; ', $companyNames),
71 'COMPANY_ADDRESS' => implode('; ', $companyAddresses)
72 );
73 }
74
75 return $data;
76 }
77 )
78 );
79
80 return new EventResult(EventResult::SUCCESS, $parameters, 'sale');
81 }
82}
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29