From bc2454b300843ce6194d894ef2889e1053bb3580 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Tue, 25 Jul 2017 00:19:23 -0700 Subject: [PATCH] compliance solutions integration: import and use produce/service code catalog, RT#75262 --- .../part_pkg_taxproduct/compliance_solutions.html | 6 ++-- httemplate/misc/xmlhttp-part_pkg_taxproduct.html | 33 ++++++++++++++-------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/httemplate/browse/part_pkg_taxproduct/compliance_solutions.html b/httemplate/browse/part_pkg_taxproduct/compliance_solutions.html index 78c1b0a1d..bbcb6877f 100644 --- a/httemplate/browse/part_pkg_taxproduct/compliance_solutions.html +++ b/httemplate/browse/part_pkg_taxproduct/compliance_solutions.html @@ -8,10 +8,12 @@ $().ready(function() { + $('#taxproduct_submit').on('click', function() { + var service_code = $('#service_code').val().split(' '); select_taxproduct( - $('#service_code').val(), - $('#service_code').val() + ' ' + $('#service_code :selected').text() + service_code[0], + service_code[1] + ' ' + $('#service_code :selected').text() ); }); }); diff --git a/httemplate/misc/xmlhttp-part_pkg_taxproduct.html b/httemplate/misc/xmlhttp-part_pkg_taxproduct.html index 4cc3a3e64..f7c8d24a6 100644 --- a/httemplate/misc/xmlhttp-part_pkg_taxproduct.html +++ b/httemplate/misc/xmlhttp-part_pkg_taxproduct.html @@ -1,4 +1,4 @@ -<% encode_json({ part_pkg_taxproduct => [ map { $_->taxproduct => $_->description } @part_pkg_taxproduct ] }) %>\ +<% encode_json({ part_pkg_taxproduct => \@part_pkg_taxproduct }) %>\ <%init> #compliance solutions specific for now, since they asked for a multi-level @@ -8,24 +8,33 @@ my( %args ) = $cgi->multi_param('arg'); -my $hashref = { 'data_vendor' => $args{'data_vendor'} }; +my @qsearch = ( + table => 'part_pkg_taxproduct', + 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 ", - }); + + @part_pkg_taxproduct = + map { $_->taxproduct => $_->description } + qsearch({ @qsearch, + 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 ", - }); + + @part_pkg_taxproduct = + map { $_->taxproductnum. ' '. $_->taxproduct => $_->description } + qsearch({ @qsearch, + extra_sql => " AND taxproduct LIKE '$product_code%'". + " AND length(taxproduct) > 4 ", + }); } else { die 'neither category nor product_code specified'; -- 2.11.0