From fa3451b32e8e182ac4809dcef95520430b0486ab Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Thu, 25 Jul 2024 18:13:30 +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?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/services/MotivationService.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/erp24/services/MotivationService.php b/erp24/services/MotivationService.php index 9668ba8b..73c294f7 100644 --- a/erp24/services/MotivationService.php +++ b/erp24/services/MotivationService.php @@ -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(); -- 2.39.5