Move two functions to helper file.
This commit is contained in:
parent
5e0433d39b
commit
0263c49c77
2 changed files with 29 additions and 29 deletions
|
@ -22,6 +22,35 @@ sub Outreachy_FindUniqueTicket(@) {
|
|||
return $ticketSpec;
|
||||
}
|
||||
###############################################################################
|
||||
sub GetStatusFromTicket($) {
|
||||
my($ticketSpec) = @_;
|
||||
my $status;
|
||||
open(my $statusFH, "-|", "$RT_CMD", "show", "-f", 'Status', $ticketSpec);
|
||||
while (my $statusLine = <$statusFH>) {
|
||||
if ($statusLine =~ /\s*Status\s*:\s*(\S+)\s*$/) {
|
||||
$status = $1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
close $statusFH;
|
||||
return $status;
|
||||
}
|
||||
###############################################################################
|
||||
sub GetCustomFieldForTicket($$) {
|
||||
my($ticketSpec, $customField) = @_;
|
||||
open(my $rtCustomFH, "-|", "$RT_CMD", "show", "-f", 'CF.{' . $customField .'}', $ticketSpec);
|
||||
my $val;
|
||||
while (my $customFieldLine = <$rtCustomFH>) {
|
||||
chomp $customFieldLine;
|
||||
if ($customFieldLine =~ /^\s*CF\s*.\s*{$customField}\s*:\s*(\S+)\s*$/) {
|
||||
$val = $1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
close $rtCustomFH;
|
||||
return $val;
|
||||
}
|
||||
###############################################################################
|
||||
1;
|
||||
###############################################################################
|
||||
#
|
||||
|
|
|
@ -117,35 +117,6 @@ sub FindReimbursementTicketFromList(@) {
|
|||
return $reimbursementTicket;
|
||||
}
|
||||
###############################################################################
|
||||
sub GetStatusFromTicket($) {
|
||||
my($ticketSpec) = @_;
|
||||
my $status;
|
||||
open(my $statusFH, "-|", "$RT_CMD", "show", "-f", 'Status', $ticketSpec);
|
||||
while (my $statusLine = <$statusFH>) {
|
||||
if ($statusLine =~ /\s*Status\s*:\s*(\S+)\s*$/) {
|
||||
$status = $1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
close $statusFH;
|
||||
return $status;
|
||||
}
|
||||
###############################################################################
|
||||
sub GetCustomFieldForTicket($$) {
|
||||
my($ticketSpec, $customField) = @_;
|
||||
open(my $rtCustomFH, "-|", "$RT_CMD", "show", "-f", 'CF.{' . $customField .'}', $ticketSpec);
|
||||
my $val;
|
||||
while (my $customFieldLine = <$rtCustomFH>) {
|
||||
chomp $customFieldLine;
|
||||
if ($customFieldLine =~ /^\s*CF\s*.\s*{$customField}\s*:\s*(\S+)\s*$/) {
|
||||
$val = $1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
close $rtCustomFH;
|
||||
return $val;
|
||||
}
|
||||
###############################################################################
|
||||
|
||||
GetOptions("paymentDir=s" => \$PAYMENT_DIR, "verbose=i" => \$VERBOSE, "interactive" => \$INTERACTIVE,
|
||||
"paymentNumber=i" => \$PAYMENT_NUMBER, "rtCommand=s" => \$RT_CMD,
|
||||
|
|
Loading…
Reference in a new issue