From 52e5c0e05140ae3b1ae0bfd7486ac33a3af6f55c Mon Sep 17 00:00:00 2001
From: Mark Wells <mark@freeside.biz>
Date: Tue, 24 Feb 2015 15:12:13 -0800
Subject: [PATCH] fix SQL syntax, #25718

---
 FS/FS/part_pkg_taxproduct.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/FS/FS/part_pkg_taxproduct.pm b/FS/FS/part_pkg_taxproduct.pm
index c12a432a3..e86d0285a 100644
--- a/FS/FS/part_pkg_taxproduct.pm
+++ b/FS/FS/part_pkg_taxproduct.pm
@@ -153,7 +153,11 @@ sub part_pkg_taxrate {
     map { $_->taxproductnum }
     $self->expand_cch_taxproduct
   );
-  $extra_sql .= "AND taxproductnum IN($tpnums)";
+
+  # if there are no taxproductnums, there are no matching tax classes
+  return if length($tpnums) == 0;
+
+  $extra_sql .= " AND taxproductnum IN($tpnums)";
 
   my $addl_from = 'LEFT JOIN part_pkg_taxproduct USING ( taxproductnum )';
   my $order_by = 'ORDER BY taxclassnum, length(geocode) desc, length(taxproduct) desc';
-- 
2.20.1