From c1bb4ddb71147d0571bd301a6d8c452fdf0e1bc9 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 31 Jan 2006 04:26:54 +0000 Subject: move header() to include(/elements/header.html) so it can be changed in one place, thanks to Scott Edwards --- 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 5d0150177..24d7cf15c 100644 --- a/httemplate/misc/upload-batch.cgi +++ b/httemplate/misc/upload-batch.cgi @@ -24,7 +24,7 @@ } else { %> - <%= header('Batch results upload sucessful') %> <% + <%= include("/elements/header.html",'Batch results upload sucessful') %> <% } %> -- cgit v1.2.1 From b9f9a5dc444a66ca138073a0e5229d85569e51b4 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 25 Mar 2006 02:23:26 +0000 Subject: successfully correct the spelling of sucessful --- 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 24d7cf15c..746b81b17 100644 --- a/httemplate/misc/upload-batch.cgi +++ b/httemplate/misc/upload-batch.cgi @@ -24,7 +24,7 @@ } else { %> - <%= include("/elements/header.html",'Batch results upload sucessful') %> <% + <%= include("/elements/header.html",'Batch results upload successful') %> <% } %> -- cgit v1.2.1 From 3ce7691203a7737406bf2d4442f7fd84b81f847e Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 23 Aug 2006 22:25:39 +0000 Subject: Will things ever be the same again? It's the final masonize --- httemplate/misc/upload-batch.cgi | 56 +++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 26 deletions(-) (limited to 'httemplate/misc/upload-batch.cgi') diff --git a/httemplate/misc/upload-batch.cgi b/httemplate/misc/upload-batch.cgi index 746b81b17..742bbc0c6 100644 --- a/httemplate/misc/upload-batch.cgi +++ b/httemplate/misc/upload-batch.cgi @@ -1,30 +1,34 @@ -<% +% +% +% my $fh = $cgi->upload('batch_results'); +% my $filename = $cgi->param('batch_results'); +% $filename =~ /^(.*[\/\\])?([^\/\\]+)$/ +% or die "unparsable filename: $filename\n"; +% my $paybatch = $2; +% +% my $error = defined($fh) +% ? FS::cust_pay_batch::import_results( { +% 'filehandle' => $fh, +% 'format' => $cgi->param('format'), +% 'paybatch' => $paybatch, +% } ) +% : 'No file'; +% +% if ( $error ) { +% - my $fh = $cgi->upload('batch_results'); - my $filename = $cgi->param('batch_results'); - $filename =~ /^(.*[\/\\])?([^\/\\]+)$/ - or die "unparsable filename: $filename\n"; - my $paybatch = $2; - - 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 { - %> +% +% eidiot($error); +%# $cgi->param('error', $error); +%# print $cgi->redirect( "${p}cust_main-import.cgi +% } else { +% + - <%= include("/elements/header.html",'Batch results upload successful') %> <% - } -%> + <% include("/elements/header.html",'Batch results upload successful') %> +% +% } +% + -- cgit v1.2.1 From e8e43b0e59cf50e7a3c0789f589046459bc658c1 Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 10 Jan 2007 00:42:23 +0000 Subject: ignore filenames and rely on selected batch number --- httemplate/misc/upload-batch.cgi | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'httemplate/misc/upload-batch.cgi') diff --git a/httemplate/misc/upload-batch.cgi b/httemplate/misc/upload-batch.cgi index 742bbc0c6..5b4961be3 100644 --- a/httemplate/misc/upload-batch.cgi +++ b/httemplate/misc/upload-batch.cgi @@ -1,10 +1,8 @@ % % % my $fh = $cgi->upload('batch_results'); -% my $filename = $cgi->param('batch_results'); -% $filename =~ /^(.*[\/\\])?([^\/\\]+)$/ -% or die "unparsable filename: $filename\n"; -% my $paybatch = $2; +% $cgi->param('batchnum') =~ /^(\d+)$/; +% my $paybatch = $1; % % my $error = defined($fh) % ? FS::cust_pay_batch::import_results( { -- cgit v1.2.1 From a014f2e125028a5a80c0587f36df5e865b70b47f Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 5 Feb 2007 09:44:38 +0000 Subject: move cust_pay_batch::upload results subroutine to an FS::pay_batch method. upon first download, have batches auto-reset their amounts to the customer balance upon if it is smaller. --- httemplate/misc/upload-batch.cgi | 45 ++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 20 deletions(-) (limited to 'httemplate/misc/upload-batch.cgi') diff --git a/httemplate/misc/upload-batch.cgi b/httemplate/misc/upload-batch.cgi index 5b4961be3..ccaf6f046 100644 --- a/httemplate/misc/upload-batch.cgi +++ b/httemplate/misc/upload-batch.cgi @@ -1,32 +1,37 @@ -% -% -% my $fh = $cgi->upload('batch_results'); -% $cgi->param('batchnum') =~ /^(\d+)$/; -% my $paybatch = $1; -% -% 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 { -% - <% include("/elements/header.html",'Batch results upload successful') %> -% + % } -% +<%init> + +my $error; + +my $fh = $cgi->upload('batch_results'); +$error = 'No file uploaded' unless defined($fh); + +unless ( $error ) { + + $cgi->param('batchnum') =~ /^(\d+)$/; + my $batchnum = $1; + my $pay_batch = qsearchs( 'pay_batch', { 'batchnum' => $batchnum } ); + if ( ! $pay_batch ) { + $error = "batchnum $batchnum not found"; + } elsif ( $pay_batch->status ne 'I' ) { + $error = "batch $paybatch is not in transit"; + } else { + $error = $pay_batch->import_results( + 'filehandle' => $fh, + 'format' => $cgi->param('format'), + ); + } +<%/init> -- cgit v1.2.1 From f731dc5a2bab0f3d04a43d7501257e18164bdcd8 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 5 Feb 2007 15:48:16 +0000 Subject: misterminated <%init> --- 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 ccaf6f046..a55170218 100644 --- a/httemplate/misc/upload-batch.cgi +++ b/httemplate/misc/upload-batch.cgi @@ -34,4 +34,4 @@ unless ( $error ) { ); } -<%/init> + -- cgit v1.2.1 From d7419fc59cf19d85d511be8a95c615278462b316 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 5 Feb 2007 15:49:32 +0000 Subject: fix st00pid mistakes in batch upload --- httemplate/misc/upload-batch.cgi | 4 +++- 1 file changed, 3 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 a55170218..69d3ca6b1 100644 --- a/httemplate/misc/upload-batch.cgi +++ b/httemplate/misc/upload-batch.cgi @@ -26,7 +26,7 @@ unless ( $error ) { if ( ! $pay_batch ) { $error = "batchnum $batchnum not found"; } elsif ( $pay_batch->status ne 'I' ) { - $error = "batch $paybatch is not in transit"; + $error = "batch $batchnum is not in transit"; } else { $error = $pay_batch->import_results( 'filehandle' => $fh, @@ -34,4 +34,6 @@ unless ( $error ) { ); } +} + -- cgit v1.2.1