]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Исправление
authorAlexander Smirnov <fredeom@mail.ru>
Thu, 25 Jul 2024 15:13:30 +0000 (18:13 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Thu, 25 Jul 2024 15:13:30 +0000 (18:13 +0300)
erp24/services/MotivationService.php

index 9668ba8b189d5b87736d3eed5c8dd901ef541552..73c294f78e3ec0be113a9aa01df6f0dae06bf9c7 100644 (file)
@@ -2,7 +2,7 @@
 
 namespace yii_app\services;
 
-use \PhpOffice\PhpSpreadsheet\IOFactory;
+use PhpOffice\PhpSpreadsheet\IOFactory;
 use yii_app\records\Motivation;
 use yii_app\records\MotivationValue;
 use yii_app\records\MotivationValueGroup;
@@ -93,13 +93,15 @@ class MotivationService
                 }
                 $rows []= $row;
             }
-            if ($motivation && empty($error)) {
-                $motivation->save();
-                if ($motivation->getErrors()) {
-                    $error = json_encode($motivation->getErrors());
+            if (empty($error)) {
+                if ($motivation) {
+                    $motivation->save();
+                    if ($motivation->getErrors()) {
+                        $error = json_encode($motivation->getErrors());
+                    }
+                } else {
+                    $error = 'Не указан магазин, год и месяц [0,0]';
                 }
-            } else {
-                $error = 'Не указан магазин, год и месяц [0,0]';
             }
             if (empty($error)) {
                 $motivationValueGroupPlan = MotivationValueGroup::find()->where(['alias' => 'plan'])->one();