From: marina Date: Tue, 10 Jun 2025 14:04:23 +0000 (+0300) Subject: ERP-426 Расширение тестовой группы магазинов при редактировании списания X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=1419d2fdfe69c1839c042b24034d3b8f06aad3f0;p=erp24_rep%2Fyii-erp24%2F.git ERP-426 Расширение тестовой группы магазинов при редактировании списания --- 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',