summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FS/FS/tax_rate.pm6
-rw-r--r--httemplate/misc/tax-import.cgi91
2 files changed, 42 insertions, 55 deletions
diff --git a/FS/FS/tax_rate.pm b/FS/FS/tax_rate.pm
index 69dc12821..0601032ee 100644
--- a/FS/FS/tax_rate.pm
+++ b/FS/FS/tax_rate.pm
@@ -719,7 +719,7 @@ sub batch_import {
=item process_batch
-Load an batch import as a queued JSRPC job
+Load a batch import as a queued JSRPC job
=cut
@@ -752,7 +752,7 @@ sub process_batch {
$error = "No $name supplied";
next;
}
- my $dir = $FS::UID::conf_dir. "/cache.". $FS::UID::datasrc;
+ my $dir = '%%%FREESIDE_CACHE%%%/cache.'. $FS::UID::datasrc;
my $filename = "$dir/". $files{$file};
open my $fh, "< $filename" or $error ||= "Can't open $name file: $!";
@@ -781,7 +781,7 @@ sub process_batch {
'PLUS4', 'plus4file', \&FS::cust_tax_location::batch_import,
'TXMATRIX', 'txmatrix', \&FS::part_pkg_taxrate::batch_import,
);
- my $dir = $FS::UID::conf_dir. "/cache.". $FS::UID::datasrc;
+ my $dir = '%%%FREESIDE_CACHE%%%/cache.'. $FS::UID::datasrc;
while( scalar(@list) ) {
my ($name, $file, $import_sub) = (shift @list, shift @list, shift @list);
unless ($files{$file}) {
diff --git a/httemplate/misc/tax-import.cgi b/httemplate/misc/tax-import.cgi
index 9044ac9eb..15f09d518 100644
--- a/httemplate/misc/tax-import.cgi
+++ b/httemplate/misc/tax-import.cgi
@@ -3,63 +3,50 @@
Import a CSV file set containing tax rate records.
<BR><BR>
-<% include( '/elements/progress-init.html',
- 'TaxRateUpload',
- [ 'format', 'uploaded_files' ],
- 'process/tax-import.cgi',
- { 'message' => 'Tax rates imported' },
+<% include( '/elements/form-file_upload.html',
+ 'name' => 'TaxRateUpload',
+ 'action' => 'process/tax-import.cgi',
+ 'num_files' => 4,
+ 'fields' => [ 'format', ],
+ 'message' => 'Tax rates imported',
)
%>
-<SCRIPT>
-
- function gotLoaded(success, message) {
-
- var uploaded = document.getElementById('uploaded_files');
- var a = uploaded.value.split(',');
- if (uploaded.value.split(',').length == 4){
- process();
- }else{
- var p = document.getElementById('uploadError');
- p.innerHTML='<FONT SIZE="+1" COLOR="#ff0000">Error: '+message+'</FONT><BR><BR>';
- p.style='display:visible';
- return false;
- }
-
- }
-
-</SCRIPT>
-
-<div style="display:none:" id="uploadError"></div>
-<FORM NAME="TaxRateUpload" ACTION="<% $fsurl %>misc/file-upload.html" METHOD="post" ENCTYPE="multipart/form-data" onsubmit="return doUpload(this, gotLoaded )">
-
<% &ntable("#cccccc", 2) %>
-<TR>
- <TH ALIGN="right">Format</TH>
- <TD>
- <SELECT NAME="format">
- <OPTION VALUE="cch-update" SELECTED>CCH update
- <OPTION VALUE="cch">CCH initial import
- </SELECT>
- </TD>
-</TR>
-
-<% include('/elements/file-upload.html', 'field' => [ 'codefile',
- 'plus4file',
- 'txmatrix',
- 'detail',
- ],
- 'label' => [ 'code CSV filename',
- 'plus4 CSV filename',
- 'txmatrix CSV filename',
- 'detail CSV filename',
- ],
- 'callback' => 'gotLoaded',
- 'debug' => 0,
- )
-%>
-<TR><TD COLSPAN=2 ALIGN="center" STYLE="padding-top:6px"><INPUT TYPE="submit" VALUE="Import CSV files" onClick="document.TaxRateUpload.submit.disabled=true;"></TD></TR>
+ <TR>
+ <TH ALIGN="right">Format</TH>
+ <TD>
+ <SELECT NAME="format">
+ <OPTION VALUE="cch-update" SELECTED>CCH update
+ <OPTION VALUE="cch">CCH initial import
+ </SELECT>
+ </TD>
+ </TR>
+
+ <% include( '/elements/file-upload.html',
+ 'field' => [ 'codefile',
+ 'plus4file',
+ 'txmatrix',
+ 'detail',
+ ],
+ 'label' => [ 'code CSV filename',
+ 'plus4 CSV filename',
+ 'txmatrix CSV filename',
+ 'detail CSV filename',
+ ],
+ 'debug' => 0,
+ )
+ %>
+
+ <TR>
+ <TD COLSPAN=2 ALIGN="center" STYLE="padding-top:6px">
+ <INPUT TYPE = "submit"
+ VALUE = "Import CSV files"
+ onClick = "document.TaxRateUpload.submit.disabled=true;"
+ >
+ </TD>
+ </TR>
</TABLE>