From d0a323f8b238a32acf51d46a97d3263a1ad3d50a Mon Sep 17 00:00:00 2001 From: marina Date: Fri, 9 Aug 2024 05:10:46 +0300 Subject: [PATCH] =?utf8?q?ERP-102=20=D0=9F=D1=80=D0=B8=D1=91=D0=BC=D0=BD?= =?utf8?q?=D0=B8=D0=BA=20=D0=B4=D0=BB=D1=8F=20=D1=8D=D0=BA=D1=81=D0=B5?= =?utf8?q?=D0=BB=D1=8C=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0=20(=D0=BA=D0=BE?= =?utf8?q?=D1=80=D1=80=D0=B5=D0=BA=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=BA?= =?utf8?q?=D0=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/actions/motivation/IndexAction.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/erp24/actions/motivation/IndexAction.php b/erp24/actions/motivation/IndexAction.php index 2fe1bafe..ee91113d 100644 --- a/erp24/actions/motivation/IndexAction.php +++ b/erp24/actions/motivation/IndexAction.php @@ -31,16 +31,15 @@ class IndexAction extends Action $file = UploadedFile::getInstanceByName('myfile'); if ($file) { $adjustment = (boolean) Yii::$app->request->post('adjustment'); - if ($adjustment && in_array(Admin::findOne(Yii::$app->user->id)->group_id, Motivation::getAdjustmentEditors())) { - return implode('
', [$adjustment, in_array(Admin::findOne(Yii::$app->user->id)->group_id, Motivation::getAdjustmentEditors()), 'Вы не можете вносить корректировки']); - } + $fileName = $adjustment ? '/template_adjustment_temp.xlsx' : '/template_plan_temp.xlsx'; + $path1 = Yii::getAlias('@uploads') . $fileName; + $file->saveAs($path1); - $fileName = $adjustment ? '/template_adjustment_temp.xlsx' : '/template_plan_temp.xlsx'; - $path1 = Yii::getAlias('@uploads') . $fileName; - $file->saveAs($path1); - - $data = MotivationService::uploadTemplatePlan($path1, !$adjustment); + $data = MotivationService::uploadTemplatePlan($path1, !$adjustment); + } else { + return implode('
', ['Вы не можете вносить корректировки']); + } return implode('
', $data['errors']); } else { -- 2.39.5