From 07df8db4a07137e678a36b37070721566955295c Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Mon, 24 Jul 2017 20:33:01 -0700 Subject: compliance solutions integration: import and use produce/service code catalog, RT#75262 --- httemplate/misc/xmlhttp-part_pkg_taxproduct.html | 36 ++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 httemplate/misc/xmlhttp-part_pkg_taxproduct.html (limited to 'httemplate/misc/xmlhttp-part_pkg_taxproduct.html') diff --git a/httemplate/misc/xmlhttp-part_pkg_taxproduct.html b/httemplate/misc/xmlhttp-part_pkg_taxproduct.html new file mode 100644 index 000000000..5e22dd86b --- /dev/null +++ b/httemplate/misc/xmlhttp-part_pkg_taxproduct.html @@ -0,0 +1,36 @@ +<% encode_json({ part_pkg_taxproduct => [ map { $_->taxproduct => $_->description } @part_pkg_taxproduct ] }) %>\ +<%init> + +#compliance solutions specific for now, since they asked for a multi-level +# select + +#my $sub = $cgi->param('sub'); + +warn join(', ', $cgi->param); + +my( %args ) = $cgi->multi_param('arg'); + +my $hashref = { 'data_vendor' => $args{'data_vendor'} }; + +my @part_pkg_taxproduct; +if ( $args{category} =~ /^(\w)$/ ) { + my $category = $1; + @part_pkg_taxproduct = qsearch({ + table => 'part_pkg_taxproduct', + hashref => $hashref, + extra_sql => " AND taxproduct LIKE '$category%' AND length(taxproduct) = 4 ", + }); + +} elsif ( $args{product_code} =~ /^([A-Z]\d+)$/ ) { + my $product_code = $1; + @part_pkg_taxproduct = qsearch({ + table => 'part_pkg_taxproduct', + hashref => $hashref, + extra_sql => " AND taxproduct LIKE '$product_code%' AND length(taxproduct) > 4 ", + }); + +} else { + die 'neither category nor product_code specified'; +} + + -- cgit v1.2.1