X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2FTicketSystem%2FRT_Internal.pm;h=d96e5f05f64cdbae5daf3b732d140dd8212ab10e;hp=220b4a0111d002c49ae86c43cd625befc9639a25;hb=c598fcf11241b02111a2df43860199ae8a9d5512;hpb=12f4cc4b100b849de3584d5d1a2376cebcd8729f diff --git a/FS/FS/TicketSystem/RT_Internal.pm b/FS/FS/TicketSystem/RT_Internal.pm index 220b4a011..d96e5f05f 100644 --- a/FS/FS/TicketSystem/RT_Internal.pm +++ b/FS/FS/TicketSystem/RT_Internal.pm @@ -50,7 +50,7 @@ sub access_right { sub session { my( $self, $session ) = @_; - if ( $session && $session->{'Current_User'} ) { + if ( $session && $session->{'Current_User'} ) { # does this even work? warn "$me session: using existing session and CurrentUser: \n". Dumper($session->{'CurrentUser'}) if $DEBUG; @@ -123,16 +123,23 @@ sub _customer_tickets_search { if ( defined( $priority ) ) { my $custom_priority = FS::Conf->new->config('ticket_system-custom_priority_field'); - $rtql .= " AND CF.{$custom_priority} = '$priority'"; + if ( length( $priority ) ) { + $rtql .= " AND CF.{$custom_priority} = '$priority'"; + } + else { + $rtql .= " AND CF.{$custom_priority} IS NULL"; + } } $rtql .= ' AND ( ' . join(' OR ', map { "Status = '$_'" } $self->statuses) . ' )'; + warn "$me _customer_tickets_search:\n$rtql\n" if $DEBUG; $Tickets->FromSQL($rtql); $Tickets->RowsPerPage($limit); + warn "\n\n" . $Tickets->BuildSelectQuery . "\n\n" if $DEBUG > 1; return $Tickets; } @@ -143,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); @@ -161,11 +162,13 @@ sub customer_tickets { while ( my $t = $Tickets->Next ) { push @tickets, _ticket_info($t); } + return \@tickets; } sub num_customer_tickets { - my $Tickets = _customer_tickets_search(@_); + my ( $self, $custnum, $priority ) = @_; + my $Tickets = $self->_customer_tickets_search($custnum, 0, $priority); return $Tickets->CountAll; } @@ -192,7 +195,7 @@ sub _ticket_info { } # make this easy to find if ( $custom_priority ) { - $ticket_info{'_custom_priority'} = $ticket_info{"CF.{$custom_priority}"}; + $ticket_info{'content'} = $ticket_info{"CF.{$custom_priority}"}; } if ( $ss_priority ) { $ticket_info{'_selfservice_priority'} = $ticket_info{"CF.{$ss_priority}"};