Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions inc/exportabletrait.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,16 @@ 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);
Expand Down