From c598fcf11241b02111a2df43860199ae8a9d5512 Mon Sep 17 00:00:00 2001 From: mark Date: Thu, 21 Jul 2011 23:29:44 +0000 Subject: [PATCH] ticket display sort order, #13199 --- FS/FS/TicketSystem/RT_Internal.pm | 11 +++-------- fs_selfservice/FS-SelfService/cgi/ticket_summary.html | 6 ++++++ httemplate/view/cust_main/misc.html | 9 +++++++++ httemplate/view/cust_main/tickets.html | 8 ++++++++ 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/FS/FS/TicketSystem/RT_Internal.pm b/FS/FS/TicketSystem/RT_Internal.pm index 31a6715d0..d96e5f05f 100644 --- a/FS/FS/TicketSystem/RT_Internal.pm +++ b/FS/FS/TicketSystem/RT_Internal.pm @@ -150,17 +150,11 @@ sub customer_tickets { my $conf = FS::Conf->new; my $priority_order = $conf->exists('ticket_system-priority_reverse') ? 'ASC' : 'DESC'; - my $custom_priority = - $conf->config('ticket_system-custom_priority_field') || ''; - my @order_by; - my $ss_priority = selfservice_priority(); - push @order_by, { FIELD => "CF.{$ss_priority}", ORDER => $priority_order } - if $ss_priority; - push @order_by, + my @order_by = ( { FIELD => 'Priority', ORDER => $priority_order }, { FIELD => 'Id', ORDER => 'DESC' }, - ; + ); $Tickets->OrderByCols(@order_by); @@ -168,6 +162,7 @@ sub customer_tickets { while ( my $t = $Tickets->Next ) { push @tickets, _ticket_info($t); } + return \@tickets; } diff --git a/fs_selfservice/FS-SelfService/cgi/ticket_summary.html b/fs_selfservice/FS-SelfService/cgi/ticket_summary.html index fc50f872f..781b1e763 100644 --- a/fs_selfservice/FS-SelfService/cgi/ticket_summary.html +++ b/fs_selfservice/FS-SelfService/cgi/ticket_summary.html @@ -10,6 +10,12 @@ my $col = $col1; my $can_set_priority = grep { exists($_->{'_selfservice_priority'}) } @tickets; if ( $can_set_priority ) { + use sort 'stable'; + @tickets = sort { + ($b->{'_selfservice_priority'} || 0) <=> + ($a->{'_selfservice_priority'} || 0) + } @tickets; + $OUT .= qq!
! . qq!! . qq!!; diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html index ed9b91a61..5987459a5 100644 --- a/httemplate/view/cust_main/misc.html +++ b/httemplate/view/cust_main/misc.html @@ -125,6 +125,15 @@ % } +% if ( $conf->exists('ticket_system-selfservice_edit_subject') ) { + + + <% mt('Edit ticket subjects') %> + <% $cust_main->edit_subject ? 'yes' : 'no' %> + + +% } + <%init> diff --git a/httemplate/view/cust_main/tickets.html b/httemplate/view/cust_main/tickets.html index e0262b895..863c66be4 100644 --- a/httemplate/view/cust_main/tickets.html +++ b/httemplate/view/cust_main/tickets.html @@ -132,6 +132,14 @@ my( $new_base, %new_param ) = my $new_link = FS::TicketSystem->href_new_ticket( $cust_main ); my $ss_priority = FS::TicketSystem->selfservice_priority; +if ( $ss_priority ) { + use sort 'stable'; + no warnings 'uninitialized'; + @tickets = sort { + ($b->{'content'} eq $a->{'content'}) && + $b->{'_selfservice_priority'} <=> $a->{'_selfservice_priority'} + } @tickets; +} my $format = $conf->config('date_format') || '%Y-%m-%d'; -- 2.11.0