summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/elements/menu.html7
-rw-r--r--httemplate/misc/cust_credit-import.html79
-rw-r--r--httemplate/misc/process/cust_credit-import.cgi10
-rwxr-xr-xhttemplate/search/cust_credit.html4
4 files changed, 97 insertions, 3 deletions
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index a403bb31e..5225cce30 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -428,9 +428,10 @@ $report_menu{'SQL Query'} = [ $fsurl.'search/report_sql.html', 'SQL Query']
tie my %tools_importing, 'Tie::IxHash',
'Customers' => [ $fsurl.'misc/cust_main-import.cgi', '' ],
'Customer packages' => [ $fsurl.'misc/cust_pkg-import.html', '' ],
- 'Customer comments from CSV file' => [ $fsurl.'misc/cust_main_note-import.html', '' ],
- 'One-time charges from CSV file' => [ $fsurl.'misc/cust_main-import_charges.cgi', '' ],
- 'Payments from CSV file' => [ $fsurl.'misc/cust_pay-import.cgi', '' ],
+ 'Customer comments' => [ $fsurl.'misc/cust_main_note-import.html', '' ],
+ 'One-time charges' => [ $fsurl.'misc/cust_main-import_charges.cgi', '' ],
+ 'Payments' => [ $fsurl.'misc/cust_pay-import.cgi', '' ],
+ 'Credits' => [ $fsurl.'misc/cust_credit-import.html', '' ],
'Phone numbers (DIDs)' => [ $fsurl.'misc/phone_avail-import.html', '' ],
'Call Detail Records (CDRs)' => [ $fsurl.'misc/cdr-import.html', '' ],
;
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.
+<BR><BR>
+
+<& /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) %>
+
+ <INPUT TYPE="hidden" NAME="credbatch" VALUE="<% $credbatch %>"%>
+
+ <!--
+ <TR>
+ <TH ALIGN="right">Format</TH>
+ <TD>
+ <SELECT NAME="format">
+ <OPTION VALUE="simple">Simple
+ </SELECT>
+ </TD>
+ </TR>
+ -->
+ <INPUT TYPE="hidden" NAME="format" VALUE="simple">
+
+ <% include( '/elements/file-upload.html',
+ 'field' => 'file',
+ 'label' => 'Filename',
+ )
+ %>
+
+ <TR>
+ <TD COLSPAN=2 ALIGN="center" STYLE="padding-top:6px">
+ <INPUT TYPE = "submit"
+ ID = "submitButton"
+ NAME = "submitButton"
+ VALUE = "Import file"
+ >
+ </TD>
+ </TR>
+
+</TABLE>
+
+</FORM>
+
+<BR>
+
+Uploaded files can be CSV (comma-separated value) files or Excel spreadsheets. The file should have a .CSV or .XLS extension.
+<BR><BR>
+
+ <b>Default</b> format has the following field order: <i>custnum, amount, reasonnum, invnum</i><br>
+<BR><BR>
+
+Field information:
+<ul>
+ <li><i>custnum</i>: Customer number
+ <li><i>amount</i>:
+ <li><i>reasonnum</i>: <A HREF="<%$p%>browse/reason.html?class=R">Credit reason</A>
+ <li><i>invnum</i>: Invoice number
+</ul>
+<BR><BR>
+
+<% 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);
+
+</%init>
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;
+
+</%init>
diff --git a/httemplate/search/cust_credit.html b/httemplate/search/cust_credit.html
index fb6ef834b..45261711b 100755
--- a/httemplate/search/cust_credit.html
+++ b/httemplate/search/cust_credit.html
@@ -97,6 +97,10 @@ if ( $cgi->param('agentnum') && $cgi->param('agentnum') =~ /^(\d+)$/ ) {
$title = $agent->agent. " $title";
}
+if ( $cgi->param('credbatch') =~ /^([\w\-\/\.\:]+)$/ ) {
+ push @search, "cust_credit.credbatch = '$1'";
+}
+
# commission_salesnum
if ( $cgi->param('commission_salesnum') =~ /^(\d+)$/ ) {
push @search, "commission_salesnum = $1";