},
{
+ '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.',
use strict;
use vars qw( $DEBUG $me $conf $dbh $default_queueid $external_url
+ $priority_reverse
$priority_field $priority_field_queue $field
);
use URI::Escape;
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 ) {
"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";