Add Travel notice ticket link, and fix RT commands.

This commit is contained in:
Bradley M. Kuhn 2018-07-25 09:40:19 -07:00
parent 5697b6beee
commit 052d32fc5e

View file

@ -12,7 +12,7 @@ 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, $ROUND);
$INTERN_FAIL_FILE, $LEDGER_ENTRY_DATE, $SVN_CMD, $ROUND, $TRAVEL_NOTICE_TICKET);
###############################################################################
sub FindUniqueTicket(@) {
@ -169,13 +169,18 @@ 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, "round=s" => \$ROUND);
"svnCommand=s" => \$SVN_CMD, "round=s" => \$ROUND,
'travelNoticeTicket=i' => \$TRAVEL_NOTICE_TICKET);
$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 $TRAVEL_NOTICE_TICKET) {
print STDERR "usage: $0 --travelNoticeTicket=<TICKET_NUMBER> option is required and must be an integer\n";
exit 1;
}
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;
@ -399,14 +404,16 @@ LEDGER_ENTRY
;
close $ledgerEntryFH;
} else {
system($RT_CMD, "edit", $reimbursementTicket, 'Status=open');
system($RT_CMD, "edit", $reimbursementTicket, 'Status=rejected');
system($RT_CMD, "edit", $ticket, 'set', 'CF.{completed-internship}=unsuccessful');
if ($PAYMENT_NUMBER == 1) {
system($RT_CMD, "edit", $taxTicketStatus, 'Status=rejected');
system($RT_CMD, "edit", $ticket, 'Status=rejected');
system($RT_CMD, "edit", $taxTicketStatus, 'set', 'Status=rejected');
system($RT_CMD, "edit", $ticket, 'set', 'Status=rejected');
} else {
system($RT_CMD, "edit", $ticket, 'Status=entered');
system($RT_CMD, "edit", $ticket, 'set', 'Status=entered');
}
system($RT_CMD, "link", '-d', $reimbursementTicket, 'dependson', $TRAVEL_NOTICE_TICKET);
system($RT_CMD, "edit", $reimbursementTicket, 'set', 'Status=open');
system($RT_CMD, "edit", $reimbursementTicket, 'set', 'Status=rejected');
}
print STDERR "...done\n";
print STDERR "Waiting? ";