summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorjeff <jeff>2008-01-25 18:29:04 +0000
committerjeff <jeff>2008-01-25 18:29:04 +0000
commit0b4247f88f8a290a7bbbdebe93404baef2d1e29d (patch)
treebe28fc2b39edb211b55dac4507346f18b5fbf49e /httemplate
parent106804d4e10a904ae9c7ab0d7578f132c39d2c9b (diff)
simple payment CSV import
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/elements/menu.html2
-rw-r--r--httemplate/misc/cust_pay-import.cgi62
-rw-r--r--httemplate/misc/process/cust_pay-import.cgi21
3 files changed, 85 insertions, 0 deletions
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index 8d56adcc3..f43fca1bb 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -216,6 +216,8 @@ $report_menu{'Financial'} = [ \%report_financial, 'Financial reports' ]
tie my %tools_importing, 'Tie::IxHash',
'Import customers from CSV file' => [ $fsurl.'misc/cust_main-import.cgi', '' ],
+ 'Import payments from CSV file' => [ $fsurl.'misc/cust_pay-import.cgi', '' ],
+
'Import customer comments from CSV file' => [ $fsurl.'misc/cust_main_note-import.html', '' ],
'Import one-time charges from CSV file' => [ $fsurl.'misc/cust_main-import_charges.cgi', '' ],
'Import Call Detail Records (CDRs) from CSV file' => [ $fsurl.'misc/cdr-import.html', '' ],
diff --git a/httemplate/misc/cust_pay-import.cgi b/httemplate/misc/cust_pay-import.cgi
new file mode 100644
index 000000000..849a25bea
--- /dev/null
+++ b/httemplate/misc/cust_pay-import.cgi
@@ -0,0 +1,62 @@
+<% include("/elements/header.html",'Batch Payment Import') %>
+
+Import a CSV file containing customer payments.
+<BR><BR>
+
+<FORM ACTION="process/cust_pay-import.cgi" METHOD="post" ENCTYPE="multipart/form-data">
+
+<% &ntable("#cccccc", 2) %>
+
+<% include('/elements/tr-select-agent.html',
+ #'curr_value' => '', #$agentnum,
+ 'label' => "<B>Agent</B>",
+ 'empty_label' => 'Select agent',
+ )
+%>
+
+<TR>
+ <TH ALIGN="right">Format</TH>
+ <TD>
+ <SELECT NAME="format">
+ <OPTION VALUE="simple">Simple
+<!-- <OPTION VALUE="extended" SELECTED>Extended -->
+ </SELECT>
+ </TD>
+</TR>
+
+<TR>
+ <TH ALIGN="right">CSV filename</TH>
+ <TD><INPUT TYPE="file" NAME="csvfile"></TD>
+</TR>
+
+<TR><TD COLSPAN=2 ALIGN="center" STYLE="padding-top:6px"><INPUT TYPE="submit" VALUE="Import CSV file"></TD></TR>
+
+</TABLE>
+
+</FORM>
+
+<BR>
+
+Simple file format is CSV, with the following field order: <i>custnum, agent_custid, amount, checknum</i>
+<BR><BR>
+
+<!-- Extended file format is not yet defined</i>
+<BR><BR> -->
+
+Field information:
+
+<ul>
+
+ <li><i>custnum</i>: This is the freeside customer number. It may be left blank. If specified, agent_custid must be blank.
+
+ <li><i>agent_custid</i>: This is the reseller's idea of the customer number or identifier. It may be left blank. If specified, custnum must be blank.
+
+ <li><i>amount</i>: A positive numeric value with at most two digits after the decimal point.
+
+ <li><i>checknum</i>: A sequences of digits. May be left blank.
+
+</ul>
+
+<BR>
+
+<% include('/elements/footer.html') %>
diff --git a/httemplate/misc/process/cust_pay-import.cgi b/httemplate/misc/process/cust_pay-import.cgi
new file mode 100644
index 000000000..d4ff226ec
--- /dev/null
+++ b/httemplate/misc/process/cust_pay-import.cgi
@@ -0,0 +1,21 @@
+<% $cgi->redirect(popurl(3). "search/cust_pay.cgi?magic=paybatch;paybatch=$paybatch") %>
+<%init>
+
+my $fh = $cgi->upload('csvfile');
+
+# webbatch? I suppose
+my $paybatch = time2str('webbatch-%Y/%m/%d-%T'. "-$$-". rand() * 2**32, time);
+
+my $error = defined($fh)
+ ? FS::cust_pay::batch_import( {
+ 'filehandle' => $fh,
+ 'agentnum' => scalar($cgi->param('agentnum')),
+ 'format' => scalar($cgi->param('format')),
+ 'paybatch' => $paybatch,
+ } )
+ : 'No file';
+
+errorpage($error)
+ if ( $error );
+
+</%init>