From: Alexander Smirnov Date: Thu, 25 Jul 2024 15:13:30 +0000 (+0300) Subject: Исправление X-Git-Tag: 1.4~45^2~21 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=fa3451b32e8e182ac4809dcef95520430b0486ab;p=erp24_rep%2Fyii-erp24%2F.git Исправление --- 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();