details:   https://code.openbravo.com/erp/devel/pi/rev/6b80b8d83087
changeset: 21051:6b80b8d83087
user:      Shankar Balachandran <shankar.balachandran <at> openbravo.com>
date:      Fri Aug 30 18:28:25 2013 +0530
summary:   Related to issue 24574 : Prevent incorrect filtering in list and 
composite identifiers

In case of list reference, the search key is passed instead of name, so the 
approach to add double equals before prevents filter.
Added check to continue in case of list reference. Similarly in the case the 
field has multiple identifiers, then the filtering is not done by adding double 
equals.

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-list-filter.js
 |   2 +-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-list.js
        |  16 ++++++---
 2 files changed, 12 insertions(+), 6 deletions(-)

diffs (52 lines):

diff -r 68b2765a34ff -r 6b80b8d83087 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-list-filter.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-list-filter.js
 Fri Aug 30 11:11:11 2013 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-list-filter.js
 Fri Aug 30 18:28:25 2013 +0530
@@ -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) 2011-2012 Openbravo SLU
+ * All portions are Copyright (C) 2011-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
diff -r 68b2765a34ff -r 6b80b8d83087 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-list.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-list.js
        Fri Aug 30 11:11:11 2013 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-list.js
        Fri Aug 30 18:28:25 2013 +0530
@@ -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) 2011-2012 Openbravo SLU
+ * All portions are Copyright (C) 2011-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -66,17 +66,23 @@
 
   // is overridden to keep track that a value has been explicitly picked
   pickValue: function (value) {
-    var i;
+    var i, referenceType;
     this._pickedValue = true;
     // force the update of the list
     // if the user has entered with the keyboard the exact content of a list 
option,
     // its callout would not be called because the change would not be detected
     // see issue https://issues.openbravo.com/view.php?id=21491
     this._value = (this.value) ? this._value.concat(Math.random()) : 
Math.random();
-    //adding double equals to filter the exact value and not all matching sub 
strings. Refer issue https://issues.openbravo.com/view.php?id=24574.
-    if (value) {
+    //in case the reference is a foreign key reference,
+    //adding double equals to filter the exact value and not all matching sub 
strings.
+    //Refer issue https://issues.openbravo.com/view.php?id=24574.
+    referenceType = isc.SimpleType.getType(this.type).editorType;
+    if (value && referenceType !== 'OBListItem') {
       for (i = 0; i < value.length; i++) {
-        value[i] = "==" + value[i];
+        //do not append when composite identifiers are present.
+        if (value[i].indexOf(" - ") === -1) {
+          value[i] = "==" + value[i];
+        }
       }
     }
     this.Super('pickValue', arguments);

------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to