X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fbrowse%2Ftax_rate.cgi;h=cb997fada6842686e772e3c68b192e349a57c270;hp=5d43d5939acc3dca9d5d9ce000f1c0f4dcd97c6d;hb=f822e27a1e00594332ffa487a1c284234c5580a6;hpb=6626dc2a13c809092aa539c5a72bc72a0c56afdc diff --git a/httemplate/browse/tax_rate.cgi b/httemplate/browse/tax_rate.cgi index 5d43d5939..cb997fada 100755 --- a/httemplate/browse/tax_rate.cgi +++ b/httemplate/browse/tax_rate.cgi @@ -1,23 +1,21 @@ <% include( 'elements/browse.html', - 'title' => "Tax Rates $title", - 'name_singular' => 'tax rate', - 'menubar' => \@menubar, - 'html_init' => $html_init, - 'query' => { - 'table' => 'tax_rate', - 'hashref' => $hashref, - 'order_by' => 'ORDER BY geocode, taxclassnum', - 'extra_sql' => $extra_sql, - }, - 'count_query' => $count_query, - 'header' => \@header, - 'header2' => \@header2, - 'fields' => \@fields, - 'align' => $align, - 'color' => \@color, - 'cell_style' => \@cell_style, - 'links' => \@links, - 'link_onclicks' => \@link_onclicks, + 'title' => "Tax Rates $title", + 'name_singular' => 'tax rate', + 'menubar' => \@menubar, + 'html_init' => $html_init, + 'html_form' => $html_form, + 'disableable' => 1, + 'disabled_statuspos' => 5, + 'query' => $query, + 'count_query' => $count_query, + 'header' => \@header, + 'header2' => \@header2, + 'fields' => \@fields, + 'align' => $align, + 'color' => \@color, + 'cell_style' => \@cell_style, + 'links' => \@links, + 'link_onclicks' => \@link_onclicks, ) %> <%once> @@ -155,7 +153,6 @@ my $tax_type = $1 my $tax_cat = $1 if ( $cgi->param('tax_cat') =~ /^(\d+)$/ ); -my @taxclassnum = (); if ($tax_type || $tax_cat ) { my $compare = "LIKE '". ( $tax_type || "%" ). ":". ( $tax_cat || "%" ). "'"; $compare = "= '$tax_type:$tax_cat'" if ($tax_type && $tax_cat); @@ -165,7 +162,6 @@ if ($tax_type || $tax_cat ) { 'extra_sql' => "WHERE taxclass $compare", }); if (@tax_class) { - @taxclassnum = map { $_->taxclassnum } @tax_class; $tax_class[0]->description =~ /^(.*):(.*)/; $title .= " for"; $title .= " $tax_type ($1) tax type" if $tax_type; @@ -179,7 +175,6 @@ if ($tax_type || $tax_cat ) { $cgi->delete('tax_type'); $cgi->delete('tax_cat'); - if ( $geocode || $taxclassnum ) { push @menubar, 'View all tax rates' => $p.'browse/tax_rate.cgi'; } @@ -193,28 +188,22 @@ $cgi->param('taxclassnum', $taxclassnum ) if $taxclassnum; $cgi->param('tax_type', $tax_type ) if $tax_type; $cgi->param('tax_cat', $tax_cat ) if $tax_cat; -my $hashref = {}; -my $extra_sql = ''; -if ( $data_vendor ) { - $extra_sql .= ' WHERE data_vendor = '. dbh->quote($data_vendor); -} - -if ( $geocode ) { - $extra_sql .= ( $extra_sql =~ /WHERE/i ? ' AND ' : ' WHERE ' ). - ' geocode LIKE '. dbh->quote($geocode.'%'); -} - -if ( $taxclassnum ) { - $extra_sql .= ( $extra_sql =~ /WHERE/i ? ' AND ' : ' WHERE ' ). - ' taxclassnum = '. dbh->quote($taxclassnum); -} - -if ( @taxclassnum ) { - $extra_sql .= ( $extra_sql =~ /WHERE/i ? ' AND ' : ' WHERE ' ). - join(' OR ', map { " taxclassnum = $_ " } @taxclassnum ); -} +my $html_form = include('/elements/init_overlib.html'). '

'. + join(' ', + map { + include('/elements/popup_link.html', + { + 'action' => $p. "misc/enable_or_disable_tax.html?action=$_&". + $cgi->query_string, + 'label' => ucfirst($_). ' all these taxes', + 'actionlabel' => ucfirst($_). ' taxes', + }, + ); + } + qw(disable enable) + ); -my $count_query = "SELECT COUNT(*) FROM tax_rate $extra_sql"; +my ($query, $count_query) = FS::tax_rate::browse_queries(scalar($cgi->Vars)); $cell_style = '';