Gantt Chart Order not sorting as it should
- Status
- Open
- Subject
- Gantt Chart Order not sorting as it should
- Version
- 20.x
- Category
- Bug
- Feature
- Gantt Chart
- Resolution status
- New
- Submitted by
- amorangi
- Lastmod by
- amorangi
- Rating
- Description
The chart is saving order correctly to the database, but when reading from the database order is the order in the table (not the order field). This read in order is then assigned to the items, then is written out incorrectly. I'm not sure how
Copy to clipboard$orderItems = ! empty($orderField['fieldId']) ? 'f_' . $orderField['fieldId'] . '_asc' : 'created_asc'; $listItems = $trklib->list_items($trackerId, 0, -1, $orderItems, $listfields);
is supposed to work.- Solution
A temporary fix is to sort the items by order immediately after they are read from the database.
In tiki/lib/wiki-plugins/wikiplugin_ganttchart.php line 211 add:Copy to clipboard$orderKey = array_search($order, array_column($listfields, 'permName')); function array_sort($arrayToSort, $orderKey) { $new_array = array(); $sortable_array = array(); if (count($arrayToSort) > 0) { foreach ($arrayToSort as $k => $v) { $sortable_array[$k] = $v['field_values'][$orderKey]['value']; } } asort($sortable_array); foreach ($sortable_array as $k => $v) { $new_array[$k] = $arrayToSort[$k]; } return $new_array; } $listItems['data'] = array_sort($listItems['data'], $orderKey);- Importance
- 8
- Easy to solve?
- 8
- Priority
- 64
- Demonstrate Bug on Tiki 19+
-
This bug has been demonstrated on show2.tiki.org
Please demonstrate your bug on show2.tiki.org
Show.tiki.org is not configured properlyThe public/private keys configured to connect to show2.tiki.org were not accepted. Please make sure you are using RSA keys. Thanks.
- Demonstrate Bug (older Tiki versions)
-
This bug has been demonstrated on show.tikiwiki.org
Please demonstrate your bug on show.tikiwiki.org
Show.tiki.org is not configured properlyThe public/private keys configured to connect to show.tikiwiki.org were not accepted. Please make sure you are using RSA keys. Thanks.
- Ticket ID
- 7198
- Created
- Wednesday 23 October, 2019 03:38:44 UTC
by amorangi - LastModif
- Thursday 24 October, 2019 04:25:28 UTC