From: Ivan Kohler Date: Thu, 20 Nov 2014 20:02:14 +0000 (-0800) Subject: optimize X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=128cc33659b9811c9ed455275f76fbc7c50a47b7 optimize --- diff --git a/FS/FS/tax_rate.pm b/FS/FS/tax_rate.pm index a6da3d111..ec3bb12b6 100644 --- a/FS/FS/tax_rate.pm +++ b/FS/FS/tax_rate.pm @@ -1366,11 +1366,14 @@ sub _remember_tax_products { my ( $imported, $last, $min_sec ) = _progressbar_foo(); - my $extra_sql = "WHERE taxproductnum IS NOT NULL OR ". - "0 < ( SELECT count(*) from part_pkg_option WHERE ". - " part_pkg_option.pkgpart = part_pkg.pkgpart AND ". - " optionname LIKE 'usage_taxproductnum_%' AND ". - " optionvalue != '' )"; + my $extra_sql = " + WHERE taxproductnum IS NOT NULL + OR EXISTS ( SELECT 1 from part_pkg_option + WHERE part_pkg_option.pkgpart = part_pkg.pkgpart + AND optionname LIKE 'usage_taxproductnum_%' + AND optionvalue != '' + ) + "; my @items = qsearch( { table => 'part_pkg', select => 'DISTINCT pkgpart,taxproductnum', hashref => {},