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;
|
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($) {
|
sub GetStatusFromTicket($) {
|
||||||
my($ticketSpec) = @_;
|
my($ticketSpec) = @_;
|
||||||
my $status;
|
my $status;
|
||||||
|
@ -260,6 +281,11 @@ while (my $file = readdir $dh) {
|
||||||
print STDERR "\"$file\": \"$ticket\": Skipped: no tax ticket found.\n";
|
print STDERR "\"$file\": \"$ticket\": Skipped: no tax ticket found.\n";
|
||||||
next;
|
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);
|
print STDERR "\"$file\": \"$ticket\": found a tax ticket of \"$taxTicket\"\n" if ($VERBOSE > 5);
|
||||||
my $taxTicketStatus = GetStatusFromTicket($taxTicket);
|
my $taxTicketStatus = GetStatusFromTicket($taxTicket);
|
||||||
if ($taxTicketStatus ne "resolved") {
|
if ($taxTicketStatus ne "resolved") {
|
||||||
|
|
Loading…
Reference in a new issue