diff options
Diffstat (limited to 'httemplate/misc')
-rw-r--r-- | httemplate/misc/cust_main-import_charges.cgi | 14 | ||||
-rw-r--r-- | httemplate/misc/process/cust_main-import_charges.cgi | 26 |
2 files changed, 40 insertions, 0 deletions
diff --git a/httemplate/misc/cust_main-import_charges.cgi b/httemplate/misc/cust_main-import_charges.cgi new file mode 100644 index 000000000..0822b9eb6 --- /dev/null +++ b/httemplate/misc/cust_main-import_charges.cgi @@ -0,0 +1,14 @@ +<!-- mason kludge --> +<%= header('Batch Customer Charge') %> +<FORM ACTION="process/cust_main-import_charges.cgi" METHOD="post" ENCTYPE="multipart/form-data"> +Import a CSV file containing customer charges.<BR><BR> +Default file format is CSV, with the following field order: <i>custnum, amount, description</i><BR><BR> +If <i>amount</i> is negative, a credit will be applied instead.<BR><BR> +<BR><BR> + + CSV Filename: <INPUT TYPE="file" NAME="csvfile"><BR><BR> + <INPUT TYPE="submit" VALUE="Import"> + </FORM> + </BODY> +<HTML> + diff --git a/httemplate/misc/process/cust_main-import_charges.cgi b/httemplate/misc/process/cust_main-import_charges.cgi new file mode 100644 index 000000000..14df1bd8d --- /dev/null +++ b/httemplate/misc/process/cust_main-import_charges.cgi @@ -0,0 +1,26 @@ +<% + + my $fh = $cgi->upload('csvfile'); + #warn $cgi; + #warn $fh; + + my $error = defined($fh) + ? FS::cust_main::batch_charge( { + filehandle => $fh, + 'fields' => [qw( custnum amount pkg )], + } ) + : 'No file'; + + if ( $error ) { + %> + <!-- mason kludge --> + <% + eidiot($error); +# $cgi->param('error', $error); +# print $cgi->redirect( "${p}cust_main-import_charges.cgi + } else { + %> + <!-- mason kludge --> + <%= header('Import sucessful') %> <% + } +%> |