Adapt function to take round as an argument.

This commit is contained in:
Bradley M. Kuhn 2018-08-05 19:28:04 -07:00
parent 5d074729bd
commit 608477135d
2 changed files with 5 additions and 4 deletions

View file

@ -105,12 +105,13 @@ sub GetCustomFieldForTicket($$) {
return $val;
}
###############################################################################
sub FindReimbursementTicketFromList(@) {
sub FindReimbursementTicketFromList($@) {
my($round, @ticketList) = @_;
my $reimbursementTicket;
foreach my $ticket (@_) {
foreach my $ticket (@ticketList) {
$ticket =~ s%\s*ticket/?\s*(\d+)\s*%$1%;
open(my $rtReimburseFH, "-|", "$RT_CMD", "ls", "-i", 'Queue = accounts-payable AND ' .
"AND Subject LIKE '" . $ROUND .
"AND Subject LIKE '" . $round .
"' AND (Subject LIKE 'reimbursement' OR Subject LIKE 'travel') and id = " . $ticket);
while (my $reimburseLine = <$rtReimburseFH>) {
if ($reimburseLine =~ m%\s*ticket\s*/?\s*(\d+)\s*$%) {

View file

@ -238,7 +238,7 @@ while (my $file = readdir $dh) {
print STDERR "\"$file\": \"$ticket\": Skipped: no tax ticket found.\n";
next;
}
my $reimbursementTicket = FindReimbursementTicketFromList(@{$links{Members}});
my $reimbursementTicket = FindReimbursementTicketFromList($ROUND, @{$links{Members}});
if (not defined $reimbursementTicket) {
print STDERR "\"$file\": \"$ticket\": Skipped: no reimbursement ticket found.\n";
next;