OneTicketPerRequestor: Catch and report errors in the ticket search.
This commit is contained in:
parent
daeabc1aa6
commit
d7a24b0f97
1 changed files with 20 additions and 15 deletions
|
@ -77,22 +77,27 @@ sub BeforeDecrypt {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $ticket_search = RT::Tickets->new($RT::SystemUser);
|
my $dest_ticket = eval {
|
||||||
$ticket_search->LimitQueue(
|
my $ticket_search = RT::Tickets->new($RT::SystemUser);
|
||||||
OPERATOR => "=",
|
$ticket_search->LimitQueue(
|
||||||
VALUE => $queue_name,
|
OPERATOR => "=",
|
||||||
);
|
VALUE => $queue_name,
|
||||||
$ticket_search->LimitWatcher(
|
);
|
||||||
TYPE => "Requestor",
|
$ticket_search->LimitWatcher(
|
||||||
OPERATOR => "=",
|
TYPE => "Requestor",
|
||||||
VALUE => $from_address,
|
OPERATOR => "=",
|
||||||
);
|
VALUE => $from_address,
|
||||||
foreach my $sort_args (@$sort_orders) {
|
);
|
||||||
$ticket_search->OrderBy(@$sort_args);
|
foreach my $sort_args (@$sort_orders) {
|
||||||
|
$ticket_search->OrderBy(@$sort_args);
|
||||||
|
}
|
||||||
|
$ticket_search->First;
|
||||||
|
};
|
||||||
|
if ($@) {
|
||||||
|
$RT::Logger->debug("OTPR stopping: Ticket search died: $@");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
elsif (!defined($dest_ticket)) {
|
||||||
my $dest_ticket = $ticket_search->First;
|
|
||||||
if (!defined($dest_ticket)) {
|
|
||||||
$RT::Logger->debug(sprintf("OTPR stopping: No ticket found from <%s> in queue %s",
|
$RT::Logger->debug(sprintf("OTPR stopping: No ticket found from <%s> in queue %s",
|
||||||
$from_address, $queue_name));
|
$from_address, $queue_name));
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue