Lookup previous payment and verify all is good.

This commit is contained in:
Bradley M. Kuhn 2018-07-22 14:33:12 -07:00
parent 9b7858843b
commit 0f0b60eada

View file

@ -118,6 +118,38 @@ while (my $file = readdir $dh) {
last if (defined $ticket);
}
}
if (not defined $ticket) {
if (not $INTERACTIVE) {
print STDERR "\"$file\": Skipped: unable to to find a matching ticket.\n";
next;
} else {
# FIXME: prompt for ticket
die "interactive mode not yet supported";
}
}
if ($PAYMENT_NUMBER == 1) {
print STDERR "Sorry, script does not yet support first payment\n";
exit 1;
}
# Check to see if this payment was already made
my $thisPayDate = PaymentDateByTicket($ticket, $PAYMENT_NUMBER);
if (defined $thisPayDate) {
print STDERR "\"$file\": \"$ticket\": Skipped: payment $PAYMENT_NUMBER was already made";
if ($pass) {
print STDERR ".\n";
} else {
print STDERR "... BIG PROBLEM: the intern actually failed but got this payment.\n";
}
}
# Check to see if previous payment was sent payment
my $prevPay = $PAYMENT_NUMBER - 1;
my $lastPayDate = PaymentDateByTicket($ticket, $prevPay);
if ($pass and (not defined $lastPayDate)) {
print STDERR "\"$file\": \"$ticket\": Skipped: payment $prevPay was not made yet.\n";
next;
}
}
###############################################################################
#