A few more ticket lookup subs.
This commit is contained in:
parent
7685bfc61a
commit
b48b6b3945
1 changed files with 28 additions and 0 deletions
|
@ -31,6 +31,34 @@ sub FindUniqueTicket(@) {
|
|||
close $rtLsFH;
|
||||
return $ticketSpec;
|
||||
}
|
||||
sub PaymentDateByTicket($$) {
|
||||
my($ticketSpec, $paymentNumber) = @_;
|
||||
open(my $rtPayFH, "-|", "$RT_CMD", "show", "-f", 'CF.{payment-' . $paymentNumber . '-sent}', $ticketSpec);
|
||||
my $date;
|
||||
while (my $payLine = <$rtPayFH>) {
|
||||
chomp $payLine;
|
||||
if ($payLine =~ /[\d\-]+/) {
|
||||
$date = $payLine;
|
||||
last;
|
||||
}
|
||||
}
|
||||
close $rtPayFH;
|
||||
return $date;
|
||||
}
|
||||
sub LedgerTagFromTicket($$) {
|
||||
my($ticketSpec, $tag) = @_;
|
||||
open(my $rtPayFH, "-|", "$RT_CMD", "show", "-f", 'CF.{ledger-tags}', $ticketSpec);
|
||||
my $tagValue;
|
||||
while (my $tagsLine = <$rtPayFH>) {
|
||||
chomp $tagsLine;
|
||||
if ($tagsLine =~ /^\s*;?$tag\s*:\s*(.+)\s*$/i) {
|
||||
$tagValue = $1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
close $rtPayFH;
|
||||
return $tagValue;
|
||||
}
|
||||
|
||||
GetOptions("paymentDir=s" => \$PAYMENT_DIR, "verbose=i" => \$VERBOSE, "interactive" => \$INTERACTIVE,
|
||||
"paymentNumber=i" => \$PAYMENT_NUMBER, "rtCommand=s" => $RT_CMD);
|
||||
|
|
Loading…
Reference in a new issue