From 3cc58d8662aee0d5d724901f4ab7dc6e02315192 Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Wed, 18 Dec 2024 10:23:51 +0300 Subject: [PATCH] =?utf8?q?=D1=84=D0=B8=D0=BA=D1=81=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/api2/controllers/DataController.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/erp24/api2/controllers/DataController.php b/erp24/api2/controllers/DataController.php index ade8e360..4c24aa11 100644 --- a/erp24/api2/controllers/DataController.php +++ b/erp24/api2/controllers/DataController.php @@ -138,10 +138,11 @@ class DataController extends BaseController { $waybillIncomingArray = $this->getWaybillIncomingDoc(); $waybillIncoming = $waybillIncomingArray['waybillIncoming']; + $waybillIncomingResult = $waybillIncomingArray['waybillIncomingResult']; $waybillIncomingIds = $waybillIncomingArray['waybillIncomingIds']; - if (!empty($waybillIncoming)) { - $mess['create_write_ons'] = $waybillIncoming; + if (!empty($waybillIncomingResult)) { + $mess['create_write_ons'] = $waybillIncomingResult; } $createEmployeeArray = $this->getCreateEmployee(); @@ -353,7 +354,7 @@ class DataController extends BaseController { 'summ' ]) ->indexBy('id') - ->andWhere(['status' => 1]) + ->andWhere(['status' => 2]) ->asArray() ->all(); @@ -379,11 +380,14 @@ class DataController extends BaseController { $waybillIncomingTemp = $waybillIncoming; foreach ($waybillIncomingTemp as $key => $row) { $waybillIncomingProductsRow = []; + if (!isset($waybillIncoming[$key]['items'])) { + $waybillIncoming[$key]['items'] = []; + } if (array_key_exists($row['id'], $waybillIncomingProducts)) { $waybillIncomingProductsRow = $waybillIncomingProducts[$row['id']]; } if (!empty($waybillIncomingProductsRow)) { - $waybillIncoming[$key]['items'] = $waybillIncomingProductsRow; + $waybillIncoming[$key]['items'][] = $waybillIncomingProductsRow; } } @@ -404,7 +408,7 @@ class DataController extends BaseController { file_put_contents(self::OUT_DIR . '/log_created_waybill_incoming_error.txt', PHP_EOL . date("d.m.Y H:i:s",time()). $e3->getMessage(). ' file: '. $e3->getFile() . ' line: '. $e3->getLine(), FILE_APPEND); } - return compact('waybillIncoming', 'waybillIncomingIds'); + return compact('waybillIncoming', 'waybillIncomingIds', 'waybillIncomingResult'); } private function getCreateEmployee() : array { -- 2.39.5