X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2FTicketSystem%2FRT_External.pm;h=234363a0439b8cb1b2a87c23eda0d3da6685ea11;hp=7dde8622814580be28b912ac61fa5d0dda5024fe;hb=194c053a60b8839c3cfc6a24efe0b8aeb286f31c;hpb=011655eed8c44c354efa49979d39e2c32f678454 diff --git a/FS/FS/TicketSystem/RT_External.pm b/FS/FS/TicketSystem/RT_External.pm index 7dde86228..234363a04 100644 --- a/FS/FS/TicketSystem/RT_External.pm +++ b/FS/FS/TicketSystem/RT_External.pm @@ -55,9 +55,11 @@ sub customer_tickets { $limit ||= 0; my( $from_sql, @param) = $self->_from_customer( $custnum, $priority ); - my $sql = "SELECT tickets.*, queues.name". - ( length($priority) ? ", objectcustomfieldvalues.content" : '' ). - " $from_sql ORDER BY priority, id DESC LIMIT $limit"; + my $sql="SELECT tickets.*, queues.name, ". + "position(tickets.status in 'newopenstalledresolvedrejecteddeleted')". + " AS svalue " . + ( length($priority) ? ", objectcustomfieldvalues.content" : '' ). + " $from_sql ORDER BY priority, svalue, id DESC LIMIT $limit"; my $sth = $dbh->prepare($sql) or die $dbh->errstr. "preparing $sql"; $sth->execute(@param) or die $sth->errstr. "executing $sql";