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;
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;
}
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);
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;
}
}
# 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}"};