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);
|
open(my $logFH, "-|", $RT_CMD, "show", $ticketNum);
|
||||||
while (my $line = <$logFH>) {
|
while (my $line = <$logFH>) {
|
||||||
print STDERR "\"$ticket\": rt show $ticketNum line evaluation: $line" if ($VERBOSE > 8);
|
print STDERR "\"$ticket\": rt show $ticketNum line evaluation: $line" if ($VERBOSE > 8);
|
||||||
if ($line =~ /^\s*([^:]+)\s*:\s*(.+)$/) {
|
if ($line =~ /status\s*changed.*to.*paid/i) {
|
||||||
my($key, $val) = ($1, $2);
|
($pass, $mentorDate, $approvalTag) = (undef, undef, undef);
|
||||||
# Note that this will take the last one used, since rt log gives ticket traffic IN ORDER.
|
print STDERR "\"$ticket\": rt show $ticketNum status change to paid at $line\n" if ($VERBOSE > 7);
|
||||||
$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);
|
|
||||||
} elsif ($PAYMENT_NUMBER != 1 and (not defined $pass) and $line =~ /^\s*Payment\s+approved\s+by/) {
|
} elsif ($PAYMENT_NUMBER != 1 and (not defined $pass) and $line =~ /^\s*Payment\s+approved\s+by/) {
|
||||||
$pass = 1;
|
$pass = 1;
|
||||||
$line = <$logFH>;
|
$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/) {
|
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;
|
next;
|
||||||
}
|
}
|
||||||
$mentorDate = $1;
|
$mentorDate = $1;
|
||||||
|
@ -255,7 +253,7 @@ foreach my $ticket (@processList) {
|
||||||
next unless defined $mentorDate;
|
next unless defined $mentorDate;
|
||||||
my $attachmentNum;
|
my $attachmentNum;
|
||||||
while (my $subLine = <$logFH>) {
|
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+/;
|
last if $subLine =~ /^\=\=\=\>\s+/;
|
||||||
if ($subLine =~ /^\s+(\d+)\s*\:\s+/) {
|
if ($subLine =~ /^\s+(\d+)\s*\:\s+/) {
|
||||||
$attachmentNum = $1;
|
$attachmentNum = $1;
|
||||||
|
@ -264,9 +262,17 @@ foreach my $ticket (@processList) {
|
||||||
}
|
}
|
||||||
$approvalTag = " ;Approval: rt://ticket/${ticketNum}/attachments/$ {attachmentNum}"
|
$approvalTag = " ;Approval: rt://ticket/${ticketNum}/attachments/$ {attachmentNum}"
|
||||||
if defined $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;
|
close $logFH;
|
||||||
|
|
||||||
if (not defined $pass) {
|
if (not defined $pass) {
|
||||||
print STDERR "\"$ticket\": Skipping: pass/fail information not found\n" ;
|
print STDERR "\"$ticket\": Skipping: pass/fail information not found\n" ;
|
||||||
next;
|
next;
|
||||||
|
|
Loading…
Reference in a new issue