From 378e60d3175464506cc39663dd5be38799c9f14e Mon Sep 17 00:00:00 2001 From: MyuTsu Date: Mon, 20 Oct 2025 14:43:07 +0200 Subject: [PATCH 1/2] fix(import): Export sections in logical order to fix condition import --- inc/exportabletrait.class.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/inc/exportabletrait.class.php b/inc/exportabletrait.class.php index 2fcbbba23..1f99be243 100644 --- a/inc/exportabletrait.class.php +++ b/inc/exportabletrait.class.php @@ -55,9 +55,17 @@ public function exportChildrenObjects(array $subItems, array $export, bool $remo } $export[$key] = []; foreach ($itemtypes as $itemtype) { - $allSubItems = $DB->request($itemtype::getSQLCriteriaToSearchForItem($this->getType(), $this->getID())); - $list = []; + $criteria = $itemtype::getSQLCriteriaToSearchForItem($this->getType(), $this->getID()); + + // Add ORDER BY clause if the itemtype has an 'order' field + // This ensures sections and other ordered items are exported in the correct order $subItem = new $itemtype(); + if ($subItem->isField('order')) { + $criteria['ORDER'] = ['order ASC']; + } + + $allSubItems = $DB->request($criteria); + $list = []; foreach ($allSubItems as $row) { $subItem->getFromDB($row['id']); $list[] = $subItem->export($remove_uuid); From 29c2b3146597deca15f5d5505d8fc037a3e434d2 Mon Sep 17 00:00:00 2001 From: "Romain B." <8530352+Rom1-B@users.noreply.github.com> Date: Mon, 20 Oct 2025 14:59:44 +0200 Subject: [PATCH 2/2] Apply suggestion from @Rom1-B --- inc/exportabletrait.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/inc/exportabletrait.class.php b/inc/exportabletrait.class.php index 1f99be243..8abf34cef 100644 --- a/inc/exportabletrait.class.php +++ b/inc/exportabletrait.class.php @@ -63,7 +63,6 @@ public function exportChildrenObjects(array $subItems, array $export, bool $remo if ($subItem->isField('order')) { $criteria['ORDER'] = ['order ASC']; } - $allSubItems = $DB->request($criteria); $list = []; foreach ($allSubItems as $row) {