remove debugging
[freeside.git] / httemplate / misc / xmlhttp-part_pkg_taxproduct.html
1 <% encode_json({ part_pkg_taxproduct => [ map { $_->taxproduct => $_->description } @part_pkg_taxproduct ] }) %>\
2 <%init>
3
4 #compliance solutions specific for now, since they asked for a multi-level
5 # select
6
7 #my $sub = $cgi->param('sub');
8
9 my( %args ) = $cgi->multi_param('arg');
10
11 my $hashref = { 'data_vendor' => $args{'data_vendor'} };
12
13 my @part_pkg_taxproduct;
14 if ( $args{category} =~ /^(\w)$/ ) {
15   my $category = $1;
16   @part_pkg_taxproduct = qsearch({
17     table     => 'part_pkg_taxproduct',
18     hashref   => $hashref,
19     extra_sql => " AND taxproduct LIKE '$category%' AND length(taxproduct) = 4 ",
20   });
21
22 } elsif ( $args{product_code} =~ /^([A-Z]\d+)$/ ) {
23   my $product_code = $1;
24   @part_pkg_taxproduct = qsearch({
25     table     => 'part_pkg_taxproduct',
26     hashref   => $hashref,
27     extra_sql => " AND taxproduct LIKE '$product_code%' AND length(taxproduct) > 4 ",
28   });
29
30 } else {
31   die 'neither category nor product_code specified';
32 }
33
34 </%init>