Handle activated travel reimbursement tickets properly.
Travel reimbursement tickets might already be activated. We track activation by leaving them to "dependson" the main travel ticket, and hav them only refersto relationship once activated. In cases where the dependson link does not exist, then we should send notice upon failure when rejecting the ticket.
This commit is contained in:
parent
c3a368d29f
commit
afb3bbc340
1 changed files with 21 additions and 1 deletions
|
@ -316,7 +316,27 @@ LEDGER_ENTRY
|
||||||
} else {
|
} else {
|
||||||
system($RT_CMD, "edit", $ticket, 'set', 'Status=entered');
|
system($RT_CMD, "edit", $ticket, 'set', 'Status=entered');
|
||||||
}
|
}
|
||||||
system($RT_CMD, "link", '-d', $reimbursementTicket, 'dependson', $TRAVEL_NOTICE_TICKET);
|
open(my $delTravelDependsFH, "-|", $RT_CMD, "link", '-d',
|
||||||
|
$reimbursementTicket, 'dependson', $TRAVEL_NOTICE_TICKET);
|
||||||
|
my $found;
|
||||||
|
while (my $line = <$delTravelDependsFH>) {
|
||||||
|
if ($line =~ /Link\s+not\s+found/i) {
|
||||||
|
$found = 0;
|
||||||
|
} elsif ($line =~ /no\s+longer\s+depends\s+on\s+Ticket/i) {
|
||||||
|
$found = 1;
|
||||||
|
}
|
||||||
|
last if defined $found;
|
||||||
|
}
|
||||||
|
close $delTravelDependsFH;
|
||||||
|
if (not defined $found) {
|
||||||
|
print STDERR "\"$file\": \"$ticket\": WARNING: unable to determin what to do about Travel ticket, $TRAVEL_NOTICE_TICKET... ";
|
||||||
|
} else {
|
||||||
|
# This means we already activiated this travel ticket, so we have to explain to the intern
|
||||||
|
open(my $travelTicketCorrespondFH, "|-", $RT_CMD, 'correspond', $reimbursementTicket, '-m', '-');
|
||||||
|
print $rtCorrespondFH "Previously, you received notice about your travel stipend. Please be advised that due to your failure in your internship, you no longer have a travel stipend budget.\n\n";
|
||||||
|
print $rtCorrespondFH @dd;
|
||||||
|
close $rtCorrespondFH;
|
||||||
|
}
|
||||||
system($RT_CMD, "edit", $reimbursementTicket, 'set', 'Status=open');
|
system($RT_CMD, "edit", $reimbursementTicket, 'set', 'Status=open');
|
||||||
system($RT_CMD, "edit", $reimbursementTicket, 'set', 'Status=rejected');
|
system($RT_CMD, "edit", $reimbursementTicket, 'set', 'Status=rejected');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue