Move PaymentDateByTicket to helper file.

This commit is contained in:
Bradley M. Kuhn 2018-07-25 14:02:12 -07:00
parent cc60ef0326
commit 7e52b5922b
2 changed files with 15 additions and 15 deletions

View file

@ -37,6 +37,21 @@ sub Outreachy_FindMainTicketsInRound($) {
return @ticketSpecs;
}
###############################################################################
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 =~ /^\s*CF\s*.\s*{payment-$paymentNumber-sent}\s*:\s*[\d\-]+\s*$/) {
$date = $payLine;
last;
}
}
close $rtPayFH;
return $date;
}
###############################################################################
sub GetStatusFromTicket($) {
my($ticketSpec) = @_;
my $status;

View file

@ -16,21 +16,6 @@ require 'rt-helper.pl';
my($PAYMENT_DIR, $VERBOSE, $INTERACTIVE, $PAYMENT_NUMBER, $RT_CMD, $INVOICE_LINE, $INTERN_SUCCESS_FILE,
$INTERN_FAIL_FILE, $LEDGER_ENTRY_DATE, $SVN_CMD, $ROUND, $TRAVEL_NOTICE_TICKET);
###############################################################################
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 =~ /^\s*CF\s*.\s*{payment-$paymentNumber-sent}\s*:\s*[\d\-]+\s*$/) {
$date = $payLine;
last;
}
}
close $rtPayFH;
return $date;
}
###############################################################################
sub LedgerTagFromTicket($$) {
my($ticketSpec, $tag) = @_;