From c8f80bd5aaeb0f3844a7cece4bfe250d4f89f745 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 28 Sep 2003 02:36:18 +0000 Subject: add upload of batch result from TD Canada Trust some global.asa / handler.pl enhancements --- httemplate/misc/upload-batch.cgi | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 httemplate/misc/upload-batch.cgi (limited to 'httemplate/misc/upload-batch.cgi') diff --git a/httemplate/misc/upload-batch.cgi b/httemplate/misc/upload-batch.cgi new file mode 100644 index 000000000..565a6da5c --- /dev/null +++ b/httemplate/misc/upload-batch.cgi @@ -0,0 +1,28 @@ +<% + + my $fh = $cgi->upload('batch_results'); + my $filename = $cgi->param('batch_results'); + my $paybatch = basename($filename); + + my $error = defined($fh) + ? FS::cust_pay_batch::import_results( { + 'filehandle' => $fh, + 'format' => $cgi->param('format'), + 'paybatch' => $paybatch, + } ) + : 'No file'; + + if ( $error ) { + %> + + <% + eidiot($error); +# $cgi->param('error', $error); +# print $cgi->redirect( "${p}cust_main-import.cgi + } else { + %> + + <%= header('Batch results upload sucessful') %> <% + } +%> + -- cgit v1.2.1 From 8950be198d09bf5e9e0959fe2b55726be63a2397 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 8 Oct 2003 04:09:05 +0000 Subject: can't use File::Basename::basename for windows filenames! use a regex instead --- httemplate/misc/upload-batch.cgi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'httemplate/misc/upload-batch.cgi') diff --git a/httemplate/misc/upload-batch.cgi b/httemplate/misc/upload-batch.cgi index 565a6da5c..cc5346606 100644 --- a/httemplate/misc/upload-batch.cgi +++ b/httemplate/misc/upload-batch.cgi @@ -2,7 +2,8 @@ my $fh = $cgi->upload('batch_results'); my $filename = $cgi->param('batch_results'); - my $paybatch = basename($filename); + $filename =~ /^.*[\/\\]([^\/\\]+)$/ or die; + my $paybatch = $1; my $error = defined($fh) ? FS::cust_pay_batch::import_results( { -- cgit v1.2.1 From 2e1a3719f1a9fb1f561d0eb4df349f3f03d66681 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 28 May 2004 11:21:46 +0000 Subject: better error reporting on unparsable filenames --- httemplate/misc/upload-batch.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/misc/upload-batch.cgi') diff --git a/httemplate/misc/upload-batch.cgi b/httemplate/misc/upload-batch.cgi index cc5346606..da5e41cbc 100644 --- a/httemplate/misc/upload-batch.cgi +++ b/httemplate/misc/upload-batch.cgi @@ -2,7 +2,7 @@ my $fh = $cgi->upload('batch_results'); my $filename = $cgi->param('batch_results'); - $filename =~ /^.*[\/\\]([^\/\\]+)$/ or die; + $filename =~ /^.*[\/\\]([^\/\\]+)$/ or die "unparsable filename: $filename\n"; my $paybatch = $1; my $error = defined($fh) -- cgit v1.2.1 From 038eaf525927a161e40577b2f2eec96c30523a6d Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 28 May 2004 11:33:21 +0000 Subject: not entirely sure why we're checking the filename at all... to catch empty form submissions? --- httemplate/misc/upload-batch.cgi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'httemplate/misc/upload-batch.cgi') diff --git a/httemplate/misc/upload-batch.cgi b/httemplate/misc/upload-batch.cgi index da5e41cbc..5d0150177 100644 --- a/httemplate/misc/upload-batch.cgi +++ b/httemplate/misc/upload-batch.cgi @@ -2,8 +2,9 @@ my $fh = $cgi->upload('batch_results'); my $filename = $cgi->param('batch_results'); - $filename =~ /^.*[\/\\]([^\/\\]+)$/ or die "unparsable filename: $filename\n"; - my $paybatch = $1; + $filename =~ /^(.*[\/\\])?([^\/\\]+)$/ + or die "unparsable filename: $filename\n"; + my $paybatch = $2; my $error = defined($fh) ? FS::cust_pay_batch::import_results( { -- cgit v1.2.1