From 9c7a83865cc89cd74875c5872723f8d19fada0e6 Mon Sep 17 00:00:00 2001 From: JediKev <kevin@enhancesoft.com> Date: Tue, 24 Jul 2018 12:41:28 -0500 Subject: [PATCH] issue: Client Side Column Sorting This addresses an issue where client side column sorting does not work at all. This is due to the if/else statement that checks for a REQUEST sort order and if the REQUEST sort order matches an `$orderWays` array value. The if statement returns TRUE for DESC and sets the sort order to DESC as it equals '-' (a dash) but ASC equals '' (an empty string) so it returns FALSE which fails-over to the else statement setting the sort order to DESC. In addition, this adds sorting icons the the column headers to make it more obvious they are sortable. --- include/client/tickets.inc.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/client/tickets.inc.php b/include/client/tickets.inc.php index b7e536fc3..9e678e31c 100644 --- a/include/client/tickets.inc.php +++ b/include/client/tickets.inc.php @@ -47,7 +47,7 @@ if($sort && $sortOptions[$sort]) $order_by =$sortOptions[$sort]; $order_by=$order_by ?: $sortOptions['date']; -if ($_REQUEST['order'] && $orderWays[strtoupper($_REQUEST['order'])]) +if ($_REQUEST['order'] && !is_null($orderWays[strtoupper($_REQUEST['order'])])) $order = $orderWays[strtoupper($_REQUEST['order'])]; else $order = $orderWays['DESC']; @@ -205,19 +205,19 @@ if ($closedTickets) {?> <thead> <tr> <th nowrap> - <a href="tickets.php?sort=ID&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Ticket ID"><?php echo __('Ticket #');?></a> + <a href="tickets.php?sort=ID&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Ticket ID"><?php echo __('Ticket #');?><i class="icon-sort"></i></a> </th> <th width="120"> - <a href="tickets.php?sort=date&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Date"><?php echo __('Create Date');?></a> + <a href="tickets.php?sort=date&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Date"><?php echo __('Create Date');?><i class="icon-sort"></i></a> </th> <th width="100"> - <a href="tickets.php?sort=status&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Status"><?php echo __('Status');?></a> + <a href="tickets.php?sort=status&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Status"><?php echo __('Status');?><i class="icon-sort"></i></a> </th> <th width="320"> - <a href="tickets.php?sort=subj&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Subject"><?php echo __('Subject');?></a> + <a href="tickets.php?sort=subj&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Subject"><?php echo __('Subject');?><i class="icon-sort"></i></a> </th> <th width="120"> - <a href="tickets.php?sort=dept&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Department"><?php echo __('Department');?></a> + <a href="tickets.php?sort=dept&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Department"><?php echo __('Department');?><i class="icon-sort"></i></a> </th> </tr> </thead> -- GitLab