From 27d474b1d00d900d509c9a8343b401f01f4a4f1c Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Wed, 15 Jan 2014 14:42:31 -0800 Subject: [PATCH] bulk credit import, RT#26319 --- httemplate/misc/cust_credit-import.html | 79 ++++++++++++++++++++++++++ httemplate/misc/process/cust_credit-import.cgi | 10 ++++ 2 files changed, 89 insertions(+) create mode 100644 httemplate/misc/cust_credit-import.html create mode 100644 httemplate/misc/process/cust_credit-import.cgi diff --git a/httemplate/misc/cust_credit-import.html b/httemplate/misc/cust_credit-import.html new file mode 100644 index 000000000..6de34e378 --- /dev/null +++ b/httemplate/misc/cust_credit-import.html @@ -0,0 +1,79 @@ +<& /elements/header.html, 'Batch Credit Import' &> + +Import a file containing credits. +

+ +<& /elements/form-file_upload.html, + 'name' => 'CreditImportForm', + 'action' => 'process/cust_credit-import.cgi', + 'num_files' => 1, + 'fields' => [ 'format', 'credbatch' ], + 'message' => 'Credit import successful', + 'url' => $p."search/cust_credit.html?credbatch=$credbatch", + 'onsubmit' => "document.CreditImportForm.submitButton.disabled=true;", +&> + + +<% &ntable("#cccccc", 2) %> + + + + + + + <% include( '/elements/file-upload.html', + 'field' => 'file', + 'label' => 'Filename', + ) + %> + + + + + + + + + + + +
+ +Uploaded files can be CSV (comma-separated value) files or Excel spreadsheets. The file should have a .CSV or .XLS extension. +

+ + Default format has the following field order: custnum, amount, reasonnum, invnum
+

+ +Field information: + +

+ +<% include('/elements/footer.html') %> + +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Import'); + +my $credbatch = time2str('webimport-%Y/%m/%d-%T'. "-$$-". rand() * 2**32, time); + + diff --git a/httemplate/misc/process/cust_credit-import.cgi b/httemplate/misc/process/cust_credit-import.cgi new file mode 100644 index 000000000..5a5cfe212 --- /dev/null +++ b/httemplate/misc/process/cust_credit-import.cgi @@ -0,0 +1,10 @@ +<% $server->process %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Import'); + +my $server = + new FS::UI::Web::JSRPC 'FS::cust_credit::process_batch_import', $cgi; + + -- 2.11.0