From: marina Date: Fri, 9 Aug 2024 01:49:42 +0000 (+0300) Subject: ERP-102 Приёмник для эксель файла (корректировка) X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=89aa1065e91b0ff5014686725f227a6ac3fe5f66;p=erp24_rep%2Fyii-erp24%2F.git ERP-102 Приёмник для эксель файла (корректировка) --- diff --git a/erp24/actions/motivation/IndexAction.php b/erp24/actions/motivation/IndexAction.php index 9ad3fe81..c103b8e7 100644 --- a/erp24/actions/motivation/IndexAction.php +++ b/erp24/actions/motivation/IndexAction.php @@ -32,7 +32,7 @@ class IndexAction extends Action if ($file) { $adjustment = Yii::$app->request->post('adjustment'); - if ($adjustment && array_key_exists(Admin::findOne(Yii::$app->user->id)->group_id, Motivation::getAdjustmentEditors())) { + if ($adjustment && in_array(Admin::findOne(Yii::$app->user->id)->group_id, Motivation::getAdjustmentEditors())) { return implode('
', ['Вы не можете вносить корректировки']); } diff --git a/erp24/records/AdminGroup.php b/erp24/records/AdminGroup.php index 77e37fe4..2c59269f 100755 --- a/erp24/records/AdminGroup.php +++ b/erp24/records/AdminGroup.php @@ -19,6 +19,7 @@ class AdminGroup extends ActiveRecord const GROUP_FIRED = -1; const NOT_INITIALIZED_GROUP = 1000; + const DIRECTOR = 1; const GROUP_HR = 20; const GROUP_LOGIST_TRANSPORT = 15; const GROUP_FLORIST_DAY = 30; diff --git a/erp24/records/Motivation.php b/erp24/records/Motivation.php index 6002e5fb..abf1c23c 100644 --- a/erp24/records/Motivation.php +++ b/erp24/records/Motivation.php @@ -68,7 +68,8 @@ class Motivation extends \yii\db\ActiveRecord public static function getAdjustmentEditors() { return array( AdminGroup::GROUP_IT, - AdminGroup::GROUP_OPERATIONAL_DIRECTOR + AdminGroup::GROUP_OPERATIONAL_DIRECTOR, + AdminGroup::DIRECTOR ); } } diff --git a/erp24/views/motivation/index.php b/erp24/views/motivation/index.php index a42c6013..126b342b 100644 --- a/erp24/views/motivation/index.php +++ b/erp24/views/motivation/index.php @@ -77,7 +77,7 @@ $this->registerJsFile('/js/motivation/index.js', ['position' => \yii\web\View::P
user->id)->group_id, Motivation::getAdjustmentEditors())) { + if (in_array(Admin::findOne(Yii::$app->user->id)->group_id, Motivation::getAdjustmentEditors())) { echo Html::button('Внесение корректировок', ['class' => 'btn btn-warning btn-sm btn-adjustment', 'onclick' => 'openUploadDictionary("btn-adjustment");']); } ?>