Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
tradebinding.php
1<?php
2
3
5
6
8use Bitrix\Main\Entity\ExpressionField;
14
16{
17 public function getFieldsAction()
18 {
19 $view = $this->getViewManager()
20 ->getView($this);
21
22 return ['TRADE_BINDING'=>$view->prepareFieldInfos(
23 $view->getFields()
24 )];
25 }
26
27 public function listAction(PageNavigation $pageNavigation, array $select = [], array $filter = [], array $order = []): Page
28 {
29 $select = empty($select) ? ['*'] : $select;
30 $order = empty($order) ? ['ID' => 'ASC'] : $order;
31
34 $tradeBindingCollection = $registry->get(Registry::ENTITY_TRADE_BINDING_COLLECTION);
35
36 $tradeBindings = $tradeBindingCollection::getList(
37 [
38 'select' => $select,
39 'filter' => $filter,
40 'order' => $order,
41 'offset' => $pageNavigation->getOffset(),
42 'limit' => $pageNavigation->getLimit(),
43 ]
44 )->fetchAll();
45
46 return new Page('TRADE_BINDINGS', $tradeBindings, function() use ($filter)
47 {
50 $tradeBindingCollection = $registry->get(Registry::ENTITY_TRADE_BINDING_COLLECTION);
51
52 return (int) $tradeBindingCollection::getList([
53 'select' => ['CNT'],
54 'filter' => $filter,
55 'runtime' => [
56 new ExpressionField('CNT', 'COUNT(ID)')
57 ]
58 ])->fetch()['CNT'];
59 });
60 }
61
62 static public function prepareFields($fields)
63 {
64 return isset($fields['TRADE_BINDINGS'])?['TRADE_BINDINGS'=>$fields['TRADE_BINDINGS']]:[];
65 }
66
67 protected function checkReadPermissionEntity(): Result
68 {
69 $r = new Result();
70
71 $saleModulePermissions = self::getApplication()->GetGroupRight("sale");
72 if ($saleModulePermissions == "D")
73 {
74 $r->addError(new Error('Access Denied', 200040300010));
75 }
76 return $r;
77 }
78}
const ENTITY_TRADE_BINDING_COLLECTION
Definition registry.php:55
static getInstance($type)
Definition registry.php:183