X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Fprocess%2Ftax-import.cgi;h=b9e9daad5d85cd86b818f6c6730a8a5c78c05776;hb=a2ecb1cf6a6c084c521710f1256da082f70ba9e5;hp=77fba61f585c7b23377aeb604790be73e6819019;hpb=4104f4e3d1b387296b16b4a035b4b7f42e0c5977;p=freeside.git diff --git a/httemplate/misc/process/tax-import.cgi b/httemplate/misc/process/tax-import.cgi index 77fba61f5..b9e9daad5 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'); -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_import', $cgi;