diff options
author | mark <mark> | 2011-08-24 21:00:45 +0000 |
---|---|---|
committer | mark <mark> | 2011-08-24 21:00:45 +0000 |
commit | 3805d9b6fef0f8627bd74066cfd28d279ae5341a (patch) | |
tree | 80e07ad2281a535c8ada9afc9249d169be14e678 /httemplate/view | |
parent | 4c8c18409f82d56320a80f6c94f275fa15486897 (diff) |
selfservice priority sort order, #14029
Diffstat (limited to 'httemplate/view')
-rw-r--r-- | httemplate/view/cust_main/tickets.html | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/httemplate/view/cust_main/tickets.html b/httemplate/view/cust_main/tickets.html index 863c66be4..adfaead6e 100644 --- a/httemplate/view/cust_main/tickets.html +++ b/httemplate/view/cust_main/tickets.html @@ -133,11 +133,22 @@ my $new_link = FS::TicketSystem->href_new_ticket( $cust_main ); my $ss_priority = FS::TicketSystem->selfservice_priority; if ( $ss_priority ) { + my $dir = $conf->exists('ticket_system-priority_reverse') ? -1 : 1; use sort 'stable'; - no warnings 'uninitialized'; + # sort in the following way: @tickets = sort { - ($b->{'content'} eq $a->{'content'}) && - $b->{'_selfservice_priority'} <=> $a->{'_selfservice_priority'} + # within a severity level... + ( $a->{'content'} eq $b->{'content'} ) ? ( + # no-priority tickets sort last + ( + ($a->{'_selfservice_priority'} eq '') <=> + ($b->{'_selfservice_priority'} eq '') + ) || + # otherwise obey ticket_system-priority_reverse + ( $dir * + ($b->{'_selfservice_priority'} <=> $a->{'_selfservice_priority'}) + ) + ) : 0; # but don't rearrange between severity levels } @tickets; } |