[freeside-commits] branch FREESIDE_4_BRANCH updated. bcfe675c785d864472a1feaa2a3071295af4f357

Ivan ivan at 420.am
Tue Jul 25 00:19:25 PDT 2017


The branch, FREESIDE_4_BRANCH has been updated
       via  bcfe675c785d864472a1feaa2a3071295af4f357 (commit)
      from  11e1b0aa5f1811e75ab3fd5c51d43304301567b3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit bcfe675c785d864472a1feaa2a3071295af4f357
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Jul 25 00:19:24 2017 -0700

    compliance solutions integration: import and use produce/service code catalog, RT#75262

diff --git a/httemplate/browse/part_pkg_taxproduct/compliance_solutions.html b/httemplate/browse/part_pkg_taxproduct/compliance_solutions.html
index 78c1b0a..bbcb687 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 4cc3a3e..f7c8d24 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';

-----------------------------------------------------------------------

Summary of changes:
 .../part_pkg_taxproduct/compliance_solutions.html  |    6 ++--
 httemplate/misc/xmlhttp-part_pkg_taxproduct.html   |   33 +++++++++++++-------
 2 files changed, 25 insertions(+), 14 deletions(-)




More information about the freeside-commits mailing list