Fixed issue 33639: Update Characteristic was not showing the correct data
authorNaroa Iriarte <naroa.iriarte@openbravo.com>
Thu, 18 Aug 2016 10:58:26 +0200
changeset 30121 9bebb4948779
parent 30120 631931694cd5
child 30122 49d28e45a11a
Fixed issue 33639: Update Characteristic was not showing the correct data

If there was a product with a subset of a product characteristic, the update characteristic process was not showing the correct data. Instead of showing the products of the subset of the product characteristic, it was showing every product of the product characteristic.
To fix this, the where clause of the selector reference has been changed, making it more restrictive in the case of having a subset.
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/UpdateInvariantCharacteristicsHandler.java
src-db/database/sourcedata/AD_REF_TREE.xml
web/js/productCharacteristicsProcess.js
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/UpdateInvariantCharacteristicsHandler.java	Mon Aug 22 14:26:46 2016 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/UpdateInvariantCharacteristicsHandler.java	Thu Aug 18 10:58:26 2016 +0200
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2013-2014 Openbravo SLU
+ * All portions are Copyright (C) 2013-2016 Openbravo SLU
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -115,6 +115,12 @@
           }
           productChar.put("valueMap", productCharValuesValueMap);
           productCharArray.put(productChar);
+          if (characteristic.getCharacteristicSubset() != null) {
+            productChar
+                .put("productCharSubsetId", characteristic.getCharacteristicSubset().getId());
+          } else {
+            productChar.put("productCharSubsetId", "-1");
+          }
         }
         response.put("productCharList", productCharArray);
         response.put("productId", productId);
--- a/src-db/database/sourcedata/AD_REF_TREE.xml	Mon Aug 22 14:26:46 2016 +0000
+++ b/src-db/database/sourcedata/AD_REF_TREE.xml	Thu Aug 18 10:58:26 2016 +0200
@@ -7,7 +7,7 @@
 <!--95582A51651D415993D0FD3B64C8E861-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--95582A51651D415993D0FD3B64C8E861-->  <AD_REFERENCE_ID><![CDATA[D3D9A7BAF4594950922A22B2D7ABFA74]]></AD_REFERENCE_ID>
 <!--95582A51651D415993D0FD3B64C8E861-->  <AD_TABLE_ID><![CDATA[E913D17C9B3847CF92235082DBE2EC44]]></AD_TABLE_ID>
-<!--95582A51651D415993D0FD3B64C8E861-->  <WHERECLAUSE><![CDATA[e.characteristic.id=@parentCharId@]]></WHERECLAUSE>
+<!--95582A51651D415993D0FD3B64C8E861-->  <WHERECLAUSE><![CDATA[e.characteristic.id= @parentCharId@ and ('-1'= @productCharSubsetId@ or e.id in ( select  cs.characteristicValue.id from CharacteristicSubsetValue cs where cs.characteristicSubset.id = @productCharSubsetId@))]]></WHERECLAUSE>
 <!--95582A51651D415993D0FD3B64C8E861-->  <VALUEFIELD_ID><![CDATA[7B82AF2B5C2C48CDB05C78BA3DC26989]]></VALUEFIELD_ID>
 <!--95582A51651D415993D0FD3B64C8E861-->  <DISPLAYFIELD_ID><![CDATA[01982CD5659A4E76A0781FBE4FA3CFC7]]></DISPLAYFIELD_ID>
 <!--95582A51651D415993D0FD3B64C8E861-->  <AD_TABLE_TREE_ID><![CDATA[B6C7204712CC4EDEB5705C93F706DF05]]></AD_TABLE_TREE_ID>
--- a/web/js/productCharacteristicsProcess.js	Mon Aug 22 14:26:46 2016 +0000
+++ b/web/js/productCharacteristicsProcess.js	Thu Aug 18 10:58:26 2016 +0200
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2013-2015 Openbravo SLU 
+ * All portions are Copyright (C) 2013-2016 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -175,7 +175,8 @@
       this.tree.originalShow = this.tree.show;
       this.tree.treeItem.addParamsToRequest = function () {
         return {
-          parentCharId: this.parentCharId
+          parentCharId: this.parentCharId,
+          productCharSubsetId: this.productCharSubsetId
         }
       };
       this.tree.show = function (explicitCriteria) {
@@ -217,6 +218,7 @@
           displayField: 'name',
           valueField: 'id',
           referencedTableId: 'E913D17C9B3847CF92235082DBE2EC44',
+          productCharSubsetId: this.characteristicList[i].productCharSubsetId,
           pickListFields: [{
             title: ' ',
             name: 'name',