Support lookup of reimbursement ticket
This commit is contained in:
parent
dcbf4bac2c
commit
48ec393a01
1 changed files with 26 additions and 0 deletions
|
@ -95,6 +95,27 @@ sub FindTaxTicketFromList(@) {
|
|||
return $taxTicket;
|
||||
}
|
||||
###############################################################################
|
||||
sub FindReimbursementTicketFromList(@) {
|
||||
my $reimbursementTicket;
|
||||
foreach my $ticket (@_) {
|
||||
$ticket =~ s%\s*ticket/?\s*(\d+)\s*%$1%;
|
||||
open(my $rtReimburseFH, "-|", "$RT_CMD", "ls", "-i", 'Queue = accounts-payable AND ' .
|
||||
"Subject LIKE 'reimbursement' and Subject LIKE 'travel' and id = " . $ticket);
|
||||
while (my $reimburseLine = <$rtReimburseFH>) {
|
||||
if ($reimburseLine =~ m%\s*ticket\s*/?\s*(\d+)\s*$%) {
|
||||
my $tt = $1;
|
||||
if ($tt == $ticket) {
|
||||
$reimbursementTicket = $ticket;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
close $rtReimburseFH;
|
||||
last if defined $reimbursementTicket;
|
||||
}
|
||||
return $reimbursementTicket;
|
||||
}
|
||||
###############################################################################
|
||||
sub GetStatusFromTicket($) {
|
||||
my($ticketSpec) = @_;
|
||||
my $status;
|
||||
|
@ -260,6 +281,11 @@ while (my $file = readdir $dh) {
|
|||
print STDERR "\"$file\": \"$ticket\": Skipped: no tax ticket found.\n";
|
||||
next;
|
||||
}
|
||||
my $reimbursementTicket = FindReimbursementTicketFromList(@links);
|
||||
if (not defined $reimbursementTicket) {
|
||||
print STDERR "\"$file\": \"$ticket\": Skipped: no reimbursement ticket found.\n";
|
||||
next;
|
||||
}
|
||||
print STDERR "\"$file\": \"$ticket\": found a tax ticket of \"$taxTicket\"\n" if ($VERBOSE > 5);
|
||||
my $taxTicketStatus = GetStatusFromTicket($taxTicket);
|
||||
if ($taxTicketStatus ne "resolved") {
|
||||
|
|
Loading…
Reference in a new issue