fix failing to save dialplan details xml in proper order (#6994)

This commit is contained in:
frytimo 2024-06-03 16:30:59 -03:00 committed by GitHub
parent f6e6750efc
commit 058d9aba37
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 0 deletions

View File

@ -596,6 +596,7 @@
//combines array dialplans and dialplan details arrays to match results from the database //combines array dialplans and dialplan details arrays to match results from the database
public function prepare_details($database_array) { public function prepare_details($database_array) {
$array = [];
$id = 0; $id = 0;
foreach($database_array['dialplans'] as $row) { foreach($database_array['dialplans'] as $row) {
if (!empty($row['dialplan_details'])) { if (!empty($row['dialplan_details'])) {
@ -625,6 +626,10 @@
} }
} }
} }
//sort the dataset by group and then by order before returning the values
$dialplan_detail_group = array_column($array, 'dialplan_detail_group');
$dialplan_detail_order = array_column($array, 'dialplan_detail_order');
array_multisort($dialplan_detail_group, SORT_ASC, $dialplan_detail_order, SORT_ASC, $array);
$this->dialplan_details = $array; $this->dialplan_details = $array;
} }