summaryrefslogtreecommitdiff
path: root/FS/FS/TicketSystem
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-07-02 11:53:40 -0700
committerIvan Kohler <ivan@freeside.biz>2013-07-02 11:53:40 -0700
commita563de5fc2f42abf16fbcfda7cf5bc5f1ce794e7 (patch)
tree21ed995983a9ef1f51055c8e4c6c6300863c5c66 /FS/FS/TicketSystem
parent93f2d729dcc5c1bbf424a61ee49b985a4e3ed1d6 (diff)
selfservice, TNG, RT#22193
Diffstat (limited to 'FS/FS/TicketSystem')
-rw-r--r--FS/FS/TicketSystem/RT_Internal.pm27
1 files changed, 23 insertions, 4 deletions
diff --git a/FS/FS/TicketSystem/RT_Internal.pm b/FS/FS/TicketSystem/RT_Internal.pm
index 665c166..d0913d8 100644
--- a/FS/FS/TicketSystem/RT_Internal.pm
+++ b/FS/FS/TicketSystem/RT_Internal.pm
@@ -111,7 +111,7 @@ properly.
# create an RT::Tickets object for a specified custnum or svcnum
sub _tickets_search {
- my ( $self, $type, $number, $limit, $priority ) = @_;
+ my( $self, $type, $number, $limit, $priority, $status ) = @_;
$type =~ /^Customer|Service$/ or die "invalid type: $type";
$number =~ /^\d+$/ or die "invalid custnum/svcnum: $number";
@@ -136,9 +136,28 @@ sub _tickets_search {
}
}
- $rtql .= ' AND ( ' .
- join(' OR ', map { "Status = '$_'" } $self->statuses) .
- ' )';
+ my @statuses;
+ if ( defined($status) && $status ) {
+ if ( ref($status) ) {
+ if ( ref($status) eq 'HASH' ) {
+ @statuses = grep $status->{$_}, keys %$status;
+ } elsif ( ref($status) eq 'ARRAY' ) {
+ @statuses = @$status;
+ } else {
+ #what should be the failure mode here? die? return no tickets?
+ die 'unknown status ref '. ref($status);
+ }
+ } else {
+ @statuses = ( $status );
+ }
+ @statuses = grep /^\w+$/, @statuses; #injection prevention
+ } else {
+ @statuses = $self->statuses;
+ }
+
+ $rtql .= ' AND ( '.
+ join(' OR ', map { "Status = '$_'" } @statuses).
+ ' ) ';
warn "$me _customer_tickets_search:\n$rtql\n" if $DEBUG;
$Tickets->FromSQL($rtql);