]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
фиксы
authorAlexander Smirnov <fredeom@mail.ru>
Wed, 18 Dec 2024 07:23:51 +0000 (10:23 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Wed, 18 Dec 2024 07:23:51 +0000 (10:23 +0300)
erp24/api2/controllers/DataController.php

index ade8e3603b75390cb564fa9bd699724864081fd1..4c24aa11d93641d1eeacb759ea1799ae99cc8bdc 100644 (file)
@@ -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 {