X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Ftax_rate_location.pm;h=1a6c47dcf9b252c86f6c9f4dc5f91b7ca3ed5901;hb=b5c4237a34aef94976bc343c8d9e138664fc3984;hp=218ed977b2d809915b07475efe36c1db53913af1;hpb=63a268637b2d51a8766412617724b9436439deb6;p=freeside.git diff --git a/FS/FS/tax_rate_location.pm b/FS/FS/tax_rate_location.pm index 218ed977b..1a6c47dcf 100644 --- a/FS/FS/tax_rate_location.pm +++ b/FS/FS/tax_rate_location.pm @@ -151,6 +151,37 @@ sub check { =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