From 837f641dd7039292bbf4a624658c6c28d364d919 Mon Sep 17 00:00:00 2001 From: marina Date: Tue, 27 May 2025 14:25:17 +0300 Subject: [PATCH] ERP-417 --- erp24/controllers/WriteOffsErpController.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/erp24/controllers/WriteOffsErpController.php b/erp24/controllers/WriteOffsErpController.php index 3e59375f..b15a14f9 100644 --- a/erp24/controllers/WriteOffsErpController.php +++ b/erp24/controllers/WriteOffsErpController.php @@ -535,8 +535,9 @@ class WriteOffsErpController extends Controller try { if ($flag = $model->save(false)) { $writeOffsErpId = $model->getId(); - - foreach ($modelsProducts as $keyModelProduct => $modelProduct) { + $keyModelProduct = 0; + foreach ($modelsProducts as $modelProduct) { + $keyModelProduct++; /** @var WriteOffsProductsErp $modelProduct */ $modelProduct->setWriteOffsErpId($writeOffsErpId); $modelProduct->setCreatedAt(); @@ -574,8 +575,6 @@ class WriteOffsErpController extends Controller } } } - - } } if ($flag) { @@ -862,9 +861,9 @@ class WriteOffsErpController extends Controller } } } - if ($flag) { - $transaction->commit(); - } + if ($flag) { + $transaction->commit(); + } if ($flag) { $transaction->commit(); return $this->redirect(['/write-offs-erp/view', 'id' => $model->id]); -- 2.39.5