From 1419d2fdfe69c1839c042b24034d3b8f06aad3f0 Mon Sep 17 00:00:00 2001 From: marina Date: Tue, 10 Jun 2025 17:04:23 +0300 Subject: [PATCH] =?utf8?q?ERP-426=20=D0=A0=D0=B0=D1=81=D1=88=D0=B8=D1=80?= =?utf8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2?= =?utf8?q?=D0=BE=D0=B9=20=D0=B3=D1=80=D1=83=D0=BF=D0=BF=D1=8B=20=D0=BC?= =?utf8?q?=D0=B0=D0=B3=D0=B0=D0=B7=D0=B8=D0=BD=D0=BE=D0=B2=20=D0=BF=D1=80?= =?utf8?q?=D0=B8=20=D1=80=D0=B5=D0=B4=D0=B0=D0=BA=D1=82=D0=B8=D1=80=D0=BE?= =?utf8?q?=D0=B2=D0=B0=D0=BD=D0=B8=D0=B8=20=D1=81=D0=BF=D0=B8=D1=81=D0=B0?= =?utf8?q?=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/controllers/WriteOffsErpController.php | 2 +- erp24/records/WriteOffsErp.php | 11 +++++++++++ erp24/views/write_offs_erp/_form.php | 3 +-- erp24/views/write_offs_erp/view.php | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/erp24/controllers/WriteOffsErpController.php b/erp24/controllers/WriteOffsErpController.php index 0ed86110..c2d03a2b 100644 --- a/erp24/controllers/WriteOffsErpController.php +++ b/erp24/controllers/WriteOffsErpController.php @@ -933,7 +933,7 @@ class WriteOffsErpController extends Controller ->one(); - if (in_array($model->store_id, [1, 9, 28, 30, 15, 44, 8]) && !in_array(Yii::$app->user->id, [785, 1463, 225, 1070, 826, 1036])) { + if (WriteOffsErp::isManager($model->store_id)) { return 'У вас нет прав для согласования списаний!'; } diff --git a/erp24/records/WriteOffsErp.php b/erp24/records/WriteOffsErp.php index c092f5df..c6c1eee4 100644 --- a/erp24/records/WriteOffsErp.php +++ b/erp24/records/WriteOffsErp.php @@ -66,6 +66,7 @@ class WriteOffsErp extends \yii\db\ActiveRecord { return [ [['guid', 'created_admin_id', 'store_id', 'store_guid', 'number', 'date', 'write_offs_type', 'quantity', 'created_at'], 'required'], + [['quantity'], 'required', 'message' => 'Поле Количество обязательно для заполнения'], [['status', 'created_admin_id', 'updated_admin_id', 'cause_id', 'confirm_admin_id', 'cause_group_id', 'store_id', 'active', 'deleted_admin_id'], 'integer'], [['date', 'created_at', 'send_at', 'updated_at', 'confirm_at', 'deleted_at', 'modelsProducts'], 'safe'], [['based_on', 'comment', 'error_text', 'write_offs_type'], 'string'], @@ -764,4 +765,14 @@ class WriteOffsErp extends \yii\db\ActiveRecord } return $images; } + + public static function isManager(int $storeId) : bool + { + $adminId = Yii::$app->user->id; + $isStoreOnNewSystem = (in_array($storeId, [1, 9, 28, 30, 15, 44, 8])); + if (in_array($adminId, [785, 1463, 225, 1070, 826, 1036]) && $isStoreOnNewSystem ) { + return true; + } + return false; + } } diff --git a/erp24/views/write_offs_erp/_form.php b/erp24/views/write_offs_erp/_form.php index 5c22b7d1..e61c80b9 100644 --- a/erp24/views/write_offs_erp/_form.php +++ b/erp24/views/write_offs_erp/_form.php @@ -152,9 +152,8 @@ $this->registerJsFile('/js/heic_to_jpg_replace.js', ['position' => \yii\web\View ], [ 'name' => 'quantity', - 'type' => 'textInput', + 'type' => 'numberInput', 'title' => 'Количество', - ], [ 'name' => 'cause_id', diff --git a/erp24/views/write_offs_erp/view.php b/erp24/views/write_offs_erp/view.php index 06507246..fec4a73b 100644 --- a/erp24/views/write_offs_erp/view.php +++ b/erp24/views/write_offs_erp/view.php @@ -193,7 +193,7 @@ $this->registerCssFile('/css/write-offs-erp.css', ['position' => \yii\web\View:: store_id, [1, 9, 28, 30, 15, 44, 8]) && !in_array(Yii::$app->user->id, [785, 1463, 225, 1070, 826, 1036])) { + if (WriteOffsErp::isManager($model->store_id)) { $class .= ' disabled'; } echo Html::tag('span', -- 2.39.5