From 22604df0dd6c5aab9246cfd13590b459672cf0a2 Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Mon, 29 Jul 2024 20:45:37 +0300 Subject: [PATCH] =?utf8?q?[ERP-88]=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?utf8?q?=D0=B5=D0=BD=D0=B0=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?utf8?q?=D0=B0,=20=D1=87=D1=82=D0=BE=20=D0=B2=D1=81=D0=B5=20=D1=8D=D0=BB?= =?utf8?q?=D0=B5=D0=BC=D0=B5=D0=BD=D1=82=D1=8B=20=D1=81=D0=BB=D0=BE=D0=B2?= =?utf8?q?=D0=B0=D1=80=D1=8F=20=D1=83=D1=87=D0=B0=D1=81=D1=82=D0=B2=D1=83?= =?utf8?q?=D1=8E=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/services/MotivationService.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/erp24/services/MotivationService.php b/erp24/services/MotivationService.php index 09ec4cd0..d0151435 100644 --- a/erp24/services/MotivationService.php +++ b/erp24/services/MotivationService.php @@ -87,8 +87,9 @@ class MotivationService $error = "Не корректно название элемента '" . ($row[1] ?? '') . "' Ожидается: '" . $motivationCostsItems[$row[0]]->name . "' [$ind,1]"; break; } - if ($row[2] == '') { - break; + if (trim($row[2]) == '') { + $rows []= $row; + continue; } switch ($motivationCostsItems[$row[0]]->data_type) { case MotivationCostsItem::DATA_TYPE_INT: { if (is_int($row[2])) { $value = (int)$row[2]; } else { $error = "Не инт [$ind,2] '" . $row[2] . "'"; }; break; } @@ -111,6 +112,18 @@ class MotivationService $error = 'Не указан магазин, год и месяц [0,0]'; } } + $motivationCostsItemsCount = count(array_keys($motivationCostsItems)); + if (empty($error) && (count($rows) != $motivationCostsItemsCount)) { + $keys = array_keys($motivationCostsItems); + foreach ($rows as $row) { + if (($key = array_search($row[0], $keys)) !== false) { + unset($keys[$key]); + } + } + $keys = array_values($keys); + $error = "Указаны не все элементы справочника. В листе: " . count($rows) . " В справочнике: " . $motivationCostsItemsCount + . " Ожидается, например: '" . $motivationCostsItems[$keys[0]]->name . "'"; + } if (empty($error)) { $motivationValueGroupPlan = MotivationValueGroup::find()->where(['alias' => 'plan'])->one(); /** @var $motivationValueGroupPlan MotivationValueGroup */ -- 2.39.5