Rework GetLinksForTicket, returns hash now
Include the Hash Id.
This commit is contained in:
parent
c87c215a87
commit
38f7b0cedc
2 changed files with 20 additions and 16 deletions
|
@ -44,6 +44,23 @@ sub Outreachy_FindMainTicketsInRound($) {
|
||||||
return @ticketSpecs;
|
return @ticketSpecs;
|
||||||
}
|
}
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
sub GetLinksForTicket($) {
|
||||||
|
my($ticketSpec) = @_;
|
||||||
|
my %linked;
|
||||||
|
open(my $rtLinksFH, "-|", "$RT_CMD", "show", $ticketSpec . '/links');
|
||||||
|
my $type = 'NONE';
|
||||||
|
while (my $linksLine = <$rtLinksFH>) {
|
||||||
|
if ($linksLine =~ m%\s*([^:]+)\s:%) {
|
||||||
|
$type = $1;
|
||||||
|
}
|
||||||
|
if ($linksLine =~ m%rt.*(ticket/\d+)\s*,?\s*$%) {
|
||||||
|
push(@{$linked{$type}}, $1) if $type !~ /(NONE|id)/i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close $rtLinksFH;
|
||||||
|
return %linked;
|
||||||
|
}
|
||||||
|
###############################################################################
|
||||||
sub PaymentDateByTicket($$) {
|
sub PaymentDateByTicket($$) {
|
||||||
my($ticketSpec, $paymentNumber) = @_;
|
my($ticketSpec, $paymentNumber) = @_;
|
||||||
open(my $rtPayFH, "-|", "$RT_CMD", "show", "-f", 'CF.{payment-' . $paymentNumber . '-sent}', $ticketSpec);
|
open(my $rtPayFH, "-|", "$RT_CMD", "show", "-f", 'CF.{payment-' . $paymentNumber . '-sent}', $ticketSpec);
|
||||||
|
|
|
@ -51,19 +51,6 @@ sub AllFormattedLedgerTagFromTicket($) {
|
||||||
return @tags;
|
return @tags;
|
||||||
}
|
}
|
||||||
###############################################################################
|
###############################################################################
|
||||||
sub GetLinksForTicket($) {
|
|
||||||
my($ticketSpec) = @_;
|
|
||||||
my @linked;
|
|
||||||
open(my $rtLinksFH, "-|", "$RT_CMD", "show", $ticketSpec . '/links');
|
|
||||||
while (my $linksLine = <$rtLinksFH>) {
|
|
||||||
if ($linksLine =~ m%rt.*(ticket/\d+)\s*,?\s*$%) {
|
|
||||||
push(@linked, $1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close $rtLinksFH;
|
|
||||||
return @linked;
|
|
||||||
}
|
|
||||||
###############################################################################
|
|
||||||
sub FindTaxTicketFromList(@) {
|
sub FindTaxTicketFromList(@) {
|
||||||
my $taxTicket;
|
my $taxTicket;
|
||||||
foreach my $ticket (@_) {
|
foreach my $ticket (@_) {
|
||||||
|
@ -264,16 +251,16 @@ while (my $file = readdir $dh) {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
my(@links) = GetLinksForTicket($ticket);
|
my(%links) = GetLinksForTicket($ticket);
|
||||||
if ($VERBOSE > 5) {
|
if ($VERBOSE > 5) {
|
||||||
print STDERR "\"$file\": \"$ticket\": Found the following links: " , join( ", ", @links), "\n";
|
print STDERR "\"$file\": \"$ticket\": Found the following links: " , join( ", ", @links), "\n";
|
||||||
}
|
}
|
||||||
my $taxTicket = FindTaxTicketFromList(@links);
|
my $taxTicket = FindTaxTicketFromList(@{$links{DependsOn});
|
||||||
if (not defined $taxTicket) {
|
if (not defined $taxTicket) {
|
||||||
print STDERR "\"$file\": \"$ticket\": Skipped: no tax ticket found.\n";
|
print STDERR "\"$file\": \"$ticket\": Skipped: no tax ticket found.\n";
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
my $reimbursementTicket = FindReimbursementTicketFromList(@links);
|
my $reimbursementTicket = FindReimbursementTicketFromList(@{$links{Members}});
|
||||||
if (not defined $reimbursementTicket) {
|
if (not defined $reimbursementTicket) {
|
||||||
print STDERR "\"$file\": \"$ticket\": Skipped: no reimbursement ticket found.\n";
|
print STDERR "\"$file\": \"$ticket\": Skipped: no reimbursement ticket found.\n";
|
||||||
next;
|
next;
|
||||||
|
|
Loading…
Reference in a new issue