[freeside-commits] freeside/FS/FS tax_rate_location.pm,1.3,1.4

Ivan,,, ivan at wavetail.420.am
Mon Apr 11 00:02:52 PDT 2011


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv30614/FS/FS

Modified Files:
	tax_rate_location.pm 
Log Message:
slight refactor onvendor tax report: add tax_rate_location->location_sql, RT#12320

Index: tax_rate_location.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/tax_rate_location.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -d -r1.3 -r1.4
--- tax_rate_location.pm	13 Jul 2009 16:02:32 -0000	1.3
+++ tax_rate_location.pm	11 Apr 2011 07:02:50 -0000	1.4
@@ -151,6 +151,37 @@
 
 =back
 
+=head1 CLASS METHODS
+
+=item location_sql KEY => VALUE, ...
+
+Returns an SQL fragment identifying matching tax_rate_location /
+cust_bill_pkg_tax_rate_location records.
+
+Parameters are county, state, city and locationtaxid
+
+=cut
+
+sub location_sql {
+  my($class, %param) = @_;
+
+  my %pn = (
+   'city'          => 'tax_rate_location.city',
+   'county'        => 'tax_rate_location.county',
+   'state'         => 'tax_rate_location.state',
+   'locationtaxid' => 'cust_bill_pkg_tax_rate_location.locationtaxid',
+  );
+
+  my %ph = map { $pn{$_} => dbh->quote($param{$_}) } keys %pn;
+
+  join( ' AND ',
+    map { "( $_ = $ph{$_} OR $ph{$_} = '' AND $_ IS NULL)" } keys %ph
+  );
+
+}
+
+=back
+
 =head1 SUBROUTINES
 
 =over 4



More information about the freeside-commits mailing list