1 | <?php |
||
26 | class BillController extends \hipanel\base\CrudController |
||
27 | { |
||
28 | public function behaviors() |
||
29 | { |
||
30 | return array_merge(parent::behaviors(), [ |
||
31 | 'access-bill' => [ |
||
32 | 'class' => AccessControl::class, |
||
33 | 'only' => ['index', 'view', 'create', 'update', 'delete'], |
||
34 | 'rules' => [ |
||
35 | [ |
||
36 | 'allow' => true, |
||
37 | 'roles' => ['manage', 'deposit'], |
||
38 | 'actions' => ['index', 'view'], |
||
39 | ], |
||
40 | [ |
||
41 | 'allow' => true, |
||
42 | 'roles' => ['bill.create'], |
||
43 | 'actions' => ['create', 'import', 'copy'], |
||
44 | ], |
||
45 | [ |
||
46 | 'allow' => true, |
||
47 | 'roles' => ['bill.update'], |
||
48 | 'actions' => ['update'], |
||
49 | ], |
||
50 | [ |
||
51 | 'allow' => true, |
||
52 | 'roles' => ['bill.delete'], |
||
53 | 'actions' => ['delete'], |
||
54 | ], |
||
55 | ], |
||
56 | ], |
||
57 | ]); |
||
58 | } |
||
59 | |||
60 | 1 | public function actions() |
|
61 | { |
||
62 | return [ |
||
63 | 'set-orientation' => [ |
||
64 | 'class' => OrientationAction::class, |
||
65 | 'allowedRoutes' => [ |
||
66 | '@bill/index', |
||
67 | ], |
||
68 | 1 | ], |
|
69 | 'index' => [ |
||
70 | 1 | 'class' => IndexAction::class, |
|
71 | 'data' => function ($action) { |
||
|
|||
72 | list($billTypes, $billGroupLabels) = $this->getTypesAndGroups(); |
||
73 | |||
74 | return compact('billTypes', 'billGroupLabels'); |
||
75 | 1 | }, |
|
76 | 1 | ], |
|
77 | 'view' => [ |
||
78 | 'class' => ViewAction::class, |
||
79 | 1 | ], |
|
80 | 'validate-form' => [ |
||
81 | 'class' => ValidateFormAction::class, |
||
82 | 1 | ], |
|
83 | 'create' => [ |
||
84 | 1 | 'class' => SmartCreateAction::class, |
|
85 | 'data' => function ($action) { |
||
86 | list($billTypes, $billGroupLabels) = $this->getTypesAndGroups(); |
||
87 | |||
88 | return compact('billTypes', 'billGroupLabels'); |
||
89 | 1 | }, |
|
90 | 1 | 'success' => Yii::t('hipanel:finance', 'Payment was created successfully'), |
|
91 | 1 | ], |
|
92 | 'update' => [ |
||
93 | 1 | 'class' => SmartUpdateAction::class, |
|
94 | 1 | 'success' => Yii::t('hipanel:finance', 'Payment was updated successfully'), |
|
95 | 'data' => function ($action) { |
||
96 | list($billTypes, $billGroupLabels) = $this->getTypesAndGroups(); |
||
97 | |||
98 | return compact('billTypes', 'billGroupLabels'); |
||
99 | 1 | }, |
|
100 | ], |
||
101 | 'copy' => [ |
||
102 | 1 | 'class' => SmartUpdateAction::class, |
|
103 | 1 | 'scenario' => 'create', |
|
104 | 'data' => function ($action, $data) { |
||
105 | foreach ($data['models'] as $model) { |
||
106 | /** @var Bill $model */ |
||
107 | $model->prepareToCopy(); |
||
108 | } |
||
109 | |||
110 | list($billTypes, $billGroupLabels) = $this->getTypesAndGroups(); |
||
111 | |||
112 | return compact('billTypes', 'billGroupLabels'); |
||
113 | 1 | }, |
|
114 | 1 | ], |
|
115 | 'delete' => [ |
||
116 | 1 | 'class' => SmartPerformAction::class, |
|
117 | 1 | 'success' => Yii::t('hipanel:finance', 'Payment was deleted successfully'), |
|
118 | 1 | ], |
|
119 | 1 | ]; |
|
120 | } |
||
121 | |||
122 | public function actionImport() |
||
148 | |||
149 | /** |
||
150 | * @return array |
||
151 | */ |
||
152 | public function getPaymentTypes() |
||
159 | |||
160 | /** |
||
161 | * @return array |
||
162 | */ |
||
163 | private function getTypesAndGroups() |
||
170 | } |
||
171 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.