From 46763622102a67c49517fd7f2d0ebac1677be99d Mon Sep 17 00:00:00 2001 From: Aleksey Filippov Date: Thu, 12 Jun 2025 23:49:41 +0300 Subject: [PATCH] =?utf8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5?= =?utf8?q?=D0=BD=D0=B8=D0=B5=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B8=20?= =?utf8?q?=D0=B1=D0=BB=D0=BE=D0=BA=D0=B8=D1=80=D0=BE=D0=B2=D0=BA=D0=B8=20?= =?utf8?q?=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D0=B8=20=D1=81=D0=BF=D0=B8=D1=81?= =?utf8?q?=D0=B0=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/controllers/WriteOffsErpController.php | 7 +++++-- erp24/records/WriteOffsErp.php | 9 ++++++++- erp24/views/write_offs_erp/view.php | 12 ++++++++---- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/erp24/controllers/WriteOffsErpController.php b/erp24/controllers/WriteOffsErpController.php index c2d03a2b..b7a4dc44 100644 --- a/erp24/controllers/WriteOffsErpController.php +++ b/erp24/controllers/WriteOffsErpController.php @@ -933,8 +933,11 @@ class WriteOffsErpController extends Controller ->one(); - if (WriteOffsErp::isManager($model->store_id)) { - return 'У вас нет прав для согласования списаний!'; + + if (WriteOffsErp::isTestStore($model->store_id)) { + if (WriteOffsErp::isManager($model->store_id)) { + return 'У вас нет прав для согласования списаний!'; + } } /** @var WriteOffsErp $model */ diff --git a/erp24/records/WriteOffsErp.php b/erp24/records/WriteOffsErp.php index 4c8eae50..78dd45ac 100644 --- a/erp24/records/WriteOffsErp.php +++ b/erp24/records/WriteOffsErp.php @@ -133,6 +133,8 @@ class WriteOffsErp extends \yii\db\ActiveRecord self::STATUS_ERROR_1С => "Ошибка в 1С", ]; + public const TEST_STORES = [1, 9, 28, 30, 15, 44, 8]; + public function custom_function_validation($attribute, $params) { if(!in_array($this->$attribute, $params['values'])) { @@ -769,10 +771,15 @@ class WriteOffsErp extends \yii\db\ActiveRecord public static function isManager(int $storeId) : bool { $adminId = Yii::$app->user->id; - $isStoreOnNewSystem = (in_array($storeId, [1, 9, 28, 30, 15, 44, 8])); + $isStoreOnNewSystem = self::isTestStore($storeId); if (in_array($adminId, [785, 1463, 225, 1070, 826, 1036]) && $isStoreOnNewSystem ) { return false; } return true; } + + public static function isTestStore(int $storeId) : bool + { + return (in_array($storeId, self::TEST_STORES)); + } } diff --git a/erp24/views/write_offs_erp/view.php b/erp24/views/write_offs_erp/view.php index fec4a73b..7cc37b76 100644 --- a/erp24/views/write_offs_erp/view.php +++ b/erp24/views/write_offs_erp/view.php @@ -192,9 +192,13 @@ $this->registerCssFile('/css/write-offs-erp.css', ['position' => \yii\web\View:: store_id)) { - $class .= ' disabled'; + $title = ''; + $isTestStore = WriteOffsErp::isTestStore($model->store_id); + if ($isTestStore) { + if (WriteOffsErp::isManager($model->store_id)) { + $class .= ' disabled'; + $title = "Согласовать списания на данном магазине могут только Трушина Вера, Горячев Дмитрий, Цветкова Ольга, Яшенкова Алена и Емельянова Ольга"; + } } echo Html::tag('span', Html::button('Согласовать', [ @@ -224,7 +228,7 @@ $this->registerCssFile('/css/write-offs-erp.css', ['position' => \yii\web\View:: " ]), [ - 'title' => 'Согласовать списания на данном магазине могут только Трушина Вера, Горячев Дмитрий, Цветкова Ольга, Яшенкова Алена и Емельянова Ольга', + 'title' => $title, 'style' => 'display:inline-block; cursor: help;', ] ); -- 2.39.5