X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Ftaxproduct.cgi;h=1533e8810583d700df3b0bd8bfe0859703265fe2;hb=0549def83bcba56e53482ea0f33472e18b215649;hp=b22849343f4fd774857ed75ce6882ec9b4165c78;hpb=f4bb9273f1ba174858e221fd37f6dd1dca4119e9;p=freeside.git diff --git a/httemplate/misc/taxproduct.cgi b/httemplate/misc/taxproduct.cgi index b22849343..1533e8810 100644 --- a/httemplate/misc/taxproduct.cgi +++ b/httemplate/misc/taxproduct.cgi @@ -5,13 +5,16 @@ my $vendor = $conf->config('tax_data_vendor'); <%init> my $term = $cgi->param('term'); warn "taxproduct.cgi?$term"; # XXX debug -my $search = { table => 'part_pkg_taxproduct' }; +my $search = { + table => 'part_pkg_taxproduct', + hashref => { 'data_vendor' => $vendor } +}; if ( $term =~ /^\d+$/ ) { - $search->{extra_sql} = " WHERE taxproduct LIKE '$term%'"; + $search->{extra_sql} = " AND taxproduct LIKE '$term%'"; $search->{order_by} = " ORDER BY taxproduct ASC"; } elsif ( length($term) ) { $term = dbh->quote( lc($term) ); # protect against bad strings - $search->{extra_sql} = " WHERE POSITION($term IN LOWER(description)) > 0"; + $search->{extra_sql} = " AND POSITION($term IN LOWER(description)) > 0"; # and sort by how close to the beginning of the string it is $search->{order_by} = " ORDER BY POSITION($term IN LOWER(description)) ASC, LOWER(description) ASC, taxproduct ASC"; }