]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-102 Приёмник для эксель файла (корректировка)
authormarina <m.zozirova@gmail.com>
Fri, 9 Aug 2024 02:10:46 +0000 (05:10 +0300)
committermarina <m.zozirova@gmail.com>
Fri, 9 Aug 2024 02:10:46 +0000 (05:10 +0300)
erp24/actions/motivation/IndexAction.php

index 2fe1bafe0e3e960a8cd04f20247e0530c8caf727..ee91113d133f890b6fc491ce08ffc59b0ac6d09b 100644 (file)
@@ -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('<br>', [$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('<br>', ['Вы не можете вносить корректировки']);
+                }
 
                 return implode('<br>', $data['errors']);
             } else {