summaryrefslogtreecommitdiff
path: root/httemplate/misc/process/enable_or_disable_tax.html
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/misc/process/enable_or_disable_tax.html')
-rwxr-xr-xhttemplate/misc/process/enable_or_disable_tax.html41
1 files changed, 41 insertions, 0 deletions
diff --git a/httemplate/misc/process/enable_or_disable_tax.html b/httemplate/misc/process/enable_or_disable_tax.html
new file mode 100755
index 0000000..9b7324b
--- /dev/null
+++ b/httemplate/misc/process/enable_or_disable_tax.html
@@ -0,0 +1,41 @@
+%if ($error) {
+<% $cgi->redirect(popurl(2).'enable_or_disable_tax.html?'.$cgi->query_string) %>
+%}else{
+ <% include('/elements/header-popup.html', $title) %>
+
+ <SCRIPT TYPE="text/javascript">
+ window.top.location.reload();
+ </SCRIPT>
+
+ </BODY>
+ </HTML>
+%}
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my $action = '';
+if ( $cgi->param('action') =~ /^(\w+)$/ ) {
+ $action = $1;
+}
+
+my ($query, $count_query) = FS::tax_rate::browse_queries(scalar($cgi->Vars));
+my @tax_rate = qsearch( $query );
+
+#transaction?
+my $error;
+$error = "Invalid action" unless ($action =~ /enable|disable/);
+
+foreach my $tax_rate (@tax_rate) {
+ $action eq 'enable' ? $tax_rate->disabled('') : $tax_rate->disabled('Y');
+ # $tax_rate->manual('Y');
+ $error ||= $tax_rate->replace;
+ last if $error;
+}
+$cgi->param('error', $error) if $error;
+
+my $title = scalar(@tax_rate) == 1 ? 'Tax rate ' : 'Tax rates ';
+$title .= lc($action). 'd';
+
+</%init>