Fixes Issue 23925: Filter does not work properly when using ^
authorShankar Balachandran <shankar.balachandran@openbravo.com>
Thu, 30 May 2013 15:37:49 +0530
changeset 20497 9708bd1d96eb
parent 20496 ff813ef90a4e
child 20498 e614965c64cc
Fixes Issue 23925: Filter does not work properly when using ^

After forming criteria from current filter, the operator symbols were removed and only the value is retained.
Added the appropriate operator symbol, based on the operator.
Ignored contains case alone as normal values will be replaced with ~value.
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js	Thu May 30 09:30:09 2013 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js	Thu May 30 15:37:49 2013 +0530
@@ -269,10 +269,23 @@
 
   setCriterion: function (criterion) {
     var i, value, values = [],
+        operator, operators, valueSet = false,
         criteria = criterion ? criterion.criteria : null;
     if (criteria && criteria.length && criterion.operator === 'or') {
       for (i = 0; i < criteria.length; i++) {
-        values.push(criteria[i].value);
+        operators = isc.DataSource.getSearchOperators();
+        if (criteria[i].operator !== "iContains" && criteria[i].operator !== "contains") {
+          for (operator in operators) {
+            if (operators[operator].ID === criteria[i].operator && operators[operator].symbol && criteria[i].value && criteria[i].value.indexOf(operators[operator].symbol) === -1) {
+              values.push(operators[operator].symbol + criteria[i].value);
+              valueSet = true;
+            }
+          }
+        }
+        if (valueSet == false) {
+          values.push(criteria[i].value);
+        }
+        valueSet = false;
       }
       this.setValue(values);
     } else {