Add files for correspondence.
This commit is contained in:
parent
48ec393a01
commit
c0e328dccf
1 changed files with 22 additions and 2 deletions
|
@ -11,7 +11,8 @@ use Getopt::Long;
|
|||
use File::Spec;
|
||||
use Date::Manip qw(ParseDate UnixDate);
|
||||
|
||||
my($PAYMENT_DIR, $VERBOSE, $INTERACTIVE, $PAYMENT_NUMBER, $RT_CMD, $INVOICE_LINE);
|
||||
my($PAYMENT_DIR, $VERBOSE, $INTERACTIVE, $PAYMENT_NUMBER, $RT_CMD, $INVOICE_LINE, $INTERN_SUCCESS_FILE,
|
||||
$INTERN_FAIL_FILE);
|
||||
|
||||
###############################################################################
|
||||
sub FindUniqueTicket(@) {
|
||||
|
@ -148,7 +149,8 @@ sub GetCustomFieldForTicket($$) {
|
|||
|
||||
GetOptions("paymentDir=s" => \$PAYMENT_DIR, "verbose=i" => \$VERBOSE, "interactive" => \$INTERACTIVE,
|
||||
"paymentNumber=i" => \$PAYMENT_NUMBER, "rtCommand=s" => \$RT_CMD,
|
||||
"invoiceLine=s" => \$INVOICE_LINE);
|
||||
"invoiceLine=s" => \$INVOICE_LINE, "internSuccessFile=s", \$INTERN_SUCCESS_FILE,
|
||||
"internFailFile=s", \$INTERN_FAIL_FILE);
|
||||
|
||||
$RT_CMD = '/usr/bin/rt' unless defined $RT_CMD;
|
||||
|
||||
|
@ -162,6 +164,24 @@ unless (defined $PAYMENT_DIR and -d $PAYMENT_DIR) {
|
|||
print STDERR "usage: $0 --paymentDir=<DIRECTORY> option is required and directory must exist\n";
|
||||
exit 1;
|
||||
}
|
||||
unless (-r $INTERN_SUCCESS_FILE and -f $INTERN_SUCCESS_FILE) {
|
||||
print STDERR "usage: $0 --internUpdateFile=<FILE> option is required and must be readible text file\n";
|
||||
exit 1;
|
||||
}
|
||||
unless (-r $INTERN_FAIL_FILE and -f $INTERN_FAIL_FILE) {
|
||||
print STDERR "usage: $0 --internFailFile=<FILE> option is required and must be readible text file\n";
|
||||
exit 1;
|
||||
}
|
||||
my %internCorrespond = ('success' => [], 'failed' => [] );
|
||||
open (my $internUpdateFH, "<", File::Spec->catfile($PAYMENT_DIR, $INTERN_SUCCESS_FILE));
|
||||
while (my $line = <$internUpdateFH>) {
|
||||
push(@{$internCorrespond{success}}, $line);
|
||||
}
|
||||
my @internFailData;
|
||||
open (my $internFailFH, "<", File::Spec->catfile($PAYMENT_DIR, $INTERN_FAIL_FILE));
|
||||
while (my $line = <$internFailFH>) {
|
||||
push(@{$internCorrespond{failed}}, $line);
|
||||
}
|
||||
unless (defined $PAYMENT_NUMBER and $PAYMENT_NUMBER =~ /^[123]$/) {
|
||||
print STDERR "usage: $0 --paymentNumber=<VALUE> option is required and must be 1, 2 or 3\n";
|
||||
exit 1;
|
||||
|
|
Loading…
Reference in a new issue