[freeside-commits] freeside/httemplate/misc/process enable_or_disable_tax.html, 1.1, 1.2
Jeff Finucane,420,,
jeff at wavetail.420.am
Wed Jul 23 07:36:18 PDT 2008
Update of /home/cvs/cvsroot/freeside/httemplate/misc/process
In directory wavetail.420.am:/tmp/cvs-serv11645/httemplate/misc/process
Modified Files:
enable_or_disable_tax.html
Log Message:
add disabled column to new tax rates, false laziness elimination, and bug fixes - closes #3566
Index: enable_or_disable_tax.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/misc/process/enable_or_disable_tax.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- enable_or_disable_tax.html 18 Jun 2008 18:50:46 -0000 1.1
+++ enable_or_disable_tax.html 23 Jul 2008 14:36:16 -0000 1.2
@@ -20,79 +20,15 @@
$action = $1;
}
-my $data_vendor = '';
-if ( $cgi->param('data_vendor') =~ /^(\w+)$/ ) {
- $data_vendor = $1;
-}
-
-my $geocode = '';
-if ( $cgi->param('geocode') =~ /^(\w+)$/ ) {
- $geocode = $1;
-}
-
-my $taxclassnum = '';
-if ( $cgi->param('taxclassnum') =~ /^(\d+)$/ ) {
- $taxclassnum = $1;
- my $tax_class = qsearchs('tax_class', {'taxclassnum' => $taxclassnum});
- $taxclassnum = ''
- unless ($tax_class);
-}
-
-my $tax_type = $1
- if ( $cgi->param('tax_type') =~ /^(\d+)$/ );
-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);
- my @tax_class =
- qsearch({ 'table' => 'tax_class',
- 'hashref' => {},
- 'extra_sql' => "WHERE taxclass $compare",
- });
- if (@tax_class) {
- @taxclassnum = map { $_->taxclassnum } @tax_class;
- $tax_class[0]->description =~ /^(.*):(.*)/;
- }else{
- $tax_type = '';
- $tax_cat = '';
- }
-}
-
-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 @tax_rate = qsearch({ 'table' => 'tax_rate',
- 'hashref' => {},
- 'extra_sql' => $extra_sql,
- });
+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->setuptax('') : $tax_rate->setuptax('Y');
- $action eq 'enable' ? $tax_rate->recurtax('') : $tax_rate->recurtax('Y');
+ $action eq 'enable' ? $tax_rate->disabled('') : $tax_rate->disabled('Y');
# $tax_rate->manual('Y');
$error ||= $tax_rate->replace;
last if $error;
More information about the freeside-commits
mailing list