Add --round CLI argument; use that round for search criterion.
This commit is contained in:
parent
8aa05bff6d
commit
5697b6beee
1 changed files with 10 additions and 4 deletions
|
@ -12,12 +12,13 @@ use File::Spec;
|
|||
use Date::Manip qw(ParseDate UnixDate);
|
||||
|
||||
my($PAYMENT_DIR, $VERBOSE, $INTERACTIVE, $PAYMENT_NUMBER, $RT_CMD, $INVOICE_LINE, $INTERN_SUCCESS_FILE,
|
||||
$INTERN_FAIL_FILE, $LEDGER_ENTRY_DATE, $SVN_CMD);
|
||||
$INTERN_FAIL_FILE, $LEDGER_ENTRY_DATE, $SVN_CMD, $ROUND);
|
||||
|
||||
###############################################################################
|
||||
sub FindUniqueTicket(@) {
|
||||
my @searchTerms = @_;
|
||||
open(my $rtLsFH, "-|", "$RT_CMD", "ls", "-i", 'Queue = outreachy-interns AND ' .
|
||||
open(my $rtLsFH, "-|", "$RT_CMD", "ls", "-i", 'Queue = outreachy-interns ' .
|
||||
"AND Subject LIKE '" . $ROUND . "' AND" .
|
||||
join(" AND ", @searchTerms));
|
||||
my $ticketSpec;
|
||||
while (my $lsLine = <$rtLsFH>) {
|
||||
|
@ -117,7 +118,8 @@ sub FindReimbursementTicketFromList(@) {
|
|||
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' OR Subject LIKE 'travel') and id = " . $ticket);
|
||||
"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;
|
||||
|
@ -167,13 +169,17 @@ GetOptions("paymentDir=s" => \$PAYMENT_DIR, "verbose=i" => \$VERBOSE, "interacti
|
|||
"paymentNumber=i" => \$PAYMENT_NUMBER, "rtCommand=s" => \$RT_CMD,
|
||||
"invoiceLine=s" => \$INVOICE_LINE, "internSuccessFile=s", \$INTERN_SUCCESS_FILE,
|
||||
"internFailFile=s", \$INTERN_FAIL_FILE, 'ledgerEntryDate=s' => \$LEDGER_ENTRY_DATE,
|
||||
"svnCommand=s" => \$SVN_CMD);
|
||||
"svnCommand=s" => \$SVN_CMD, "round=s" => \$ROUND);
|
||||
|
||||
$RT_CMD = '/usr/bin/rt' unless defined $RT_CMD;
|
||||
$SVN_CMD = '/usr/bin/svn' unless defined $SVN_CMD;
|
||||
|
||||
$INTERACTIVE = 0 if not defined $INTERACTIVE;
|
||||
|
||||
unless (defined $ROUND and $ROUND =~ /^[\d\-]+$/) {
|
||||
print STDERR "usage: $0 --round=<YEAR-MONTH> option is required and must formated as YYYY-MM\n";
|
||||
exit 1;
|
||||
}
|
||||
unless (defined $LEDGER_ENTRY_DATE and $LEDGER_ENTRY_DATE =~ /^[\d\-]+$/) {
|
||||
print STDERR "usage: $0 --ledgerEntryDate=<DATE> option is required and must be in ISO 8601 format\n";
|
||||
exit 1;
|
||||
|
|
Loading…
Reference in a new issue