IDEMPIERE-396 Home Count is not adding the unprocessed docs #

This commit is contained in:
Carlos Ruiz 2012-08-22 21:10:53 -05:00
parent 7771156f10
commit dfe6970d3d
4 changed files with 31 additions and 14 deletions

View File

@ -42,7 +42,6 @@ import org.zkoss.zul.Vbox;
* CarlosRuiz - globalqss - Add unprocessed button to iDempiere * CarlosRuiz - globalqss - Add unprocessed button to iDempiere
*/ */
public class DPActivities extends DashboardPanel implements EventListener<Event> { public class DPActivities extends DashboardPanel implements EventListener<Event> {
/** /**
* *
*/ */
@ -56,8 +55,6 @@ public class DPActivities extends DashboardPanel implements EventListener<Event>
private int noOfNotice, noOfRequest, noOfWorkflow, noOfUnprocessed; private int noOfNotice, noOfRequest, noOfWorkflow, noOfUnprocessed;
private boolean isShowUnprocessed;
public DPActivities() public DPActivities()
{ {
super(); super();
@ -66,8 +63,6 @@ public class DPActivities extends DashboardPanel implements EventListener<Event>
private Box createActivitiesPanel() private Box createActivitiesPanel()
{ {
isShowUnprocessed = (Env.getAD_Client_ID(Env.getCtx()) > 0);
Vbox vbox = new Vbox(); Vbox vbox = new Vbox();
btnNotice = new Button(); btnNotice = new Button();
@ -100,7 +95,7 @@ public class DPActivities extends DashboardPanel implements EventListener<Event>
btnWorkflow.setName(String.valueOf(AD_Menu_ID)); btnWorkflow.setName(String.valueOf(AD_Menu_ID));
btnWorkflow.addEventListener(Events.ON_CLICK, this); btnWorkflow.addEventListener(Events.ON_CLICK, this);
if (isShowUnprocessed) { if (isShowUnprocessed()) {
btnUnprocessed = new Button(); btnUnprocessed = new Button();
vbox.appendChild(btnUnprocessed); vbox.appendChild(btnUnprocessed);
labelU = Util.cleanAmp(Msg.translate(Env.getCtx(), "UnprocessedDocs")); labelU = Util.cleanAmp(Msg.translate(Env.getCtx(), "UnprocessedDocs"));
@ -115,6 +110,10 @@ public class DPActivities extends DashboardPanel implements EventListener<Event>
return vbox; return vbox;
} }
private static boolean isShowUnprocessed() {
return (Env.getAD_Client_ID(Env.getCtx()) > 0);
}
/** /**
* Get notice count * Get notice count
* @return number of notice * @return number of notice
@ -204,6 +203,9 @@ public class DPActivities extends DashboardPanel implements EventListener<Event>
*/ */
public static int getUnprocessedCount() public static int getUnprocessedCount()
{ {
if (! isShowUnprocessed())
return 0;
String sql = "SELECT COUNT(1) FROM RV_Unprocessed " String sql = "SELECT COUNT(1) FROM RV_Unprocessed "
+ "WHERE AD_Client_ID=? AND CreatedBy=?"; + "WHERE AD_Client_ID=? AND CreatedBy=?";
@ -217,7 +219,7 @@ public class DPActivities extends DashboardPanel implements EventListener<Event>
noOfNotice = getNoticeCount(); noOfNotice = getNoticeCount();
noOfRequest = getRequestCount(); noOfRequest = getRequestCount();
noOfWorkflow = getWorkflowCount(); noOfWorkflow = getWorkflowCount();
if (isShowUnprocessed) noOfUnprocessed = getUnprocessedCount(); noOfUnprocessed = getUnprocessedCount();
template.executeAsync(this); template.executeAsync(this);
} }
@ -234,7 +236,7 @@ public class DPActivities extends DashboardPanel implements EventListener<Event>
btnNotice.setLabel(labelN + " : " + noOfNotice); btnNotice.setLabel(labelN + " : " + noOfNotice);
btnRequest.setLabel(labelR + " : " + noOfRequest); btnRequest.setLabel(labelR + " : " + noOfRequest);
btnWorkflow.setLabel(labelW + " : " + noOfWorkflow); btnWorkflow.setLabel(labelW + " : " + noOfWorkflow);
if (isShowUnprocessed) btnUnprocessed.setLabel(labelU + " : " + noOfUnprocessed); if (isShowUnprocessed()) btnUnprocessed.setLabel(labelU + " : " + noOfUnprocessed);
} }
public void onEvent(Event event) public void onEvent(Event event)

View File

@ -79,6 +79,8 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
private int noOfWorkflow; private int noOfWorkflow;
private int noOfUnprocessed;
private Tabpanel homeTab; private Tabpanel homeTab;
private DashboardController dashboardController, sideController; private DashboardController dashboardController, sideController;
@ -223,6 +225,7 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
noOfNotice = DPActivities.getNoticeCount(); noOfNotice = DPActivities.getNoticeCount();
noOfRequest = DPActivities.getRequestCount(); noOfRequest = DPActivities.getRequestCount();
noOfWorkflow = DPActivities.getWorkflowCount(); noOfWorkflow = DPActivities.getWorkflowCount();
noOfUnprocessed = DPActivities.getUnprocessedCount();
template.executeAsync(this); template.executeAsync(this);
} }
@ -265,12 +268,14 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
} }
public void updateUI() { public void updateUI() {
int total = noOfNotice + noOfRequest + noOfWorkflow; int total = noOfNotice + noOfRequest + noOfWorkflow + noOfUnprocessed;
windowContainer.setTabTitle(0, Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Home")) windowContainer.setTabTitle(0, Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Home"))
+ " (" + total + ")", + " (" + total + ")",
Msg.translate(Env.getCtx(), "AD_Note_ID") + " : " + noOfNotice Msg.translate(Env.getCtx(), "AD_Note_ID") + " : " + noOfNotice
+ ", " + Msg.translate(Env.getCtx(), "R_Request_ID") + " : " + noOfRequest + ", " + 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() { private void autoHideMenu() {

View File

@ -79,6 +79,8 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria
private int noOfWorkflow; private int noOfWorkflow;
private int noOfUnprocessed;
private Tabpanel homeTab; private Tabpanel homeTab;
private DashboardController dashboardController, sideController; private DashboardController dashboardController, sideController;
@ -254,6 +256,7 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria
noOfNotice = DPActivities.getNoticeCount(); noOfNotice = DPActivities.getNoticeCount();
noOfRequest = DPActivities.getRequestCount(); noOfRequest = DPActivities.getRequestCount();
noOfWorkflow = DPActivities.getWorkflowCount(); noOfWorkflow = DPActivities.getWorkflowCount();
noOfUnprocessed = DPActivities.getUnprocessedCount();
template.executeAsync(this); template.executeAsync(this);
} }
@ -293,11 +296,13 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria
} }
public void updateUI() { public void updateUI() {
int total = noOfNotice + noOfRequest + noOfWorkflow; int total = noOfNotice + noOfRequest + noOfWorkflow + noOfUnprocessed;
shortcutPanel.setLabel(1, "Activities (" + total + ")"); shortcutPanel.setLabel(1, "Activities (" + total + ")");
shortcutPanel.setTooltiptext(1, Msg.translate(Env.getCtx(), "AD_Note_ID") + " : " + noOfNotice shortcutPanel.setTooltiptext(1, Msg.translate(Env.getCtx(), "AD_Note_ID") + " : " + noOfNotice
+ ", " + Msg.translate(Env.getCtx(), "R_Request_ID") + " : " + noOfRequest + ", " + 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() { private void autoHideMenu() {

View File

@ -89,6 +89,8 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial
private int noOfWorkflow; private int noOfWorkflow;
private int noOfUnprocessed;
private Tabpanel homeTab; private Tabpanel homeTab;
private DashboardController dashboardController; private DashboardController dashboardController;
@ -268,6 +270,7 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial
noOfNotice = DPActivities.getNoticeCount(); noOfNotice = DPActivities.getNoticeCount();
noOfRequest = DPActivities.getRequestCount(); noOfRequest = DPActivities.getRequestCount();
noOfWorkflow = DPActivities.getWorkflowCount(); noOfWorkflow = DPActivities.getWorkflowCount();
noOfUnprocessed = DPActivities.getUnprocessedCount();
template.executeAsync(this); template.executeAsync(this);
} }
@ -302,11 +305,13 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial
} }
public void updateUI() { public void updateUI() {
int total = noOfNotice + noOfRequest + noOfWorkflow; int total = noOfNotice + noOfRequest + noOfWorkflow + noOfUnprocessed;
navigationPanel.setLabel(2, "Activities (" + total + ")"); navigationPanel.setLabel(2, "Activities (" + total + ")");
navigationPanel.setTooltiptext(2, Msg.translate(Env.getCtx(), "AD_Note_ID") + " : " + noOfNotice navigationPanel.setTooltiptext(2, Msg.translate(Env.getCtx(), "AD_Note_ID") + " : " + noOfNotice
+ ", " + Msg.translate(Env.getCtx(), "R_Request_ID") + " : " + noOfRequest + ", " + 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() { private void autoHideMenu() {