FindReimbursementTicketFromList: move to rt-helper.pl
This commit is contained in:
parent
38f7b0cedc
commit
5d074729bd
2 changed files with 22 additions and 22 deletions
|
@ -105,6 +105,28 @@ sub GetCustomFieldForTicket($$) {
|
|||
return $val;
|
||||
}
|
||||
###############################################################################
|
||||
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 ' .
|
||||
"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*$%) {
|
||||
my $tt = $1;
|
||||
if ($tt == $ticket) {
|
||||
$reimbursementTicket = $ticket;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
close $rtReimburseFH;
|
||||
last if defined $reimbursementTicket;
|
||||
}
|
||||
return $reimbursementTicket;
|
||||
}
|
||||
###############################################################################
|
||||
1;
|
||||
###############################################################################
|
||||
#
|
||||
|
|
|
@ -68,28 +68,6 @@ 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 ' .
|
||||
"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*$%) {
|
||||
my $tt = $1;
|
||||
if ($tt == $ticket) {
|
||||
$reimbursementTicket = $ticket;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
close $rtReimburseFH;
|
||||
last if defined $reimbursementTicket;
|
||||
}
|
||||
return $reimbursementTicket;
|
||||
}
|
||||
###############################################################################
|
||||
|
||||
GetOptions("paymentDir=s" => \$PAYMENT_DIR, "verbose=i" => \$VERBOSE, "interactive" => \$INTERACTIVE,
|
||||
"paymentNumber=i" => \$PAYMENT_NUMBER, "rtCommand=s" => \$RT_CMD,
|
||||
|
|
Loading…
Reference in a new issue