From dfe6970d3d73c5e4253e17b83c2092fecee0eb95 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 22 Aug 2012 21:10:53 -0500 Subject: [PATCH] IDEMPIERE-396 Home Count is not adding the unprocessed docs # --- .../webui/dashboard/DPActivities.java | 18 ++++++++++-------- .../webui/desktop/DefaultDesktop.java | 9 +++++++-- .../webui/desktop/NavBar2Desktop.java | 9 +++++++-- .../adempiere/webui/desktop/NavBarDesktop.java | 9 +++++++-- 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPActivities.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPActivities.java index 1e1fa79067..2bda34d7ac 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPActivities.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPActivities.java @@ -42,7 +42,6 @@ import org.zkoss.zul.Vbox; * CarlosRuiz - globalqss - Add unprocessed button to iDempiere */ public class DPActivities extends DashboardPanel implements EventListener { - /** * */ @@ -56,8 +55,6 @@ public class DPActivities extends DashboardPanel implements EventListener private int noOfNotice, noOfRequest, noOfWorkflow, noOfUnprocessed; - private boolean isShowUnprocessed; - public DPActivities() { super(); @@ -66,8 +63,6 @@ public class DPActivities extends DashboardPanel implements EventListener private Box createActivitiesPanel() { - isShowUnprocessed = (Env.getAD_Client_ID(Env.getCtx()) > 0); - Vbox vbox = new Vbox(); btnNotice = new Button(); @@ -100,7 +95,7 @@ public class DPActivities extends DashboardPanel implements EventListener btnWorkflow.setName(String.valueOf(AD_Menu_ID)); btnWorkflow.addEventListener(Events.ON_CLICK, this); - if (isShowUnprocessed) { + if (isShowUnprocessed()) { btnUnprocessed = new Button(); vbox.appendChild(btnUnprocessed); labelU = Util.cleanAmp(Msg.translate(Env.getCtx(), "UnprocessedDocs")); @@ -115,6 +110,10 @@ public class DPActivities extends DashboardPanel implements EventListener return vbox; } + private static boolean isShowUnprocessed() { + return (Env.getAD_Client_ID(Env.getCtx()) > 0); + } + /** * Get notice count * @return number of notice @@ -204,6 +203,9 @@ public class DPActivities extends DashboardPanel implements EventListener */ public static int getUnprocessedCount() { + if (! isShowUnprocessed()) + return 0; + String sql = "SELECT COUNT(1) FROM RV_Unprocessed " + "WHERE AD_Client_ID=? AND CreatedBy=?"; @@ -217,7 +219,7 @@ public class DPActivities extends DashboardPanel implements EventListener noOfNotice = getNoticeCount(); noOfRequest = getRequestCount(); noOfWorkflow = getWorkflowCount(); - if (isShowUnprocessed) noOfUnprocessed = getUnprocessedCount(); + noOfUnprocessed = getUnprocessedCount(); template.executeAsync(this); } @@ -234,7 +236,7 @@ public class DPActivities extends DashboardPanel implements EventListener btnNotice.setLabel(labelN + " : " + noOfNotice); btnRequest.setLabel(labelR + " : " + noOfRequest); btnWorkflow.setLabel(labelW + " : " + noOfWorkflow); - if (isShowUnprocessed) btnUnprocessed.setLabel(labelU + " : " + noOfUnprocessed); + if (isShowUnprocessed()) btnUnprocessed.setLabel(labelU + " : " + noOfUnprocessed); } public void onEvent(Event event) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java index fe04469911..6311ab4615 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java @@ -79,6 +79,8 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria private int noOfWorkflow; + private int noOfUnprocessed; + private Tabpanel homeTab; private DashboardController dashboardController, sideController; @@ -223,6 +225,7 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria noOfNotice = DPActivities.getNoticeCount(); noOfRequest = DPActivities.getRequestCount(); noOfWorkflow = DPActivities.getWorkflowCount(); + noOfUnprocessed = DPActivities.getUnprocessedCount(); template.executeAsync(this); } @@ -265,12 +268,14 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria } public void updateUI() { - int total = noOfNotice + noOfRequest + noOfWorkflow; + int total = noOfNotice + noOfRequest + noOfWorkflow + noOfUnprocessed; windowContainer.setTabTitle(0, Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Home")) + " (" + total + ")", Msg.translate(Env.getCtx(), "AD_Note_ID") + " : " + noOfNotice + ", " + Msg.translate(Env.getCtx(), "R_Request_ID") + " : " + noOfRequest - + ", " + Msg.getMsg (Env.getCtx(), "WorkflowActivities") + " : " + noOfWorkflow); + + ", " + Util.cleanAmp(Msg.getMsg (Env.getCtx(), "WorkflowActivities")) + " : " + noOfWorkflow + + (noOfUnprocessed>0 ? ", " + Msg.getMsg (Env.getCtx(), "UnprocessedDocs") + " : " + noOfUnprocessed : "") + ); } private void autoHideMenu() { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/NavBar2Desktop.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/NavBar2Desktop.java index 0fdad96d8c..22beaeee73 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/NavBar2Desktop.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/NavBar2Desktop.java @@ -79,6 +79,8 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria private int noOfWorkflow; + private int noOfUnprocessed; + private Tabpanel homeTab; private DashboardController dashboardController, sideController; @@ -254,6 +256,7 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria noOfNotice = DPActivities.getNoticeCount(); noOfRequest = DPActivities.getRequestCount(); noOfWorkflow = DPActivities.getWorkflowCount(); + noOfUnprocessed = DPActivities.getUnprocessedCount(); template.executeAsync(this); } @@ -293,11 +296,13 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria } public void updateUI() { - int total = noOfNotice + noOfRequest + noOfWorkflow; + int total = noOfNotice + noOfRequest + noOfWorkflow + noOfUnprocessed; shortcutPanel.setLabel(1, "Activities (" + total + ")"); shortcutPanel.setTooltiptext(1, Msg.translate(Env.getCtx(), "AD_Note_ID") + " : " + noOfNotice + ", " + Msg.translate(Env.getCtx(), "R_Request_ID") + " : " + noOfRequest - + ", " + Msg.getMsg (Env.getCtx(), "WorkflowActivities") + " : " + noOfWorkflow); + + ", " + Msg.getMsg (Env.getCtx(), "WorkflowActivities") + " : " + noOfWorkflow + + (noOfUnprocessed>0 ? ", " + Msg.getMsg (Env.getCtx(), "UnprocessedDocs") + " : " + noOfUnprocessed : "") + ); } private void autoHideMenu() { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/NavBarDesktop.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/NavBarDesktop.java index b22acddd47..375b508101 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/NavBarDesktop.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/NavBarDesktop.java @@ -89,6 +89,8 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial private int noOfWorkflow; + private int noOfUnprocessed; + private Tabpanel homeTab; private DashboardController dashboardController; @@ -268,6 +270,7 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial noOfNotice = DPActivities.getNoticeCount(); noOfRequest = DPActivities.getRequestCount(); noOfWorkflow = DPActivities.getWorkflowCount(); + noOfUnprocessed = DPActivities.getUnprocessedCount(); template.executeAsync(this); } @@ -302,11 +305,13 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial } public void updateUI() { - int total = noOfNotice + noOfRequest + noOfWorkflow; + int total = noOfNotice + noOfRequest + noOfWorkflow + noOfUnprocessed; navigationPanel.setLabel(2, "Activities (" + total + ")"); navigationPanel.setTooltiptext(2, Msg.translate(Env.getCtx(), "AD_Note_ID") + " : " + noOfNotice + ", " + Msg.translate(Env.getCtx(), "R_Request_ID") + " : " + noOfRequest - + ", " + Msg.getMsg (Env.getCtx(), "WorkflowActivities") + " : " + noOfWorkflow); + + ", " + Msg.getMsg (Env.getCtx(), "WorkflowActivities") + " : " + noOfWorkflow + + (noOfUnprocessed>0 ? ", " + Msg.getMsg (Env.getCtx(), "UnprocessedDocs") + " : " + noOfUnprocessed : "") + ); } private void autoHideMenu() {