Fixes issue 0010729: Now it displays only tables with information inside.
authorDavid Miguelez <david.miguelez@openbravo.com>
Fri, 04 May 2012 12:40:39 +0200
changeset 16494 cafefe0b3587
parent 16493 14fa9e4fa73f
child 16495 1ac6a16a51d7
Fixes issue 0010729: Now it displays only tables with information inside.
src/org/openbravo/erpCommon/ad_reports/MInOutTraceReports.java
--- a/src/org/openbravo/erpCommon/ad_reports/MInOutTraceReports.java	Wed Apr 25 16:40:40 2012 +0200
+++ b/src/org/openbravo/erpCommon/ad_reports/MInOutTraceReports.java	Fri May 04 12:40:39 2012 +0200
@@ -28,6 +28,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.commons.lang.ArrayUtils;
 import org.openbravo.base.secureApp.HttpSecureAppServlet;
 import org.openbravo.base.secureApp.VariablesSecureApp;
 import org.openbravo.erpCommon.businessUtility.WindowTabs;
@@ -171,11 +172,17 @@
   private MInOutTraceReportsData[] processData(VariablesSecureApp vars,
       MInOutTraceReportsData[] data, String strIn, String strmProductIdGlobal,
       Hashtable<String, Integer> calculated, Vector<Integer> count) throws ServletException {
-    if (data == null || data.length == 0)
+    if (data == null || data.length == 0) {
       return data;
+    }
     for (int i = 0; i < data.length; i++) {
       data[i].html = processChilds(vars, data[i].mAttributesetinstanceId, data[i].mProductId,
           data[i].mLocatorId, strIn, true, strmProductIdGlobal, calculated, count);
+      if ("".equals(data[i].html)) {
+        // Delete data[i] from array
+        data = (MInOutTraceReportsData[]) ArrayUtils.removeElement(data, data[i]);
+        i--;
+      }
     }
     return data;
   }
@@ -233,8 +240,9 @@
     MInOutTraceReportsData[] dataChild = MInOutTraceReportsData.selectChilds(this, vars
         .getLanguage(), mAttributesetinstanceId, mProductId, mLocatorId,
         strIn.equals("Y") ? "plusQty" : "minusQty", strIn.equals("N") ? "minusQty" : "plusQty");
-    if (dataChild == null || dataChild.length == 0)
+    if (dataChild == null || dataChild.length == 0) {
       return "";
+    }
     boolean colorbg = true;
 
     strHtml.append(insertHeaderHtml(false, "0"));