Fix evaluation of ticket traffic to find right mentor.
The regex /^\s*([^:]+)\s*:\s*(.+)$/ is very overzealous, so use it last; find all the other stuff we want first.
This commit is contained in:
parent
6ed5c75d85
commit
4775799a99
1 changed files with 14 additions and 8 deletions
|
@ -235,17 +235,15 @@ foreach my $ticket (@processList) {
|
|||
open(my $logFH, "-|", $RT_CMD, "show", $ticketNum);
|
||||
while (my $line = <$logFH>) {
|
||||
print STDERR "\"$ticket\": rt show $ticketNum line evaluation: $line" if ($VERBOSE > 8);
|
||||
if ($line =~ /^\s*([^:]+)\s*:\s*(.+)$/) {
|
||||
my($key, $val) = ($1, $2);
|
||||
# Note that this will take the last one used, since rt log gives ticket traffic IN ORDER.
|
||||
$paymentVals{$key} = $val if $key =~ /(CONTRACTED NAME|PAYMENT NAME|PAYMENT METHOD)/i;
|
||||
print STDERR "\"$ticket\": rt show $ticketNum line match: $key $val for $line" if ($VERBOSE > 7);
|
||||
if ($line =~ /status\s*changed.*to.*paid/i) {
|
||||
($pass, $mentorDate, $approvalTag) = (undef, undef, undef);
|
||||
print STDERR "\"$ticket\": rt show $ticketNum status change to paid at $line\n" if ($VERBOSE > 7);
|
||||
} elsif ($PAYMENT_NUMBER != 1 and (not defined $pass) and $line =~ /^\s*Payment\s+approved\s+by/) {
|
||||
$pass = 1;
|
||||
$line = <$logFH>;
|
||||
print STDERR "\"$ticket\": rt show $ticketNum mentorDate line evaluation: $line" if ($VERBOSE > 8);
|
||||
print STDERR "\"$ticket\": rt show $ticketNum mentorDate line evaluation: $line\n" if ($VERBOSE > 8);
|
||||
unless ($line =~ /^\s*on\s+([\d:\+\.\-\s]+)\s+from/) {
|
||||
print STDERR "\"$ticket\": Skipping: Found Payment approved but there is no proper date field.";
|
||||
print STDERR "\"$ticket\": Skipping: Found Payment approved but there is no proper date field.\n";
|
||||
next;
|
||||
}
|
||||
$mentorDate = $1;
|
||||
|
@ -255,7 +253,7 @@ foreach my $ticket (@processList) {
|
|||
next unless defined $mentorDate;
|
||||
my $attachmentNum;
|
||||
while (my $subLine = <$logFH>) {
|
||||
print STDERR "\"$ticket\": rt show $ticketNum sub-line evaluation: $subLine" if ($VERBOSE > 8);
|
||||
print STDERR "\"$ticket\": rt show $ticketNum sub-line evaluation: $subLine\n" if ($VERBOSE > 8);
|
||||
last if $subLine =~ /^\=\=\=\>\s+/;
|
||||
if ($subLine =~ /^\s+(\d+)\s*\:\s+/) {
|
||||
$attachmentNum = $1;
|
||||
|
@ -264,9 +262,17 @@ foreach my $ticket (@processList) {
|
|||
}
|
||||
$approvalTag = " ;Approval: rt://ticket/${ticketNum}/attachments/$ {attachmentNum}"
|
||||
if defined $attachmentNum;
|
||||
} elsif ($line =~ /^\s*([^:]+)\s*:\s*(.+)$/) {
|
||||
my($key, $val) = ($1, $2);
|
||||
# Note that this will take the last one used, since rt log gives ticket traffic IN ORDER.
|
||||
if ($key =~ /(CONTRACTED NAME|PAYMENT NAME|PAYMENT METHOD)/i) {
|
||||
$paymentVals{$key} = $val;
|
||||
print STDERR "\"$ticket\": rt show $ticketNum line match: $key $val for $line\n" if ($VERBOSE > 7);
|
||||
}
|
||||
}
|
||||
}
|
||||
close $logFH;
|
||||
|
||||
if (not defined $pass) {
|
||||
print STDERR "\"$ticket\": Skipping: pass/fail information not found\n" ;
|
||||
next;
|
||||
|
|
Loading…
Reference in a new issue