summaryrefslogtreecommitdiff
path: root/httemplate/misc
diff options
context:
space:
mode:
authorChristopher Burger <burgerc@freeside.biz>2017-11-01 12:56:48 -0400
committerChristopher Burger <burgerc@freeside.biz>2017-11-01 13:08:48 -0400
commitb282a5536ad5145f956ef27704e2267a124aacf5 (patch)
tree209b2e0cff81da3086f67136f8ab265ef73b4bb0 /httemplate/misc
parent5b7aba597d277efa440c27cdc264bf116e5a477a (diff)
RT# 75095 - Added Ooma integration to one time charges
Diffstat (limited to 'httemplate/misc')
-rw-r--r--httemplate/misc/cust_main-import_charges.cgi41
-rw-r--r--httemplate/misc/process/cust_main-import_charges.cgi20
2 files changed, 39 insertions, 22 deletions
diff --git a/httemplate/misc/cust_main-import_charges.cgi b/httemplate/misc/cust_main-import_charges.cgi
index 065506369..4eacce13a 100644
--- a/httemplate/misc/cust_main-import_charges.cgi
+++ b/httemplate/misc/cust_main-import_charges.cgi
@@ -3,7 +3,15 @@
Import a CSV file containing customer charges.
<BR><BR>
-<FORM ACTION="process/cust_main-import_charges.cgi" METHOD="post" ENCTYPE="multipart/form-data">
+<& /elements/form-file_upload.html,
+ 'name' => 'OneTimeChargeImportForm',
+ 'action' => 'process/cust_main-import_charges.cgi',
+ 'num_files' => 1,
+ 'fields' => [ 'agentnum', 'custbatch', 'format' ],
+ 'message' => 'One time charge batch import successful',
+ 'url' => $p."misc/cust_main-import_charges.cgi",
+ 'onsubmit' => "document.OneTimeChargeImportForm.submitButton.disabled=true;",
+&>
<% &ntable("#cccccc", 2) %>
@@ -14,23 +22,35 @@ Import a CSV file containing customer charges.
)
%>
+<INPUT TYPE="hidden" NAME="custbatch" VALUE="<% $custbatch %>"%>
+
<TR>
<TH ALIGN="right">Format</TH>
<TD>
<SELECT NAME="format">
<OPTION VALUE="simple">Simple
+ <OPTION VALUE="ooma">Ooma
<!-- <OPTION VALUE="extended" SELECTED>Extended -->
</SELECT>
</TD>
</TR>
+ <% include( '/elements/file-upload.html',
+ 'field' => 'file',
+ 'label' => 'Filename',
+ )
+ %>
+
<TR>
- <TH ALIGN="right">CSV filename</TH>
- <TD><INPUT TYPE="file" NAME="csvfile"></TD>
+ <TD COLSPAN=2 ALIGN="center" STYLE="padding-top:6px">
+ <INPUT TYPE = "submit"
+ NAME = "submitButton"
+ ID = "submitButton"
+ VALUE = "Import file"
+ >
+ </TD>
</TR>
-<TR><TD COLSPAN=2 ALIGN="center" STYLE="padding-top:6px"><INPUT TYPE="submit" VALUE="Import CSV file"></TD></TR>
-
</TABLE>
</FORM>
@@ -59,11 +79,22 @@ Field information:
<BR>
+<b>Ooma</b> format has the following field order: <i>Description, Description2, Record Type, Customer Number, Billing Phone Number or Zip Code, Bus/Res Indicator, Invoice Date, Invoice Number, Group, Item, Revenue<%$req%>, LineCount, Exempt, ExemptList, State, City, Zipcode, OfferingPK, Offering name<%$req%>, Quantity, AccountNo<%$req%>, Status, Cust Created, PartnerID</i>
+<BR><BR>
+
+
<% include('/elements/footer.html') %>
+
+<%once>
+ my $req = qq!<font color="#ff0000">*</font>!;
+</%once>
+
<%init>
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Import');
+ my $custbatch = time2str('webimport-%Y/%m/%d-%T'. "-$$-". rand() * 2**32, time);
+
</%init>
diff --git a/httemplate/misc/process/cust_main-import_charges.cgi b/httemplate/misc/process/cust_main-import_charges.cgi
index d877ad17d..42ca82592 100644
--- a/httemplate/misc/process/cust_main-import_charges.cgi
+++ b/httemplate/misc/process/cust_main-import_charges.cgi
@@ -1,24 +1,10 @@
-% if ( $error ) {
-% errorpage($error);
-% } else {
- <% include('/elements/header.html','Import successful') %>
- <% include('/elements/footer.html') %>
-% }
+<% $server->process %>
<%init>
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Import');
-my $fh = $cgi->upload('csvfile');
-#warn $cgi;
-#warn $fh;
-
-my $error = defined($fh)
- ? FS::cust_main::Import_Charges::batch_charge( {
- filehandle => $fh,
- 'agentnum' => scalar($cgi->param('agentnum')),
- 'format' => scalar($cgi->param('format')),
- } )
- : 'No file';
+my $server =
+ new FS::UI::Web::JSRPC 'FS::cust_main::Import_Charges::batch_charge', $cgi;
</%init>