Move Entity lookup until after ticket is found.

This commit is contained in:
Bradley M. Kuhn 2018-07-22 15:08:45 -07:00
parent cb49fb5c3e
commit cebb1d813b

View file

@ -169,12 +169,6 @@ while (my $file = readdir $dh) {
next; next;
} }
# Find the ticket number for this intern.
my $entity = LedgerTagFromTicket($ticket, 'Entity');
if (not defined $entity) {
print STDERR "\"$file\": \"$ticket\": Skipping: cannot determine Entity from ticket." ;
next;
}
my(@nameComponents) = split(/\s*-\s*/, $name); my(@nameComponents) = split(/\s*-\s*/, $name);
my(@searchTerms); my(@searchTerms);
foreach my $name (@nameComponents) { foreach my $name (@nameComponents) {
@ -196,7 +190,14 @@ while (my $file = readdir $dh) {
die "interactive mode not yet supported"; die "interactive mode not yet supported";
} }
} }
if ($PAYMENT_NUMBER == 1) { # Find the ticket number for this intern.
my $entity = LedgerTagFromTicket($ticket, 'Entity');
if (not defined $entity) {
print STDERR "\"$file\": \"$ticket\": Skipping: cannot determine Entity from ticket." ;
next;
}
if ($PAYMENT_NUMBER <= 1) {
print STDERR "Sorry, script does not yet support first payment\n"; print STDERR "Sorry, script does not yet support first payment\n";
exit 1; exit 1;
} }