summaryrefslogtreecommitdiff
path: root/httemplate/misc/process/tax-import.cgi
diff options
context:
space:
mode:
authorjeff <jeff>2008-04-15 20:47:59 +0000
committerjeff <jeff>2008-04-15 20:47:59 +0000
commit6a24254d490f3d023728044daba0765f20f6971e (patch)
treec486026468a4e33092ae54925ff19b8e5dc7411b /httemplate/misc/process/tax-import.cgi
parentbdbfd5c5a3bb7bc193b82dc39b98ae9ffe99da44 (diff)
(finally) wrap up new tax rate engine (for now)
Diffstat (limited to 'httemplate/misc/process/tax-import.cgi')
-rw-r--r--httemplate/misc/process/tax-import.cgi55
1 files changed, 3 insertions, 52 deletions
diff --git a/httemplate/misc/process/tax-import.cgi b/httemplate/misc/process/tax-import.cgi
index 77fba61f5..f66d6db29 100644
--- a/httemplate/misc/process/tax-import.cgi
+++ b/httemplate/misc/process/tax-import.cgi
@@ -1,58 +1,9 @@
-% if ( $error ) {
-% warn $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');
+ unless $FS::CurrentUser::CurrentUser->access_right('Resend invoices');
-my $cfh = $cgi->upload('codefile');
-my $zfh = $cgi->upload('plus4file');
-my $tfh = $cgi->upload('txmatrix');
-my $dfh = $cgi->upload('detail');
-#warn $cgi;
-#warn $fh;
-
-my $oldAutoCommit = $FS::UID::AutoCommit;
-local $FS::UID::AutoCommit = 0;
-my $dbh = dbh;
-
-my $error = defined($cfh)
- ? FS::tax_class::batch_import( {
- filehandle => $cfh,
- 'format' => scalar($cgi->param('format')),
- } )
- : 'No code file';
-
-$error ||= defined($zfh)
- ? FS::cust_tax_location::batch_import( {
- filehandle => $zfh,
- 'format' => scalar($cgi->param('format')),
- } )
- : 'No plus4 file';
-
-$error ||= defined($tfh)
- ? FS::part_pkg_taxrate::batch_import( {
- filehandle => $tfh,
- 'format' => scalar($cgi->param('format')),
- } )
- : 'No tax matrix file';
-
-$error ||= defined($dfh)
- ? FS::tax_rate::batch_import( {
- filehandle => $dfh,
- 'format' => scalar($cgi->param('format')),
- } )
- : 'No tax detail file';
-
-if ($error) {
- $dbh->rollback or die $dbh->errstr if $oldAutoCommit;
-}else{
- $dbh->commit or die $dbh->errstr if $oldAutoCommit;
-}
+my $server = new FS::UI::Web::JSRPC 'FS::tax_rate::process_batch', $cgi;
</%init>