From 3fb622ec06c82c10798ab72ed5ea6e72e0a0b1bf Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 9 Oct 2007 04:48:25 +0000 Subject: [PATCH] add ticket_system-priority_reverse config --- FS/FS/Conf.pm | 7 +++++++ FS/FS/TicketSystem/RT_External.pm | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index adf741350..5fe28b887 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -1652,6 +1652,13 @@ httemplate/docs/config.html }, { + 'key' => 'ticket_system-priority_reverse', + 'section' => '', + 'description' => 'Enable this to consider lower numbered priorities more important. A bad habit we picked up somewhere. You probably want to avoid it and use the default.', + 'type' => 'checkbox', + }, + + { 'key' => 'ticket_system-custom_priority_field', 'section' => '', 'description' => 'Custom field from the ticketing system to use as a custom priority classification.', diff --git a/FS/FS/TicketSystem/RT_External.pm b/FS/FS/TicketSystem/RT_External.pm index cd6834c96..0b9a98e0e 100644 --- a/FS/FS/TicketSystem/RT_External.pm +++ b/FS/FS/TicketSystem/RT_External.pm @@ -2,6 +2,7 @@ package FS::TicketSystem::RT_External; use strict; use vars qw( $DEBUG $me $conf $dbh $default_queueid $external_url + $priority_reverse $priority_field $priority_field_queue $field ); use URI::Escape; @@ -15,6 +16,7 @@ $DEBUG = 0; FS::UID->install_callback( sub { $conf = new FS::Conf; $default_queueid = $conf->config('ticket_system-default_queueid'); + $priority_reverse = $conf->exists('ticket_system-priority_reverse'); $priority_field = $conf->config('ticket_system-custom_priority_field'); if ( $priority_field ) { @@ -75,7 +77,11 @@ sub customer_tickets { "position(tickets.status in 'newopenstalledresolvedrejecteddeleted')". " AS svalue " . ( length($priority) ? ", objectcustomfieldvalues.content" : '' ). - " $from_sql ORDER BY svalue, priority DESC, id DESC LIMIT $limit"; + " $from_sql ". + " ORDER BY svalue, ". + " priority ". ( $priority_reverse ? 'ASC' : 'DESC' ). ", ". + " id DESC ". + " LIMIT $limit"; warn "$me $sql (@param)" if $DEBUG; my $sth = $dbh->prepare($sql) or die $dbh->errstr. "preparing $sql"; $sth->execute(@param) or die $sth->errstr. "executing $sql"; -- 2.11.0