fixed bug 15910: Show funnel for 2.50 tabs with filter clause
authorAsier Lostalé <asier.lostale@openbravo.com>
Thu, 03 Mar 2011 18:21:46 +0100
changeset 11005 3637e5ba01b9
parent 11004 e0cec10b5839
child 11006 b8168b32001d
fixed bug 15910: Show funnel for 2.50 tabs with filter clause
src-wad/src/org/openbravo/wad/Wad.java
src-wad/src/org/openbravo/wad/javasource.javaxml
src/org/openbravo/erpCommon/utility/TableSQLData.java
--- a/src-wad/src/org/openbravo/wad/Wad.java	Thu Mar 03 18:08:24 2011 +0100
+++ b/src-wad/src/org/openbravo/wad/Wad.java	Thu Mar 03 18:21:46 2011 +0100
@@ -1764,19 +1764,27 @@
     // UI Patter for edition toolbar
     xmlDocument.setParameter("uiPattern", uiPattern);
 
-    String strHighVolume = "", strParamHighVolume = "", strHighVolumeComp = "";
+    String strParamHighVolume = "", strHighVolumeComp = "";
+
+    String filter1 = "(tableSQL.hasInternalFilter()";
+    String filter2 = "";
 
     if (selCol != null) {
       for (int i = 0; i < selCol.length; i++) {
-        strHighVolume += selCol[i].htmltext;
+        filter1 += " && (\"\").equals(strParam" + selCol[i].columnname + ")";
+        filter2 += " || !((\"\").equals(strParam" + selCol[i].columnname
+            + ") || (\"%\").equals(strParam" + selCol[i].columnname + ")) ";
+
         strParamHighVolume += "String strParam" + selCol[i].columnname
-            + " = vars.getSessionValue(tabId + \"|param" + selCol[i].columnname + "\");\n";
+
+        + " = vars.getSessionValue(tabId + \"|param" + selCol[i].columnname + "\");\n";
         strHighVolumeComp += selCol[i].xmltext;
-        if (i < selCol.length - 1)
-          strHighVolume += " && ";
       }
     }
-    xmlDocument.setParameter("searchName", strHighVolume);
+
+    filter1 += ")";
+
+    xmlDocument.setParameter("searchName", filter1 + filter2);
     xmlDocument.setParameter("searchVariables", strParamHighVolume);
     xmlDocument.setParameter("searchComparations", strHighVolumeComp);
 
--- a/src-wad/src/org/openbravo/wad/javasource.javaxml	Thu Mar 03 18:08:24 2011 +0100
+++ b/src-wad/src/org/openbravo/wad/javasource.javaxml	Thu Mar 03 18:21:46 2011 +0100
@@ -851,7 +851,7 @@
     <PARAMETER_TMP id="paramSearchVariables">xx</PARAMETER_TMP>
     boolean hasSearchCondition=false;
     vars.removeEditionData(tabId);
-    <FIELDS_TMP id="sectionIsHighVolume4">if (!(<PARAMETER_TMP id="paramSearchName">xx</PARAMETER_TMP>)) hasSearchCondition=true;</FIELDS_TMP>
+    <FIELDS_TMP id="sectionIsHighVolume4">hasSearchCondition = <PARAMETER_TMP id="paramSearchName">xx</PARAMETER_TMP>;</FIELDS_TMP>
     String strOffset = vars.getSessionValue(tabId + "|offset");
     String selectedRow = "0";
     if (!str<KEY_TMP id="key">PosicionAlmacen</KEY_TMP>.equals("")) {
@@ -973,7 +973,7 @@
     vars.removeEditionData(tabId);
     <PARAMETER_TMP id="paramSearchVariables">xx</PARAMETER_TMP>
     boolean hasSearchCondition=false;
-    <FIELDS_TMP id="sectionIsHighVolume4">if (!(<PARAMETER_TMP id="paramSearchName">xx</PARAMETER_TMP>)) hasSearchCondition=true;</FIELDS_TMP>
+    <FIELDS_TMP id="sectionIsHighVolume4">hasSearchCondition = <PARAMETER_TMP id="paramSearchName">xx</PARAMETER_TMP>;</FIELDS_TMP>
 
 <PARAMETER_TMP id="sectionIsHighVolume4">       String strParamSessionDate = vars.getGlobalVariable("inpParamSessionDate", Utility.getTransactionalDate(this, vars, windowId), "");</PARAMETER_TMP>
       String buscador = "";
--- a/src/org/openbravo/erpCommon/utility/TableSQLData.java	Thu Mar 03 18:08:24 2011 +0100
+++ b/src/org/openbravo/erpCommon/utility/TableSQLData.java	Thu Mar 03 18:21:46 2011 +0100
@@ -968,6 +968,16 @@
   }
 
   /**
+   * Returns true in case the tab has internal filters. Internal filters are added to tabs with
+   * filter clause and to transactional windows.
+   * 
+   * @return
+   */
+  public boolean hasInternalFilter() {
+    return internalFilter.size() > 0;
+  }
+
+  /**
    * Adds fields to the internal filter clause. The internal filter clause is the one defined by the
    * tab in the dictionary.
    *