LedgerTagFromTicket: handle that CF line might be first

The 'CF.{ledger-tags}: ' portion appears on the first line of output, so that
must be handled.
This commit is contained in:
Bradley M. Kuhn 2018-07-22 15:13:03 -07:00
parent def7498189
commit 54cd914e47

View file

@ -53,8 +53,10 @@ sub LedgerTagFromTicket($$) {
open(my $rtPayFH, "-|", "$RT_CMD", "show", "-f", 'CF.{ledger-tags}', $ticketSpec); open(my $rtPayFH, "-|", "$RT_CMD", "show", "-f", 'CF.{ledger-tags}', $ticketSpec);
my $tagValue; my $tagValue;
while (my $tagsLine = <$rtPayFH>) { while (my $tagsLine = <$rtPayFH>) {
print STDERR "Tag Lookup for \"$ticketSpec\" for \"$tag\", searching this line for it: $tagsLine"
if ($VERBOSE > 6);
chomp $tagsLine; chomp $tagsLine;
if ($tagsLine =~ /^\s*;?$tag\s*:\s*(.+)\s*$/i) { if ($tagsLine =~ /^(?:\s*|\s*CF[^:]+\s*}\s*:\s*);?$tag\s*:\s*(.+)\s*$/i) {
$tagValue = $1; $tagValue = $1;
last; last;
} }