]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Исправление загрузки с parent_id
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Fri, 7 Feb 2025 11:47:47 +0000 (14:47 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Fri, 7 Feb 2025 11:47:47 +0000 (14:47 +0300)
erp24/controllers/StoreCityListController.php

index 256ae56d8963a2a2925fbae0f5637b49b98c9d22..f820ac04092b6c2ac97209c04aab3cf30b8582f8 100644 (file)
@@ -98,8 +98,9 @@ class StoreCityListController extends Controller
 
         foreach ($data as $row) {
             $name = $row['name'] ?? $row['A'];
-            $parent_id = $row['parent_id'] ?? $row['B'];
             $type = $row['type'] ?? $row['C'];
+            $parent_id = isset($row['parent_id']) ? trim($row['parent_id']) : (isset($row['B']) ? trim($row['B']) : '');
+            $parent_id = ($parent_id === '' || strtolower($parent_id) === 'null') ? null : (int)$parent_id;
 
             $existingRecord = StoreCityList::find()
                 ->where(['name' => $name, 'parent_id' => $parent_id, 'type' => $type])