summaryrefslogtreecommitdiff
path: root/FS/FS/TicketSystem
diff options
context:
space:
mode:
authorivan <ivan>2007-03-02 06:24:22 +0000
committerivan <ivan>2007-03-02 06:24:22 +0000
commita0290148dced03b17bd75d93e640e5ef5e8a28e3 (patch)
treefe772568fa4f7edfd5f54b7e887e0946f6a4baaf /FS/FS/TicketSystem
parent92fc1fd3db74e352e09b2f362dba605f8c6f16e8 (diff)
fix custom priority fields, whew
Diffstat (limited to 'FS/FS/TicketSystem')
-rw-r--r--FS/FS/TicketSystem/RT_External.pm21
1 files changed, 19 insertions, 2 deletions
diff --git a/FS/FS/TicketSystem/RT_External.pm b/FS/FS/TicketSystem/RT_External.pm
index 3a0d6f0..dda835c 100644
--- a/FS/FS/TicketSystem/RT_External.pm
+++ b/FS/FS/TicketSystem/RT_External.pm
@@ -1,14 +1,17 @@
package FS::TicketSystem::RT_External;
use strict;
-use vars qw( $conf $default_queueid
+use vars qw( $DEBUG $me $conf $dbh $default_queueid $external_url
$priority_field $priority_field_queue $field
- $dbh $external_url );
+ );
use URI::Escape;
use FS::UID qw(dbh);
use FS::Record qw(qsearchs);
use FS::cust_main;
+$me = '[FS::TicketSystem::RT_External]';
+$DEBUG = 0;
+
FS::UID->install_callback( sub {
$conf = new FS::Conf;
$default_queueid = $conf->config('ticket_system-default_queueid');
@@ -17,6 +20,7 @@ FS::UID->install_callback( sub {
if ( $priority_field ) {
$priority_field_queue =
$conf->config('ticket_system-custom_priority_field_queue');
+
$field = $priority_field_queue
? $priority_field_queue. '.%7B'. $priority_field. '%7D'
: $priority_field;
@@ -35,6 +39,17 @@ FS::UID->install_callback( sub {
$external_url = $conf->config('ticket_system-rt_external_url');
}
+ #kludge... should *use* the id... but good enough for now
+ if ( $priority_field_queue =~ /^(\d+)$/ ) {
+ my $id = $1;
+ my $sql = 'SELECT Name FROM Queues WHERE Id = ?';
+ my $sth = $dbh->prepare($sql) or die $dbh->errstr. " preparing $sql";
+ $sth->execute($id) or die $sth->errstr. " executing $sql";
+
+ $priority_field_queue = $sth->fetchrow_arrayref->[0];
+
+ }
+
} );
sub num_customer_tickets {
@@ -43,6 +58,7 @@ sub num_customer_tickets {
my( $from_sql, @param) = $self->_from_customer( $custnum, $priority );
my $sql = "SELECT COUNT(*) $from_sql";
+ 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";
@@ -60,6 +76,7 @@ sub customer_tickets {
" AS svalue " .
( length($priority) ? ", objectcustomfieldvalues.content" : '' ).
" $from_sql ORDER BY svalue, priority 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";