[freeside-commits] freeside/httemplate/misc upload-batch.cgi, 1.8,
1.9
Ivan,,,
ivan at wavetail.420.am
Mon Feb 5 01:44:41 PST 2007
- Previous message: [freeside-commits] freeside/FS/FS cust_pay_batch.pm, 1.21,
1.22 pay_batch.pm, 1.4, 1.5 Record.pm, 1.134,
1.135 cust_main.pm, 1.270, 1.271
- Next message: [freeside-commits]
freeside/httemplate/misc download-batch.cgi, 1.19, 1.20
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/httemplate/misc
In directory wavetail:/tmp/cvs-serv3051/httemplate/misc
Modified Files:
upload-batch.cgi
Log Message:
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.
Index: upload-batch.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/misc/upload-batch.cgi,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- upload-batch.cgi 10 Jan 2007 00:42:23 -0000 1.8
+++ upload-batch.cgi 5 Feb 2007 09:44:38 -0000 1.9
@@ -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 ) {
-%
<!-- mason kludge -->
-%
+
% eidiot($error);
%# $cgi->param('error', $error);
%# print $cgi->redirect( "${p}cust_main-import.cgi
% } else {
-%
- <!-- mason kludge -->
<% 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>
- Previous message: [freeside-commits] freeside/FS/FS cust_pay_batch.pm, 1.21,
1.22 pay_batch.pm, 1.4, 1.5 Record.pm, 1.134,
1.135 cust_main.pm, 1.270, 1.271
- Next message: [freeside-commits]
freeside/httemplate/misc download-batch.cgi, 1.19, 1.20
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list