diff --git a/base/src/org/compiere/model/I_PA_DashboardContent.java b/base/src/org/compiere/model/I_PA_DashboardContent.java index 6a846290c6..e35945a562 100644 --- a/base/src/org/compiere/model/I_PA_DashboardContent.java +++ b/base/src/org/compiere/model/I_PA_DashboardContent.java @@ -46,9 +46,9 @@ public interface I_PA_DashboardContent KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name); - /** AccessLevel = 1 - Org + /** AccessLevel = 6 - System - Client */ - BigDecimal accessLevel = BigDecimal.valueOf(1); + BigDecimal accessLevel = BigDecimal.valueOf(6); /** Load Meta Data */ @@ -65,7 +65,20 @@ public interface I_PA_DashboardContent */ public int getAD_Window_ID(); - public I_AD_Window getAD_Window() throws Exception; + public I_AD_Window getAD_Window() throws RuntimeException; + + /** Column name ColumnNo */ + public static final String COLUMNNAME_ColumnNo = "ColumnNo"; + + /** Set Column No. + * Dashboard content column number + */ + public void setColumnNo (int ColumnNo); + + /** Get Column No. + * Dashboard content column number + */ + public int getColumnNo(); /** Column name Description */ public static final String COLUMNNAME_Description = "Description"; @@ -137,5 +150,18 @@ public interface I_PA_DashboardContent */ public int getPA_Goal_ID(); - public I_PA_Goal getPA_Goal() throws Exception; + public I_PA_Goal getPA_Goal() throws RuntimeException; + + /** Column name ZulFilePath */ + public static final String COLUMNNAME_ZulFilePath = "ZulFilePath"; + + /** Set ZUL File Path. + * Absolute path to zul file + */ + public void setZulFilePath (String ZulFilePath); + + /** Get ZUL File Path. + * Absolute path to zul file + */ + public String getZulFilePath(); } diff --git a/base/src/org/compiere/model/X_PA_DashboardContent.java b/base/src/org/compiere/model/X_PA_DashboardContent.java index 4e63ceb551..5bcc7d541b 100644 --- a/base/src/org/compiere/model/X_PA_DashboardContent.java +++ b/base/src/org/compiere/model/X_PA_DashboardContent.java @@ -54,7 +54,7 @@ public class X_PA_DashboardContent extends PO implements I_PA_DashboardContent, } /** AccessLevel - * @return 1 - Org + * @return 6 - System - Client */ protected int get_AccessLevel() { @@ -75,7 +75,7 @@ public class X_PA_DashboardContent extends PO implements I_PA_DashboardContent, return sb.toString(); } - public I_AD_Window getAD_Window() throws Exception + public I_AD_Window getAD_Window() throws RuntimeException { Class clazz = MTable.getClass(I_AD_Window.Table_Name); I_AD_Window result = null; @@ -86,7 +86,7 @@ public class X_PA_DashboardContent extends PO implements I_PA_DashboardContent, } catch (Exception e) { log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); - throw e; + throw new RuntimeException( e ); } return result; } @@ -114,6 +114,26 @@ public class X_PA_DashboardContent extends PO implements I_PA_DashboardContent, return ii.intValue(); } + /** Set Column No. + @param ColumnNo + Dashboard content column number + */ + public void setColumnNo (int ColumnNo) + { + set_Value (COLUMNNAME_ColumnNo, Integer.valueOf(ColumnNo)); + } + + /** Get Column No. + @return Dashboard content column number + */ + public int getColumnNo () + { + Integer ii = (Integer)get_Value(COLUMNNAME_ColumnNo); + if (ii == null) + return 0; + return ii.intValue(); + } + /** Set Description. @param Description Optional short description of the record @@ -211,7 +231,7 @@ public class X_PA_DashboardContent extends PO implements I_PA_DashboardContent, return ii.intValue(); } - public I_PA_Goal getPA_Goal() throws Exception + public I_PA_Goal getPA_Goal() throws RuntimeException { Class clazz = MTable.getClass(I_PA_Goal.Table_Name); I_PA_Goal result = null; @@ -222,7 +242,7 @@ public class X_PA_DashboardContent extends PO implements I_PA_DashboardContent, } catch (Exception e) { log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); - throw e; + throw new RuntimeException( e ); } return result; } @@ -249,4 +269,21 @@ public class X_PA_DashboardContent extends PO implements I_PA_DashboardContent, return 0; return ii.intValue(); } + + /** Set ZUL File Path. + @param ZulFilePath + Absolute path to zul file + */ + public void setZulFilePath (String ZulFilePath) + { + set_Value (COLUMNNAME_ZulFilePath, ZulFilePath); + } + + /** Get ZUL File Path. + @return Absolute path to zul file + */ + public String getZulFilePath () + { + return (String)get_Value(COLUMNNAME_ZulFilePath); + } } \ No newline at end of file diff --git a/client/src/org/adempiere/apps/graph/HtmlDashboard.java b/client/src/org/adempiere/apps/graph/HtmlDashboard.java index 13289b2166..134893e154 100644 --- a/client/src/org/adempiere/apps/graph/HtmlDashboard.java +++ b/client/src/org/adempiere/apps/graph/HtmlDashboard.java @@ -141,6 +141,7 @@ public class HtmlDashboard extends JPanel implements MouseListener, + " FROM PA_DASHBOARDCONTENT x" + " LEFT OUTER JOIN AD_MENU m ON x.ad_window_id=m.ad_window_id" + " WHERE (x.AD_Client_ID=0 OR x.AD_Client_ID=?) AND x.IsActive='Y'" + + " AND x.ZulFilePath IS NULL" // Elaine 2008/11/19 - available in WebUI only at the moment + " ORDER BY LINE"; PreparedStatement pstmt = null; ResultSet rs = null; diff --git a/migration/352a-trunk/326_FR2164648Implement_PA_DASHBOARDCONTENT_support.sql b/migration/352a-trunk/326_FR2164648Implement_PA_DASHBOARDCONTENT_support.sql new file mode 100644 index 0000000000..deee8d3b96 --- /dev/null +++ b/migration/352a-trunk/326_FR2164648Implement_PA_DASHBOARDCONTENT_support.sql @@ -0,0 +1,415 @@ +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Window_Access WHERE AD_Role_ID=50002 +; + +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Window_Access (AD_Window_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT w.AD_Window_ID, 50002,0,0,'Y', SysDate,100, SysDate,100,'Y' FROM AD_Window w INNER JOIN AD_Tab t ON (w.AD_Window_ID=t.AD_Window_ID) INNER JOIN AD_Table tt ON (t.AD_Table_ID=tt.AD_Table_ID) WHERE t.SeqNo=(SELECT MIN(SeqNo) FROM AD_Tab xt WHERE xt.AD_Window_ID=w.AD_Window_ID)AND tt.AccessLevel IN ('4','7','6') +; + +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Process_Access WHERE AD_Role_ID=50002 +; + +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Process_Access (AD_Process_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT p.AD_Process_ID, 50002,0,0,'Y', SysDate,100, SysDate,100,'Y' FROM AD_Process p WHERE AccessLevel IN ('4','7','6') +; + +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Form_Access WHERE AD_Role_ID=50002 +; + +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Form_Access (AD_Form_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT f.AD_Form_ID, 50002,0,0,'Y', SysDate,100, SysDate,100,'Y' FROM AD_Form f WHERE AccessLevel IN ('4','7','6') +; + +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_WorkFlow_Access WHERE AD_Role_ID=50002 +; + +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_WorkFlow_Access (AD_WorkFlow_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT w.AD_WorkFlow_ID, 50002,0,0,'Y', SysDate,100, SysDate,100,'Y' FROM AD_WorkFlow w WHERE AccessLevel IN ('4','7','6') +; + +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Document_Action_Access WHERE AD_Role_ID=50002 +; + +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Document_Action_Access (AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,C_DocType_ID , AD_Ref_List_ID, AD_Role_ID) (SELECT 0,0,'Y', SysDate,100, SysDate,100, doctype.C_DocType_ID, action.AD_Ref_List_ID, rol.AD_Role_ID FROM AD_Client client INNER JOIN C_DocType doctype ON (doctype.AD_Client_ID=client.AD_Client_ID) INNER JOIN AD_Ref_List action ON (action.AD_Reference_ID=135) INNER JOIN AD_Role rol ON (rol.AD_Client_ID=client.AD_Client_ID AND rol.AD_Role_ID=50002) ) +; + +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Window_Access WHERE AD_Role_ID=50001 +; + +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Window_Access (AD_Window_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT w.AD_Window_ID, 50001,0,0,'Y', SysDate,100, SysDate,100,'Y' FROM AD_Window w INNER JOIN AD_Tab t ON (w.AD_Window_ID=t.AD_Window_ID) INNER JOIN AD_Table tt ON (t.AD_Table_ID=tt.AD_Table_ID) WHERE t.SeqNo=(SELECT MIN(SeqNo) FROM AD_Tab xt WHERE xt.AD_Window_ID=w.AD_Window_ID)AND tt.AccessLevel IN ('4','7','6') +; + +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Process_Access WHERE AD_Role_ID=50001 +; + +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Process_Access (AD_Process_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT p.AD_Process_ID, 50001,0,0,'Y', SysDate,100, SysDate,100,'Y' FROM AD_Process p WHERE AccessLevel IN ('4','7','6') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Form_Access WHERE AD_Role_ID=50001 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Form_Access (AD_Form_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT f.AD_Form_ID, 50001,0,0,'Y', SysDate,100, SysDate,100,'Y' FROM AD_Form f WHERE AccessLevel IN ('4','7','6') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_WorkFlow_Access WHERE AD_Role_ID=50001 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_WorkFlow_Access (AD_WorkFlow_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT w.AD_WorkFlow_ID, 50001,0,0,'Y', SysDate,100, SysDate,100,'Y' FROM AD_WorkFlow w WHERE AccessLevel IN ('4','7','6') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Document_Action_Access WHERE AD_Role_ID=50001 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Document_Action_Access (AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,C_DocType_ID , AD_Ref_List_ID, AD_Role_ID) (SELECT 0,0,'Y', SysDate,100, SysDate,100, doctype.C_DocType_ID, action.AD_Ref_List_ID, rol.AD_Role_ID FROM AD_Client client INNER JOIN C_DocType doctype ON (doctype.AD_Client_ID=client.AD_Client_ID) INNER JOIN AD_Ref_List action ON (action.AD_Reference_ID=135) INNER JOIN AD_Role rol ON (rol.AD_Client_ID=client.AD_Client_ID AND rol.AD_Role_ID=50001) ) +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Window_Access WHERE AD_Role_ID=0 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Window_Access (AD_Window_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT w.AD_Window_ID, 0,0,0,'Y', SysDate,0, SysDate,0,'Y' FROM AD_Window w INNER JOIN AD_Tab t ON (w.AD_Window_ID=t.AD_Window_ID) INNER JOIN AD_Table tt ON (t.AD_Table_ID=tt.AD_Table_ID) WHERE t.SeqNo=(SELECT MIN(SeqNo) FROM AD_Tab xt WHERE xt.AD_Window_ID=w.AD_Window_ID)AND tt.AccessLevel IN ('4','7','6') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Process_Access WHERE AD_Role_ID=0 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Process_Access (AD_Process_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT p.AD_Process_ID, 0,0,0,'Y', SysDate,0, SysDate,0,'Y' FROM AD_Process p WHERE AccessLevel IN ('4','7','6') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Form_Access WHERE AD_Role_ID=0 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Form_Access (AD_Form_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT f.AD_Form_ID, 0,0,0,'Y', SysDate,0, SysDate,0,'Y' FROM AD_Form f WHERE AccessLevel IN ('4','7','6') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_WorkFlow_Access WHERE AD_Role_ID=0 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_WorkFlow_Access (AD_WorkFlow_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT w.AD_WorkFlow_ID, 0,0,0,'Y', SysDate,0, SysDate,0,'Y' FROM AD_WorkFlow w WHERE AccessLevel IN ('4','7','6') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Document_Action_Access WHERE AD_Role_ID=0 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Document_Action_Access (AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,C_DocType_ID , AD_Ref_List_ID, AD_Role_ID) (SELECT 0,0,'Y', SysDate,0, SysDate,0, doctype.C_DocType_ID, action.AD_Ref_List_ID, rol.AD_Role_ID FROM AD_Client client INNER JOIN C_DocType doctype ON (doctype.AD_Client_ID=client.AD_Client_ID) INNER JOIN AD_Ref_List action ON (action.AD_Reference_ID=135) INNER JOIN AD_Role rol ON (rol.AD_Client_ID=client.AD_Client_ID AND rol.AD_Role_ID=0) ) +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Window_Access WHERE AD_Role_ID=102 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Window_Access (AD_Window_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT w.AD_Window_ID, 102,11,0,'Y', SysDate,100, SysDate,100,'Y' FROM AD_Window w INNER JOIN AD_Tab t ON (w.AD_Window_ID=t.AD_Window_ID) INNER JOIN AD_Table tt ON (t.AD_Table_ID=tt.AD_Table_ID) WHERE t.SeqNo=(SELECT MIN(SeqNo) FROM AD_Tab xt WHERE xt.AD_Window_ID=w.AD_Window_ID)AND tt.AccessLevel IN ('7','6','3','2','1') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Process_Access WHERE AD_Role_ID=102 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Process_Access (AD_Process_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT p.AD_Process_ID, 102,11,0,'Y', SysDate,100, SysDate,100,'Y' FROM AD_Process p WHERE AccessLevel IN ('7','6','3','2','1') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Form_Access WHERE AD_Role_ID=102 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Form_Access (AD_Form_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT f.AD_Form_ID, 102,11,0,'Y', SysDate,100, SysDate,100,'Y' FROM AD_Form f WHERE AccessLevel IN ('7','6','3','2','1') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_WorkFlow_Access WHERE AD_Role_ID=102 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_WorkFlow_Access (AD_WorkFlow_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT w.AD_WorkFlow_ID, 102,11,0,'Y', SysDate,100, SysDate,100,'Y' FROM AD_WorkFlow w WHERE AccessLevel IN ('7','6','3','2','1') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Document_Action_Access WHERE AD_Role_ID=102 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Document_Action_Access (AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,C_DocType_ID , AD_Ref_List_ID, AD_Role_ID) (SELECT 11,0,'Y', SysDate,100, SysDate,100, doctype.C_DocType_ID, action.AD_Ref_List_ID, rol.AD_Role_ID FROM AD_Client client INNER JOIN C_DocType doctype ON (doctype.AD_Client_ID=client.AD_Client_ID) INNER JOIN AD_Ref_List action ON (action.AD_Reference_ID=135) INNER JOIN AD_Role rol ON (rol.AD_Client_ID=client.AD_Client_ID AND rol.AD_Role_ID=102) ) +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Window_Access WHERE AD_Role_ID=103 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Window_Access (AD_Window_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT w.AD_Window_ID, 103,11,0,'Y', SysDate,100, SysDate,100,'Y' FROM AD_Window w INNER JOIN AD_Tab t ON (w.AD_Window_ID=t.AD_Window_ID) INNER JOIN AD_Table tt ON (t.AD_Table_ID=tt.AD_Table_ID) WHERE t.SeqNo=(SELECT MIN(SeqNo) FROM AD_Tab xt WHERE xt.AD_Window_ID=w.AD_Window_ID)AND tt.AccessLevel IN ('3','1','7') AND w.Name NOT LIKE '%(all)%' +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Process_Access WHERE AD_Role_ID=103 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Process_Access (AD_Process_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT p.AD_Process_ID, 103,11,0,'Y', SysDate,100, SysDate,100,'Y' FROM AD_Process p WHERE AccessLevel IN ('3','1','7') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Form_Access WHERE AD_Role_ID=103 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Form_Access (AD_Form_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT f.AD_Form_ID, 103,11,0,'Y', SysDate,100, SysDate,100,'Y' FROM AD_Form f WHERE AccessLevel IN ('3','1','7') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_WorkFlow_Access WHERE AD_Role_ID=103 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_WorkFlow_Access (AD_WorkFlow_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT w.AD_WorkFlow_ID, 103,11,0,'Y', SysDate,100, SysDate,100,'Y' FROM AD_WorkFlow w WHERE AccessLevel IN ('3','1','7') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Document_Action_Access WHERE AD_Role_ID=103 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Document_Action_Access (AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,C_DocType_ID , AD_Ref_List_ID, AD_Role_ID) (SELECT 11,0,'Y', SysDate,100, SysDate,100, doctype.C_DocType_ID, action.AD_Ref_List_ID, rol.AD_Role_ID FROM AD_Client client INNER JOIN C_DocType doctype ON (doctype.AD_Client_ID=client.AD_Client_ID) INNER JOIN AD_Ref_List action ON (action.AD_Reference_ID=135) INNER JOIN AD_Role rol ON (rol.AD_Client_ID=client.AD_Client_ID AND rol.AD_Role_ID=103) ) +; + +-- Nov 19, 2008 4:49:00 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE AD_Column SET DefaultValue='@#AD_Org_ID@', IsMandatory='Y',Updated=TO_DATE('2008-11-19 16:49:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=51006 +; + +-- Nov 19, 2008 4:57:13 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO PA_DashboardContent (AD_Client_ID,AD_Org_ID,ColumnNo,Created,CreatedBy,Description,IsActive,Line,Name,PA_DashboardContent_ID,Updated,UpdatedBy,ZulFilePath) VALUES (0,0,0,TO_DATE('2008-11-19 16:57:08','YYYY-MM-DD HH24:MI:SS'),100,'Workflow activities, notices and requests','Y',0,'Activities',50000,TO_DATE('2008-11-19 16:57:08','YYYY-MM-DD HH24:MI:SS'),100,'/zul/activities.zul') +; + +-- Nov 19, 2008 4:58:26 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO PA_DashboardContent (AD_Client_ID,AD_Org_ID,ColumnNo,Created,CreatedBy,Description,IsActive,Line,Name,PA_DashboardContent_ID,Updated,UpdatedBy,ZulFilePath) VALUES (0,0,0,TO_DATE('2008-11-19 16:58:24','YYYY-MM-DD HH24:MI:SS'),100,'User favourities','Y',1.000000000000,'Favourites',50001,TO_DATE('2008-11-19 16:58:24','YYYY-MM-DD HH24:MI:SS'),100,'/zul/favourites.zul') +; + +-- Nov 19, 2008 4:58:52 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO PA_DashboardContent (AD_Client_ID,AD_Org_ID,ColumnNo,Created,CreatedBy,Description,IsActive,Line,Name,PA_DashboardContent_ID,Updated,UpdatedBy,ZulFilePath) VALUES (0,0,0,TO_DATE('2008-11-19 16:58:50','YYYY-MM-DD HH24:MI:SS'),100,'Info views','Y',2.000000000000,'Views',50002,TO_DATE('2008-11-19 16:58:50','YYYY-MM-DD HH24:MI:SS'),100,'/zul/views.zul') +; + +-- Nov 19, 2008 5:00:34 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO PA_DashboardContent (AD_Client_ID,AD_Org_ID,ColumnNo,Created,CreatedBy,Description,IsActive,Line,Name,PA_DashboardContent_ID,Updated,UpdatedBy,ZulFilePath) VALUES (0,0,2,TO_DATE('2008-11-19 17:00:26','YYYY-MM-DD HH24:MI:SS'),100,'Performance meters','Y',0,'Performance',50003,TO_DATE('2008-11-19 17:00:26','YYYY-MM-DD HH24:MI:SS'),100,'/zul/performance.zul') +; + +-- Nov 19, 2008 5:02:55 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO PA_DashboardContent (AD_Client_ID,AD_Org_ID,ColumnNo,Created,CreatedBy,Description,IsActive,Line,Name,PA_DashboardContent_ID,Updated,UpdatedBy) VALUES (11,0,1,TO_DATE('2008-11-19 17:02:54','YYYY-MM-DD HH24:MI:SS'),100,'Google Calendar','Y',0,'Calendar',50004,TO_DATE('2008-11-19 17:02:54','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Nov 19, 2008 6:00:00 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE PA_DashboardContent SET UpdatedBy=100, ZulFilePath='/zul/calendar.zul',Updated=TO_DATE('2008-11-19 18:00:00','YYYY-MM-DD HH24:MI:SS') WHERE PA_DashboardContent_ID=50004 +; + +-- Nov 19, 2008 6:00:00 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE PA_DashboardContent SET HTML=null WHERE PA_DashboardContent_ID=50004 +; + +-- Nov 19, 2008 4:28:46 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE AD_Table SET AccessLevel='6',Updated=TO_DATE('2008-11-19 16:28:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=50010 +; + +-- Nov 19, 2008 3:54:09 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,Help,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,53709,0,'ColumnNo',TO_DATE('2008-11-19 15:54:08','YYYY-MM-DD HH24:MI:SS'),100,'Dashboard content column number','D','Dashboard content column number, not used by the swing client at the moment.','Y','Column No','Column No',TO_DATE('2008-11-19 15:54:08','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Nov 19, 2008 3:54:09 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53709 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Nov 19, 2008 3:55:33 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,56469,53709,0,11,50010,'ColumnNo',TO_DATE('2008-11-19 15:55:28','YYYY-MM-DD HH24:MI:SS'),100,'0','Dashboard content column number','D',14,'Dashboard content column number, not used by the swing client at the moment.','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Column No',0,TO_DATE('2008-11-19 15:55:28','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Nov 19, 2008 3:55:33 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=56469 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Nov 19, 2008 3:55:41 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +ALTER TABLE PA_DashboardContent ADD ColumnNo NUMBER(10) DEFAULT 0 +; + +-- Nov 19, 2008 3:59:41 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,Help,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,53710,0,'ZulFilePath',TO_DATE('2008-11-19 15:59:37','YYYY-MM-DD HH24:MI:SS'),100,'Absolute path to zul file','D','Absolute path to zul file that is use to generate dashboard content','Y','ZUL File Path','ZUL File Path',TO_DATE('2008-11-19 15:59:37','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Nov 19, 2008 3:59:41 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53710 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Nov 19, 2008 4:00:37 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,56470,53710,0,10,50010,'ZulFilePath',TO_DATE('2008-11-19 16:00:36','YYYY-MM-DD HH24:MI:SS'),100,'Absolute path to zul file','D',255,'Absolute path to zul file that is use to generate dashboard content','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','ZUL File Path',0,TO_DATE('2008-11-19 16:00:36','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Nov 19, 2008 4:00:37 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=56470 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Nov 19, 2008 4:00:41 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +ALTER TABLE PA_DashboardContent ADD ZulFilePath NVARCHAR2(255) +; + +-- Nov 19, 2008 4:01:04 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,56469,56485,0,50010,TO_DATE('2008-11-19 16:01:03','YYYY-MM-DD HH24:MI:SS'),100,'Dashboard content column number',14,'D','Dashboard content column number, not used by the swing client at the moment.','Y','Y','Y','N','N','N','N','N','Column No',TO_DATE('2008-11-19 16:01:03','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Nov 19, 2008 4:01:05 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=56485 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +-- Nov 19, 2008 4:01:12 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,56470,56486,0,50010,TO_DATE('2008-11-19 16:01:05','YYYY-MM-DD HH24:MI:SS'),100,'Absolute path to zul file',255,'D','Absolute path to zul file that is use to generate dashboard content','Y','Y','Y','N','N','N','N','N','ZUL File Path',TO_DATE('2008-11-19 16:01:05','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Nov 19, 2008 4:01:12 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=56486 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +-- Nov 19, 2008 4:01:25 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE AD_Field SET SeqNo=50,IsDisplayed='Y' WHERE AD_Field_ID=56485 +; + +-- Nov 19, 2008 4:01:25 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE AD_Field SET SeqNo=60,IsDisplayed='Y' WHERE AD_Field_ID=51009 +; + +-- Nov 19, 2008 4:01:25 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE AD_Field SET SeqNo=70,IsDisplayed='Y' WHERE AD_Field_ID=51010 +; + +-- Nov 19, 2008 4:01:25 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=51011 +; + +-- Nov 19, 2008 4:01:25 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=56486 +; + +-- Nov 19, 2008 4:01:26 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=51012 +; + +-- Nov 19, 2008 4:01:26 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=51013 +; + +-- Nov 19, 2008 4:01:54 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE AD_Field SET DisplayLength=255,Updated=TO_DATE('2008-11-19 16:01:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=51011 +; + +-- Nov 19, 2008 4:09:07 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE AD_Column SET DefaultValue='1',Updated=TO_DATE('2008-11-19 16:09:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56469 +; + +-- Nov 19, 2008 4:09:12 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +ALTER TABLE PA_DashboardContent MODIFY ColumnNo NUMBER(10) DEFAULT 1 +; + diff --git a/migration/352a-trunk/postgresql/326_FR2164648Implement_PA_DASHBOARDCONTENT_support.sql b/migration/352a-trunk/postgresql/326_FR2164648Implement_PA_DASHBOARDCONTENT_support.sql new file mode 100644 index 0000000000..05149b4c35 --- /dev/null +++ b/migration/352a-trunk/postgresql/326_FR2164648Implement_PA_DASHBOARDCONTENT_support.sql @@ -0,0 +1,415 @@ +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Window_Access WHERE AD_Role_ID=50002 +; + +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Window_Access (AD_Window_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT w.AD_Window_ID, 50002,0,0,'Y', CURRENT_TIMESTAMP,100, CURRENT_TIMESTAMP,100,'Y' FROM AD_Window w INNER JOIN AD_Tab t ON (w.AD_Window_ID=t.AD_Window_ID) INNER JOIN AD_Table tt ON (t.AD_Table_ID=tt.AD_Table_ID) WHERE t.SeqNo=(SELECT MIN(SeqNo) FROM AD_Tab xt WHERE xt.AD_Window_ID=w.AD_Window_ID)AND tt.AccessLevel IN ('4','7','6') +; + +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Process_Access WHERE AD_Role_ID=50002 +; + +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Process_Access (AD_Process_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT p.AD_Process_ID, 50002,0,0,'Y', CURRENT_TIMESTAMP,100, CURRENT_TIMESTAMP,100,'Y' FROM AD_Process p WHERE AccessLevel IN ('4','7','6') +; + +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Form_Access WHERE AD_Role_ID=50002 +; + +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Form_Access (AD_Form_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT f.AD_Form_ID, 50002,0,0,'Y', CURRENT_TIMESTAMP,100, CURRENT_TIMESTAMP,100,'Y' FROM AD_Form f WHERE AccessLevel IN ('4','7','6') +; + +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_WorkFlow_Access WHERE AD_Role_ID=50002 +; + +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_WorkFlow_Access (AD_WorkFlow_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT w.AD_WorkFlow_ID, 50002,0,0,'Y', CURRENT_TIMESTAMP,100, CURRENT_TIMESTAMP,100,'Y' FROM AD_WorkFlow w WHERE AccessLevel IN ('4','7','6') +; + +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Document_Action_Access WHERE AD_Role_ID=50002 +; + +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Document_Action_Access (AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,C_DocType_ID , AD_Ref_List_ID, AD_Role_ID) (SELECT 0,0,'Y', CURRENT_TIMESTAMP,100, CURRENT_TIMESTAMP,100, doctype.C_DocType_ID, "action".AD_Ref_List_ID, rol.AD_Role_ID FROM AD_Client client INNER JOIN C_DocType doctype ON (doctype.AD_Client_ID=client.AD_Client_ID) INNER JOIN AD_Ref_List "action" ON ("action".AD_Reference_ID=135) INNER JOIN AD_Role rol ON (rol.AD_Client_ID=client.AD_Client_ID AND rol.AD_Role_ID=50002) ) +; + +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Window_Access WHERE AD_Role_ID=50001 +; + +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Window_Access (AD_Window_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT w.AD_Window_ID, 50001,0,0,'Y', CURRENT_TIMESTAMP,100, CURRENT_TIMESTAMP,100,'Y' FROM AD_Window w INNER JOIN AD_Tab t ON (w.AD_Window_ID=t.AD_Window_ID) INNER JOIN AD_Table tt ON (t.AD_Table_ID=tt.AD_Table_ID) WHERE t.SeqNo=(SELECT MIN(SeqNo) FROM AD_Tab xt WHERE xt.AD_Window_ID=w.AD_Window_ID)AND tt.AccessLevel IN ('4','7','6') +; + +-- Nov 19, 2008 4:35:29 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Process_Access WHERE AD_Role_ID=50001 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Process_Access (AD_Process_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT p.AD_Process_ID, 50001,0,0,'Y', CURRENT_TIMESTAMP,100, CURRENT_TIMESTAMP,100,'Y' FROM AD_Process p WHERE AccessLevel IN ('4','7','6') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Form_Access WHERE AD_Role_ID=50001 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Form_Access (AD_Form_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT f.AD_Form_ID, 50001,0,0,'Y', CURRENT_TIMESTAMP,100, CURRENT_TIMESTAMP,100,'Y' FROM AD_Form f WHERE AccessLevel IN ('4','7','6') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_WorkFlow_Access WHERE AD_Role_ID=50001 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_WorkFlow_Access (AD_WorkFlow_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT w.AD_WorkFlow_ID, 50001,0,0,'Y', CURRENT_TIMESTAMP,100, CURRENT_TIMESTAMP,100,'Y' FROM AD_WorkFlow w WHERE AccessLevel IN ('4','7','6') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Document_Action_Access WHERE AD_Role_ID=50001 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Document_Action_Access (AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,C_DocType_ID , AD_Ref_List_ID, AD_Role_ID) (SELECT 0,0,'Y', CURRENT_TIMESTAMP,100, CURRENT_TIMESTAMP,100, doctype.C_DocType_ID, "action".AD_Ref_List_ID, rol.AD_Role_ID FROM AD_Client client INNER JOIN C_DocType doctype ON (doctype.AD_Client_ID=client.AD_Client_ID) INNER JOIN AD_Ref_List "action" ON ("action".AD_Reference_ID=135) INNER JOIN AD_Role rol ON (rol.AD_Client_ID=client.AD_Client_ID AND rol.AD_Role_ID=50001) ) +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Window_Access WHERE AD_Role_ID=0 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Window_Access (AD_Window_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT w.AD_Window_ID, 0,0,0,'Y', CURRENT_TIMESTAMP,0, CURRENT_TIMESTAMP,0,'Y' FROM AD_Window w INNER JOIN AD_Tab t ON (w.AD_Window_ID=t.AD_Window_ID) INNER JOIN AD_Table tt ON (t.AD_Table_ID=tt.AD_Table_ID) WHERE t.SeqNo=(SELECT MIN(SeqNo) FROM AD_Tab xt WHERE xt.AD_Window_ID=w.AD_Window_ID)AND tt.AccessLevel IN ('4','7','6') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Process_Access WHERE AD_Role_ID=0 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Process_Access (AD_Process_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT p.AD_Process_ID, 0,0,0,'Y', CURRENT_TIMESTAMP,0, CURRENT_TIMESTAMP,0,'Y' FROM AD_Process p WHERE AccessLevel IN ('4','7','6') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Form_Access WHERE AD_Role_ID=0 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Form_Access (AD_Form_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT f.AD_Form_ID, 0,0,0,'Y', CURRENT_TIMESTAMP,0, CURRENT_TIMESTAMP,0,'Y' FROM AD_Form f WHERE AccessLevel IN ('4','7','6') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_WorkFlow_Access WHERE AD_Role_ID=0 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_WorkFlow_Access (AD_WorkFlow_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT w.AD_WorkFlow_ID, 0,0,0,'Y', CURRENT_TIMESTAMP,0, CURRENT_TIMESTAMP,0,'Y' FROM AD_WorkFlow w WHERE AccessLevel IN ('4','7','6') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Document_Action_Access WHERE AD_Role_ID=0 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Document_Action_Access (AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,C_DocType_ID , AD_Ref_List_ID, AD_Role_ID) (SELECT 0,0,'Y', CURRENT_TIMESTAMP,0, CURRENT_TIMESTAMP,0, doctype.C_DocType_ID, "action".AD_Ref_List_ID, rol.AD_Role_ID FROM AD_Client client INNER JOIN C_DocType doctype ON (doctype.AD_Client_ID=client.AD_Client_ID) INNER JOIN AD_Ref_List "action" ON ("action".AD_Reference_ID=135) INNER JOIN AD_Role rol ON (rol.AD_Client_ID=client.AD_Client_ID AND rol.AD_Role_ID=0) ) +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Window_Access WHERE AD_Role_ID=102 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Window_Access (AD_Window_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT w.AD_Window_ID, 102,11,0,'Y', CURRENT_TIMESTAMP,100, CURRENT_TIMESTAMP,100,'Y' FROM AD_Window w INNER JOIN AD_Tab t ON (w.AD_Window_ID=t.AD_Window_ID) INNER JOIN AD_Table tt ON (t.AD_Table_ID=tt.AD_Table_ID) WHERE t.SeqNo=(SELECT MIN(SeqNo) FROM AD_Tab xt WHERE xt.AD_Window_ID=w.AD_Window_ID)AND tt.AccessLevel IN ('7','6','3','2','1') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Process_Access WHERE AD_Role_ID=102 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Process_Access (AD_Process_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT p.AD_Process_ID, 102,11,0,'Y', CURRENT_TIMESTAMP,100, CURRENT_TIMESTAMP,100,'Y' FROM AD_Process p WHERE AccessLevel IN ('7','6','3','2','1') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Form_Access WHERE AD_Role_ID=102 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Form_Access (AD_Form_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT f.AD_Form_ID, 102,11,0,'Y', CURRENT_TIMESTAMP,100, CURRENT_TIMESTAMP,100,'Y' FROM AD_Form f WHERE AccessLevel IN ('7','6','3','2','1') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_WorkFlow_Access WHERE AD_Role_ID=102 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_WorkFlow_Access (AD_WorkFlow_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT w.AD_WorkFlow_ID, 102,11,0,'Y', CURRENT_TIMESTAMP,100, CURRENT_TIMESTAMP,100,'Y' FROM AD_WorkFlow w WHERE AccessLevel IN ('7','6','3','2','1') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Document_Action_Access WHERE AD_Role_ID=102 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Document_Action_Access (AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,C_DocType_ID , AD_Ref_List_ID, AD_Role_ID) (SELECT 11,0,'Y', CURRENT_TIMESTAMP,100, CURRENT_TIMESTAMP,100, doctype.C_DocType_ID, "action".AD_Ref_List_ID, rol.AD_Role_ID FROM AD_Client client INNER JOIN C_DocType doctype ON (doctype.AD_Client_ID=client.AD_Client_ID) INNER JOIN AD_Ref_List "action" ON ("action".AD_Reference_ID=135) INNER JOIN AD_Role rol ON (rol.AD_Client_ID=client.AD_Client_ID AND rol.AD_Role_ID=102) ) +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Window_Access WHERE AD_Role_ID=103 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Window_Access (AD_Window_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT w.AD_Window_ID, 103,11,0,'Y', CURRENT_TIMESTAMP,100, CURRENT_TIMESTAMP,100,'Y' FROM AD_Window w INNER JOIN AD_Tab t ON (w.AD_Window_ID=t.AD_Window_ID) INNER JOIN AD_Table tt ON (t.AD_Table_ID=tt.AD_Table_ID) WHERE t.SeqNo=(SELECT MIN(SeqNo) FROM AD_Tab xt WHERE xt.AD_Window_ID=w.AD_Window_ID)AND tt.AccessLevel IN ('3','1','7') AND w.Name NOT LIKE '%(all)%' +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Process_Access WHERE AD_Role_ID=103 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Process_Access (AD_Process_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT p.AD_Process_ID, 103,11,0,'Y', CURRENT_TIMESTAMP,100, CURRENT_TIMESTAMP,100,'Y' FROM AD_Process p WHERE AccessLevel IN ('3','1','7') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Form_Access WHERE AD_Role_ID=103 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Form_Access (AD_Form_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT f.AD_Form_ID, 103,11,0,'Y', CURRENT_TIMESTAMP,100, CURRENT_TIMESTAMP,100,'Y' FROM AD_Form f WHERE AccessLevel IN ('3','1','7') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_WorkFlow_Access WHERE AD_Role_ID=103 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_WorkFlow_Access (AD_WorkFlow_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT w.AD_WorkFlow_ID, 103,11,0,'Y', CURRENT_TIMESTAMP,100, CURRENT_TIMESTAMP,100,'Y' FROM AD_WorkFlow w WHERE AccessLevel IN ('3','1','7') +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +DELETE FROM AD_Document_Action_Access WHERE AD_Role_ID=103 +; + +-- Nov 19, 2008 4:35:30 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Document_Action_Access (AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,C_DocType_ID , AD_Ref_List_ID, AD_Role_ID) (SELECT 11,0,'Y', CURRENT_TIMESTAMP,100, CURRENT_TIMESTAMP,100, doctype.C_DocType_ID, "action".AD_Ref_List_ID, rol.AD_Role_ID FROM AD_Client client INNER JOIN C_DocType doctype ON (doctype.AD_Client_ID=client.AD_Client_ID) INNER JOIN AD_Ref_List "action" ON ("action".AD_Reference_ID=135) INNER JOIN AD_Role rol ON (rol.AD_Client_ID=client.AD_Client_ID AND rol.AD_Role_ID=103) ) +; + +-- Nov 19, 2008 4:49:00 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE AD_Column SET DefaultValue='@#AD_Org_ID@', IsMandatory='Y',Updated=TO_TIMESTAMP('2008-11-19 16:49:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=51006 +; + +-- Nov 19, 2008 4:57:13 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO PA_DashboardContent (AD_Client_ID,AD_Org_ID,ColumnNo,Created,CreatedBy,Description,IsActive,Line,Name,PA_DashboardContent_ID,Updated,UpdatedBy,ZulFilePath) VALUES (0,0,0,TO_TIMESTAMP('2008-11-19 16:57:08','YYYY-MM-DD HH24:MI:SS'),100,'Workflow activities, notices and requests','Y',0,'Activities',50000,TO_TIMESTAMP('2008-11-19 16:57:08','YYYY-MM-DD HH24:MI:SS'),100,'/zul/activities.zul') +; + +-- Nov 19, 2008 4:58:26 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO PA_DashboardContent (AD_Client_ID,AD_Org_ID,ColumnNo,Created,CreatedBy,Description,IsActive,Line,Name,PA_DashboardContent_ID,Updated,UpdatedBy,ZulFilePath) VALUES (0,0,0,TO_TIMESTAMP('2008-11-19 16:58:24','YYYY-MM-DD HH24:MI:SS'),100,'User favourities','Y',1.000000000000,'Favourites',50001,TO_TIMESTAMP('2008-11-19 16:58:24','YYYY-MM-DD HH24:MI:SS'),100,'/zul/favourites.zul') +; + +-- Nov 19, 2008 4:58:52 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO PA_DashboardContent (AD_Client_ID,AD_Org_ID,ColumnNo,Created,CreatedBy,Description,IsActive,Line,Name,PA_DashboardContent_ID,Updated,UpdatedBy,ZulFilePath) VALUES (0,0,0,TO_TIMESTAMP('2008-11-19 16:58:50','YYYY-MM-DD HH24:MI:SS'),100,'Info views','Y',2.000000000000,'Views',50002,TO_TIMESTAMP('2008-11-19 16:58:50','YYYY-MM-DD HH24:MI:SS'),100,'/zul/views.zul') +; + +-- Nov 19, 2008 5:00:34 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO PA_DashboardContent (AD_Client_ID,AD_Org_ID,ColumnNo,Created,CreatedBy,Description,IsActive,Line,Name,PA_DashboardContent_ID,Updated,UpdatedBy,ZulFilePath) VALUES (0,0,2,TO_TIMESTAMP('2008-11-19 17:00:26','YYYY-MM-DD HH24:MI:SS'),100,'Performance meters','Y',0,'Performance',50003,TO_TIMESTAMP('2008-11-19 17:00:26','YYYY-MM-DD HH24:MI:SS'),100,'/zul/performance.zul') +; + +-- Nov 19, 2008 5:02:55 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO PA_DashboardContent (AD_Client_ID,AD_Org_ID,ColumnNo,Created,CreatedBy,Description,IsActive,Line,Name,PA_DashboardContent_ID,Updated,UpdatedBy) VALUES (11,0,1,TO_TIMESTAMP('2008-11-19 17:02:54','YYYY-MM-DD HH24:MI:SS'),100,'Google Calendar','Y',0,'Calendar',50004,TO_TIMESTAMP('2008-11-19 17:02:54','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Nov 19, 2008 6:00:00 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE PA_DashboardContent SET UpdatedBy=100, ZulFilePath='/zul/calendar.zul',Updated=TO_TIMESTAMP('2008-11-19 18:00:00','YYYY-MM-DD HH24:MI:SS') WHERE PA_DashboardContent_ID=50004 +; + +-- Nov 19, 2008 6:00:00 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE PA_DashboardContent SET HTML=null WHERE PA_DashboardContent_ID=50004 +; + +-- Nov 19, 2008 4:28:46 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE AD_Table SET AccessLevel='6',Updated=TO_TIMESTAMP('2008-11-19 16:28:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=50010 +; + +-- Nov 19, 2008 3:54:09 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,Help,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,53709,0,'ColumnNo',TO_TIMESTAMP('2008-11-19 15:54:08','YYYY-MM-DD HH24:MI:SS'),100,'Dashboard content column number','D','Dashboard content column number, not used by the swing client at the moment.','Y','Column No','Column No',TO_TIMESTAMP('2008-11-19 15:54:08','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Nov 19, 2008 3:54:09 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53709 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Nov 19, 2008 3:55:33 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,56469,53709,0,11,50010,'ColumnNo',TO_TIMESTAMP('2008-11-19 15:55:28','YYYY-MM-DD HH24:MI:SS'),100,'0','Dashboard content column number','D',14,'Dashboard content column number, not used by the swing client at the moment.','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Column No',0,TO_TIMESTAMP('2008-11-19 15:55:28','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Nov 19, 2008 3:55:33 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=56469 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Nov 19, 2008 3:55:41 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +ALTER TABLE PA_DashboardContent ADD COLUMN ColumnNo NUMERIC(10) DEFAULT '0' +; + +-- Nov 19, 2008 3:59:41 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,Help,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,53710,0,'ZulFilePath',TO_TIMESTAMP('2008-11-19 15:59:37','YYYY-MM-DD HH24:MI:SS'),100,'Absolute path to zul file','D','Absolute path to zul file that is use to generate dashboard content','Y','ZUL File Path','ZUL File Path',TO_TIMESTAMP('2008-11-19 15:59:37','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Nov 19, 2008 3:59:41 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53710 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Nov 19, 2008 4:00:37 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,56470,53710,0,10,50010,'ZulFilePath',TO_TIMESTAMP('2008-11-19 16:00:36','YYYY-MM-DD HH24:MI:SS'),100,'Absolute path to zul file','D',255,'Absolute path to zul file that is use to generate dashboard content','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','ZUL File Path',0,TO_TIMESTAMP('2008-11-19 16:00:36','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Nov 19, 2008 4:00:37 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=56470 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Nov 19, 2008 4:00:41 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +ALTER TABLE PA_DashboardContent ADD COLUMN ZulFilePath VARCHAR(255) +; + +-- Nov 19, 2008 4:01:04 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,56469,56485,0,50010,TO_TIMESTAMP('2008-11-19 16:01:03','YYYY-MM-DD HH24:MI:SS'),100,'Dashboard content column number',14,'D','Dashboard content column number, not used by the swing client at the moment.','Y','Y','Y','N','N','N','N','N','Column No',TO_TIMESTAMP('2008-11-19 16:01:03','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Nov 19, 2008 4:01:05 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=56485 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +-- Nov 19, 2008 4:01:12 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,56470,56486,0,50010,TO_TIMESTAMP('2008-11-19 16:01:05','YYYY-MM-DD HH24:MI:SS'),100,'Absolute path to zul file',255,'D','Absolute path to zul file that is use to generate dashboard content','Y','Y','Y','N','N','N','N','N','ZUL File Path',TO_TIMESTAMP('2008-11-19 16:01:05','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Nov 19, 2008 4:01:12 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=56486 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +-- Nov 19, 2008 4:01:25 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE AD_Field SET SeqNo=50,IsDisplayed='Y' WHERE AD_Field_ID=56485 +; + +-- Nov 19, 2008 4:01:25 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE AD_Field SET SeqNo=60,IsDisplayed='Y' WHERE AD_Field_ID=51009 +; + +-- Nov 19, 2008 4:01:25 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE AD_Field SET SeqNo=70,IsDisplayed='Y' WHERE AD_Field_ID=51010 +; + +-- Nov 19, 2008 4:01:25 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=51011 +; + +-- Nov 19, 2008 4:01:25 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=56486 +; + +-- Nov 19, 2008 4:01:26 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=51012 +; + +-- Nov 19, 2008 4:01:26 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=51013 +; + +-- Nov 19, 2008 4:01:54 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE AD_Field SET DisplayLength=255,Updated=TO_TIMESTAMP('2008-11-19 16:01:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=51011 +; + +-- Nov 19, 2008 4:09:07 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +UPDATE AD_Column SET DefaultValue='1',Updated=TO_TIMESTAMP('2008-11-19 16:09:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56469 +; + +-- Nov 19, 2008 4:09:12 PM SGT +-- [ 2164648 ] FR:Implement PA_DASHBOARDCONTENT support +insert into t_alter_column values('pa_dashboardcontent','ColumnNo','NUMERIC(10)',null,'1') +; + diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/DPActivities.java b/zkwebui/WEB-INF/src/org/adempiere/webui/DPActivities.java new file mode 100644 index 0000000000..ba2a1d430f --- /dev/null +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/DPActivities.java @@ -0,0 +1,199 @@ +/****************************************************************************** + * Copyright (C) 2008 Elaine Tan * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.webui; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.logging.Level; + +import org.adempiere.webui.component.Button; +import org.adempiere.webui.session.SessionManager; +import org.compiere.model.MRole; +import org.compiere.util.CLogger; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zk.ui.event.Events; +import org.zkoss.zul.Box; +import org.zkoss.zul.Vbox; + +/** + * Dashboard item: Workflow activities, notices and requests + * @author Elaine + * @date November 20, 2008 + */ +public class DPActivities extends DashboardPanel implements EventListener { + + private static final long serialVersionUID = 1L; + + private static final CLogger logger = CLogger.getCLogger(DPActivities.class); + + private Button btnNotice, btnRequest, btnWorkflow; + + public DPActivities() + { + super(); + this.appendChild(createActivitiesPanel()); + } + + private Box createActivitiesPanel() + { + Vbox vbox = new Vbox(); + + btnNotice = new Button(); + vbox.appendChild(btnNotice); + btnNotice.setLabel("Notice : 0"); + btnNotice.setTooltiptext("Notice"); + btnNotice.setImage("/images/GetMail16.png"); + int AD_Menu_ID = DB.getSQLValue(null, "SELECT AD_Menu_ID FROM AD_Menu WHERE Name = 'Notice' AND IsSummary = 'N'"); + btnNotice.setName(String.valueOf(AD_Menu_ID)); + btnNotice.addEventListener(Events.ON_CLICK, this); + + btnRequest = new Button(); + vbox.appendChild(btnRequest); + btnRequest.setLabel("Request : 0"); + btnRequest.setTooltiptext("Request"); + btnRequest.setImage("/images/Request16.png"); + AD_Menu_ID = DB.getSQLValue(null, "SELECT AD_Menu_ID FROM AD_Menu WHERE Name = 'Request' AND IsSummary = 'N'"); + btnRequest.setName(String.valueOf(AD_Menu_ID)); + btnRequest.addEventListener(Events.ON_CLICK, this); + + btnWorkflow = new Button(); + vbox.appendChild(btnWorkflow); + btnWorkflow.setLabel("Workflow Activities : 0"); + btnWorkflow.setTooltiptext("Workflow Activities"); + btnWorkflow.setImage("/images/Assignment16.png"); + AD_Menu_ID = DB.getSQLValue(null, "SELECT AD_Menu_ID FROM AD_Menu WHERE Name = 'Workflow Activities' AND IsSummary = 'N'"); + btnWorkflow.setName(String.valueOf(AD_Menu_ID)); + btnWorkflow.addEventListener(Events.ON_CLICK, this); + + return vbox; + } + + /** + * Get notice count + * @return number of notice + */ + public static int getNoticeCount() + { + String sql = "SELECT COUNT(1) FROM AD_Note " + + "WHERE AD_Client_ID=? AND AD_User_ID IN (0,?)" + + " AND Processed='N'"; + int retValue = DB.getSQLValue(null, sql, Env.getAD_Client_ID(Env.getCtx()), Env.getAD_User_ID(Env.getCtx())); + return retValue; + } + + /** + * Get request count + * @return number of request + */ + public static int getRequestCount() + { + String sql = MRole.getDefault().addAccessSQL ("SELECT COUNT(1) FROM R_Request " + + "WHERE (SalesRep_ID=? OR AD_Role_ID=?) AND Processed='N'" + + " AND (DateNextAction IS NULL OR TRUNC(DateNextAction) <= TRUNC(SysDate))" + + " AND (R_Status_ID IS NULL OR R_Status_ID IN (SELECT R_Status_ID FROM R_Status WHERE IsClosed='N'))", + "R_Request", false, true); // not qualified - RW + int retValue = DB.getSQLValue(null, sql, Env.getAD_User_ID(Env.getCtx()), Env.getAD_Role_ID(Env.getCtx())); + return retValue; + } + + /** + * Get workflow activity count + * @return number of workflow activity + */ + public static int getWorkflowCount() + { + int count = 0; + + String sql = "SELECT count(*) FROM AD_WF_Activity a " + + "WHERE a.Processed='N' AND a.WFState='OS' AND (" + // Owner of Activity + + " a.AD_User_ID=?" // #1 + // Invoker (if no invoker = all) + + " OR EXISTS (SELECT * FROM AD_WF_Responsible r WHERE a.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID" + + " AND COALESCE(r.AD_User_ID,0)=0 AND COALESCE(r.AD_Role_ID,0)=0 AND (a.AD_User_ID=? OR a.AD_User_ID IS NULL))" // #2 + // Responsible User + + " OR EXISTS (SELECT * FROM AD_WF_Responsible r WHERE a.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID" + + " AND r.AD_User_ID=?)" // #3 + // Responsible Role + + " OR EXISTS (SELECT * FROM AD_WF_Responsible r INNER JOIN AD_User_Roles ur ON (r.AD_Role_ID=ur.AD_Role_ID)" + + " WHERE a.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID AND ur.AD_User_ID=?))"; // #4 + // + //+ ") ORDER BY a.Priority DESC, Created"; + int AD_User_ID = Env.getAD_User_ID(Env.getCtx()); + PreparedStatement pstmt = null; + ResultSet rs = null; + try + { + pstmt = DB.prepareStatement (sql, null); + pstmt.setInt (1, AD_User_ID); + pstmt.setInt (2, AD_User_ID); + pstmt.setInt (3, AD_User_ID); + pstmt.setInt (4, AD_User_ID); + rs = pstmt.executeQuery (); + if (rs.next ()) { + count = rs.getInt(1); + } + } + catch (Exception e) + { + logger.log(Level.SEVERE, sql, e); + } + finally + { + DB.close(rs, pstmt); + rs = null; pstmt = null; + } + + return count; + } + + public void updateInfo() + { + int noOfNotice = getNoticeCount(); + int noOfRequest = getRequestCount(); + int noOfWorkflow = getWorkflowCount(); + + btnNotice.setLabel("Notice : " + noOfNotice); + btnRequest.setLabel("Request : " + noOfRequest); + btnWorkflow.setLabel("Workflow Activities : " + noOfWorkflow); + } + + public void onEvent(Event event) + { + Component comp = event.getTarget(); + String eventName = event.getName(); + + if(eventName.equals(Events.ON_CLICK)) + { + if(comp instanceof Button) + { + Button btn = (Button) comp; + + int menuId = 0; + try + { + menuId = Integer.valueOf(btn.getName()); + } + catch (Exception e) { + + } + + if(menuId > 0) SessionManager.getAppDesktop().onMenuSelected(menuId); + } + } + } +} diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/DPCalendar.java b/zkwebui/WEB-INF/src/org/adempiere/webui/DPCalendar.java new file mode 100644 index 0000000000..0e17bfd953 --- /dev/null +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/DPCalendar.java @@ -0,0 +1,35 @@ +/****************************************************************************** + * Copyright (C) 2008 Elaine Tan * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.webui; + +import org.zkoss.zul.Iframe; + +/** + * Dashboard item: Google calendar + * @author Elaine + * @date November 20, 2008 + */ +public class DPCalendar extends DashboardPanel { + + private static final long serialVersionUID = 1L; + + public DPCalendar() + { + super(); + + Iframe iframe = new Iframe("http://www.google.com/calendar/embed?showTitle=0&showTabs=0&height=300&wkst=1&bgcolor=%23FFFFFF&color=%232952A3"); + iframe.setWidth("300px"); + iframe.setHeight("310px"); + this.appendChild(iframe); + } +} diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/DPFavourites.java b/zkwebui/WEB-INF/src/org/adempiere/webui/DPFavourites.java new file mode 100644 index 0000000000..6595279bc8 --- /dev/null +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/DPFavourites.java @@ -0,0 +1,231 @@ +/****************************************************************************** + * Copyright (C) 2008 Elaine Tan * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.webui; + +import java.util.Enumeration; + +import org.adempiere.webui.component.ToolBarButton; +import org.adempiere.webui.session.SessionManager; +import org.compiere.model.MTree; +import org.compiere.model.MTreeNode; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.event.DropEvent; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zk.ui.event.Events; +import org.zkoss.zul.Box; +import org.zkoss.zul.Image; +import org.zkoss.zul.Label; +import org.zkoss.zul.Panel; +import org.zkoss.zul.Panelchildren; +import org.zkoss.zul.Toolbar; +import org.zkoss.zul.Treeitem; +import org.zkoss.zul.Treerow; +import org.zkoss.zul.Vbox; + +/** + * Dashboard item: User favourites + * @author Elaine + * @date November 20, 2008 + */ +public class DPFavourites extends DashboardPanel implements EventListener { + + private static final long serialVersionUID = 1L; + + private Box bxFav; + + private Label lblMsg; + + private int m_AD_Tree_ID; + + public DPFavourites() + { + super(); + + Panel panel = new Panel(); + this.appendChild(panel); + + Panelchildren favContent = new Panelchildren(); + panel.appendChild(favContent); + favContent.appendChild(createFavouritesPanel()); + + Toolbar favToolbar = new Toolbar(); + this.appendChild(favToolbar); + + // Elaine 2008/07/24 + Image img = new Image("/images/Delete24.png"); + favToolbar.appendChild(img); + img.setAlign("right"); + img.setDroppable("deleteFav"); + img.addEventListener(Events.ON_DROP, this); + // + + favContent.setDroppable("favourite"); + favContent.addEventListener(Events.ON_DROP, this); + } + + private Box createFavouritesPanel() + { + bxFav = new Vbox(); + + int AD_Role_ID = Env.getAD_Role_ID(Env.getCtx()); + int AD_Tree_ID = DB.getSQLValue(null, + "SELECT COALESCE(r.AD_Tree_Menu_ID, ci.AD_Tree_Menu_ID)" + + "FROM AD_ClientInfo ci" + + " INNER JOIN AD_Role r ON (ci.AD_Client_ID=r.AD_Client_ID) " + + "WHERE AD_Role_ID=?", AD_Role_ID); + if (AD_Tree_ID <= 0) + AD_Tree_ID = 10; // Menu + + m_AD_Tree_ID = AD_Tree_ID; + + MTree vTree = new MTree(Env.getCtx(), AD_Tree_ID, false, true, null); + MTreeNode m_root = vTree.getRoot(); + Enumeration enTop = m_root.children(); + while(enTop.hasMoreElements()) + { + MTreeNode ndTop = (MTreeNode)enTop.nextElement(); + Enumeration en = ndTop.preorderEnumeration(); + while (en.hasMoreElements()) + { + MTreeNode nd = (MTreeNode)en.nextElement(); + if (nd.isOnBar()) { + String label = nd.toString().trim(); + ToolBarButton btnFavItem = new ToolBarButton(String.valueOf(nd.getNode_ID())); + btnFavItem.setLabel(label); + btnFavItem.setDraggable("deleteFav"); + btnFavItem.addEventListener(Events.ON_CLICK, this); + btnFavItem.addEventListener(Events.ON_DROP, this); + bxFav.appendChild(btnFavItem); + } + } + } + + lblMsg = new Label("(Drag and drop menu item here)"); + if(bxFav.getChildren().isEmpty()) bxFav.appendChild(lblMsg); + + return bxFav; + } + + /** + * Make Bar add/remove persistent + * @param add true if add - otherwise remove + * @param Node_ID Node ID + * @return true if updated + */ + private boolean barDBupdate(boolean add, int Node_ID) + { + int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx()); + int AD_Org_ID = Env.getContextAsInt(Env.getCtx(), "#AD_Org_ID"); + int AD_User_ID = Env.getContextAsInt(Env.getCtx(), "#AD_User_ID"); + StringBuffer sql = new StringBuffer(); + if (add) + sql.append("INSERT INTO AD_TreeBar " + + "(AD_Tree_ID,AD_User_ID,Node_ID, " + + "AD_Client_ID,AD_Org_ID, " + + "IsActive,Created,CreatedBy,Updated,UpdatedBy)VALUES (") + .append(m_AD_Tree_ID).append(",").append(AD_User_ID).append(",").append(Node_ID).append(",") + .append(AD_Client_ID).append(",").append(AD_Org_ID).append(",") + .append("'Y',SysDate,").append(AD_User_ID).append(",SysDate,").append(AD_User_ID).append(")"); + // if already exist, will result in ORA-00001: unique constraint (ADEMPIERE.AD_TREEBAR_KEY) + else + sql.append("DELETE AD_TreeBar WHERE AD_Tree_ID=").append(m_AD_Tree_ID) + .append(" AND AD_User_ID=").append(AD_User_ID) + .append(" AND Node_ID=").append(Node_ID); + int no = DB.executeUpdate(sql.toString(), false, null); + return no == 1; + } + + public void onEvent(Event event) + { + Component comp = event.getTarget(); + String eventName = event.getName(); + + if(eventName.equals(Events.ON_CLICK)) + { + if(comp instanceof ToolBarButton) + { + ToolBarButton btn = (ToolBarButton) comp; + + int menuId = 0; + try + { + menuId = Integer.valueOf(btn.getName()); + } + catch (Exception e) { + + } + + if(menuId > 0) SessionManager.getAppDesktop().onMenuSelected(menuId); + } + } + // Elaine 2008/07/24 + else if(eventName.equals(Events.ON_DROP)) + { + DropEvent de = (DropEvent) event; + Component dragged = de.getDragged(); + + if(comp instanceof Panelchildren) + { + if(dragged instanceof Treerow) + { + Treerow treerow = (Treerow) dragged; + Treeitem treeitem = (Treeitem) treerow.getParent(); + + Object value = treeitem.getValue(); + if(value != null) + { + int Node_ID = Integer.valueOf(value.toString()); + if(barDBupdate(true, Node_ID)) + { + String label = treeitem.getLabel().trim(); + ToolBarButton btnFavItem = new ToolBarButton(String.valueOf(Node_ID)); + btnFavItem.setLabel(label); + btnFavItem.setDraggable("deleteFav"); + btnFavItem.addEventListener(Events.ON_CLICK, this); + btnFavItem.addEventListener(Events.ON_DROP, this); + bxFav.appendChild(btnFavItem); + bxFav.removeChild(lblMsg); + bxFav.invalidate(); + } + } + } + } + else if(comp instanceof Image) + { + if(dragged instanceof ToolBarButton) + { + ToolBarButton btn = (ToolBarButton) dragged; + String value = btn.getName(); + + if(value != null) + { + int Node_ID = Integer.valueOf(value.toString()); + if(barDBupdate(false, Node_ID)) + { + bxFav.removeChild(btn); + + if(bxFav.getChildren().isEmpty()) + bxFav.appendChild(lblMsg); + + bxFav.invalidate(); + } + } + } + } + } + // + } +} diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/DPPerformance.java b/zkwebui/WEB-INF/src/org/adempiere/webui/DPPerformance.java new file mode 100644 index 0000000000..fa98c023d0 --- /dev/null +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/DPPerformance.java @@ -0,0 +1,33 @@ +/****************************************************************************** + * Copyright (C) 2008 Elaine Tan * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.webui; + +import org.adempiere.webui.apps.graph.WPAPanel; + +/** + * Dashboard item: Performance Indicators + * @author Elaine + * @date November 20, 2008 + */ +public class DPPerformance extends DashboardPanel { + + private static final long serialVersionUID = 1L; + + public DPPerformance() + { + super(); + + WPAPanel paPanel = WPAPanel.get(); + if (paPanel != null) this.appendChild(paPanel); + } +} diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/DPViews.java b/zkwebui/WEB-INF/src/org/adempiere/webui/DPViews.java new file mode 100644 index 0000000000..8d9a9a6de8 --- /dev/null +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/DPViews.java @@ -0,0 +1,193 @@ +/****************************************************************************** + * Copyright (C) 2008 Elaine Tan * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.webui; + +import org.adempiere.webui.apps.AEnv; +import org.adempiere.webui.component.ToolBarButton; +import org.adempiere.webui.panel.InfoPanel; +import org.adempiere.webui.window.InfoSchedule; +import org.compiere.model.MRole; +import org.compiere.util.Env; +import org.compiere.util.Msg; +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zk.ui.event.Events; +import org.zkoss.zul.Box; +import org.zkoss.zul.Separator; +import org.zkoss.zul.Vbox; + +/** + * Dashboard item: Info views + * @author Elaine + * @date November 20, 2008 + */ +public class DPViews extends DashboardPanel implements EventListener { + + private static final long serialVersionUID = 1L; + + public DPViews() + { + super(); + this.appendChild(createViewPanel()); + } + + private Box createViewPanel() + { + Vbox vbox = new Vbox(); + + if (MRole.getDefault().isAllow_Info_Product()) + { + ToolBarButton btnViewItem = new ToolBarButton("InfoProduct"); + btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoProduct")); + btnViewItem.addEventListener(Events.ON_CLICK, this); + vbox.appendChild(btnViewItem); + } + if (MRole.getDefault().isAllow_Info_BPartner()) + { + ToolBarButton btnViewItem = new ToolBarButton("InfoBPartner"); + btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoBPartner")); + btnViewItem.addEventListener(Events.ON_CLICK, this); + vbox.appendChild(btnViewItem); + } + if (MRole.getDefault().isShowAcct() && MRole.getDefault().isAllow_Info_Account()) + { + ToolBarButton btnViewItem = new ToolBarButton("InfoAccount"); + btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoAccount")); + btnViewItem.addEventListener(Events.ON_CLICK, this); + vbox.appendChild(btnViewItem); + } + if (MRole.getDefault().isAllow_Info_Schedule()) + { + ToolBarButton btnViewItem = new ToolBarButton("InfoSchedule"); + btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoSchedule")); + btnViewItem.addEventListener(Events.ON_CLICK, this); + vbox.appendChild(btnViewItem); + } + vbox.appendChild(new Separator("horizontal")); + if (MRole.getDefault().isAllow_Info_Order()) + { + ToolBarButton btnViewItem = new ToolBarButton("InfoOrder"); + btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoOrder")); + btnViewItem.addEventListener(Events.ON_CLICK, this); + vbox.appendChild(btnViewItem); + } + if (MRole.getDefault().isAllow_Info_Invoice()) + { + ToolBarButton btnViewItem = new ToolBarButton("InfoInvoice"); + btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoInvoice")); + btnViewItem.addEventListener(Events.ON_CLICK, this); + vbox.appendChild(btnViewItem); + } + if (MRole.getDefault().isAllow_Info_InOut()) + { + ToolBarButton btnViewItem = new ToolBarButton("InfoInOut"); + btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoInOut")); + btnViewItem.addEventListener(Events.ON_CLICK, this); + vbox.appendChild(btnViewItem); + } + if (MRole.getDefault().isAllow_Info_Payment()) + { + ToolBarButton btnViewItem = new ToolBarButton("InfoPayment"); + btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoPayment")); + btnViewItem.addEventListener(Events.ON_CLICK, this); + vbox.appendChild(btnViewItem); + } + if (MRole.getDefault().isAllow_Info_CashJournal()) + { + ToolBarButton btnViewItem = new ToolBarButton("InfoCashLine"); + btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoCashLine")); + btnViewItem.addEventListener(Events.ON_CLICK, this); + vbox.appendChild(btnViewItem); + } + if (MRole.getDefault().isAllow_Info_Resource()) + { + ToolBarButton btnViewItem = new ToolBarButton("InfoAssignment"); + btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoAssignment")); + btnViewItem.addEventListener(Events.ON_CLICK, this); + vbox.appendChild(btnViewItem); + } + if (MRole.getDefault().isAllow_Info_Asset()) + { + ToolBarButton btnViewItem = new ToolBarButton("InfoAsset"); + btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoAsset")); + btnViewItem.addEventListener(Events.ON_CLICK, this); + vbox.appendChild(btnViewItem); + } + + return vbox; + } + + public void onEvent(Event event) + { + Component comp = event.getTarget(); + String eventName = event.getName(); + + if(eventName.equals(Events.ON_CLICK)) + { + if(comp instanceof ToolBarButton) + { + ToolBarButton btn = (ToolBarButton) comp; + String actionCommand = btn.getName(); + int WindowNo = 0; + + if (actionCommand.equals("InfoProduct") && AEnv.canAccessInfo("PRODUCT")) + { + InfoPanel.showProduct(WindowNo); + } + else if (actionCommand.equals("InfoBPartner") && AEnv.canAccessInfo("BPARTNER")) + { + InfoPanel.showBPartner(WindowNo); + } + else if (actionCommand.equals("InfoAsset") && AEnv.canAccessInfo("ASSET")) + { + InfoPanel.showAsset(WindowNo); + } + else if (actionCommand.equals("InfoAccount") && + MRole.getDefault().isShowAcct() && + AEnv.canAccessInfo("ACCOUNT")) + { + new org.adempiere.webui.acct.WAcctViewer(); + } + else if (actionCommand.equals("InfoSchedule") && AEnv.canAccessInfo("SCHEDULE")) + { + new InfoSchedule(null, false); + } + else if (actionCommand.equals("InfoOrder") && AEnv.canAccessInfo("ORDER")) + { + InfoPanel.showOrder(WindowNo, ""); + } + else if (actionCommand.equals("InfoInvoice") && AEnv.canAccessInfo("INVOICE")) + { + InfoPanel.showInvoice(WindowNo, ""); + } + else if (actionCommand.equals("InfoInOut") && AEnv.canAccessInfo("INOUT")) + { + InfoPanel.showInOut(WindowNo, ""); + } + else if (actionCommand.equals("InfoPayment") && AEnv.canAccessInfo("PAYMENT")) + { + InfoPanel.showPayment(WindowNo, ""); + } + else if (actionCommand.equals("InfoCashLine") && AEnv.canAccessInfo("CASHJOURNAL")) + { + InfoPanel.showCashLine(WindowNo, ""); + } + else if (actionCommand.equals("InfoAssignment") && AEnv.canAccessInfo("RESOURCE")) + { + InfoPanel.showAssignment(WindowNo, ""); + } + } + } + } +} diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/DashboardPanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/DashboardPanel.java new file mode 100644 index 0000000000..bd5e2a93f4 --- /dev/null +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/DashboardPanel.java @@ -0,0 +1,36 @@ +/****************************************************************************** + * Copyright (C) 2008 Elaine Tan * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.webui; + +import org.adempiere.webui.component.Window; + +/** + * Custom dashboard item base class + * @author Elaine + * @date November 20, 2008 + */ +public abstract class DashboardPanel extends Window implements IDashboardPanel { + + public DashboardPanel() + { + super(); + } + + /** + * Desktop.UpdateInfoRunnable will call this method at a certain interval + */ + public void updateInfo() { + + } + +} diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/Desktop.java b/zkwebui/WEB-INF/src/org/adempiere/webui/Desktop.java index 2db4c11ffb..b1ebb2caa0 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/Desktop.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/Desktop.java @@ -17,19 +17,22 @@ package org.adempiere.webui; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; import java.io.Serializable; +import java.net.URL; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; -import java.util.Enumeration; import java.util.List; import java.util.logging.Level; +import org.adempiere.apps.graph.BarGraphColumn; import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.ProcessDialog; -import org.adempiere.webui.apps.graph.WPAPanel; +import org.adempiere.webui.apps.graph.WBarGraph; import org.adempiere.webui.apps.wf.WFPanel; -import org.adempiere.webui.component.Button; import org.adempiere.webui.component.DesktopTabpanel; import org.adempiere.webui.component.Tabbox; import org.adempiere.webui.component.Tabpanel; @@ -39,19 +42,22 @@ import org.adempiere.webui.event.MenuListener; import org.adempiere.webui.exception.ApplicationException; import org.adempiere.webui.panel.ADForm; import org.adempiere.webui.panel.HeaderPanel; -import org.adempiere.webui.panel.InfoPanel; import org.adempiere.webui.panel.SidePanel; import org.adempiere.webui.part.AbstractUIPart; import org.adempiere.webui.part.WindowContainer; import org.adempiere.webui.window.ADWindow; -import org.adempiere.webui.window.InfoSchedule; import org.adempiere.webui.window.WTask; +import org.compiere.model.MAchievement; +import org.compiere.model.MGoal; +import org.compiere.model.MMeasureCalc; import org.compiere.model.MMenu; +import org.compiere.model.MProjectType; import org.compiere.model.MQuery; +import org.compiere.model.MRequestType; import org.compiere.model.MRole; import org.compiere.model.MTask; -import org.compiere.model.MTree; -import org.compiere.model.MTreeNode; +import org.compiere.model.X_AD_Menu; +import org.compiere.model.X_PA_DashboardContent; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; @@ -59,10 +65,10 @@ import org.compiere.util.Msg; import org.compiere.util.WebDoc; import org.zkoss.lang.Threads; import org.zkoss.util.media.AMedia; +import org.zkoss.zhtml.Button; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.Page; -import org.zkoss.zk.ui.event.DropEvent; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; @@ -72,18 +78,12 @@ import org.zkoss.zkex.zul.North; import org.zkoss.zkex.zul.West; import org.zkoss.zkmax.zul.Portalchildren; import org.zkoss.zkmax.zul.Portallayout; -import org.zkoss.zul.Box; +import org.zkoss.zul.Html; import org.zkoss.zul.Iframe; -import org.zkoss.zul.Image; import org.zkoss.zul.Panel; import org.zkoss.zul.Panelchildren; -import org.zkoss.zul.Separator; import org.zkoss.zul.Tab; import org.zkoss.zul.Tabpanels; -import org.zkoss.zul.Toolbar; -import org.zkoss.zul.Treeitem; -import org.zkoss.zul.Treerow; -import org.zkoss.zul.Vbox; /** * @@ -108,16 +108,21 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl private Borderlayout layout; private WindowContainer windowContainer; + + private List dashboardPanels; - private Button btnNotice, btnRequest, btnWorkflow; + private MGoal[] m_goals = null; - private int m_AD_Tree_ID; + private List queryZoom = null; - private Box bxFav; + private static final String key = "queryZoom"; public Desktop() { windows = new ArrayList(); + dashboardPanels = new ArrayList(); + m_goals = MGoal.getUserGoals(Env.getCtx(), Env.getAD_User_ID(Env.getCtx())); + queryZoom = new ArrayList(); } protected Component doCreatePart(Component parent) @@ -172,92 +177,174 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl windowContainer.addWindow(homeTab, Msg.getMsg(Env.getCtx(), "Home").replaceAll("&", ""), false); Portallayout layout = new Portallayout(); + layout.setWidth("100%"); homeTab.appendChild(layout); + + // Dashboard content + Portalchildren portalchildren = null; + int currentColumnNo = 0; - Portalchildren left = new Portalchildren(); - left.setWidth("30%"); - left.setStyle("padding: 5px"); - layout.appendChild(left); + String sql = "SELECT COUNT(DISTINCT COLUMNNO) " + + "FROM PA_DASHBOARDCONTENT " + + "WHERE (AD_CLIENT_ID=0 OR AD_CLIENT_ID=?) AND ISACTIVE='Y'"; - Panel favPanel = new Panel(); - favPanel.setStyle("margin-bottom:10px"); - favPanel.setTitle("Favourites"); - favPanel.setCollapsible(true); - favPanel.setBorder("normal"); - left.appendChild(favPanel); - Panelchildren favContent = new Panelchildren(); - favPanel.appendChild(favContent); - favContent.appendChild(createFavouritesPanel()); - Toolbar favToolbar = new Toolbar(); - favPanel.appendChild(favToolbar); - // Elaine 2008/07/24 - Image img = new Image("/images/Delete24.png"); - favToolbar.appendChild(img); - img.setAlign("right"); - img.setDroppable("deleteFav"); - img.addEventListener(Events.ON_DROP, this); + int noOfCols = DB.getSQLValue(null, sql, + Env.getAD_Client_ID(Env.getCtx())); - favContent.setDroppable("favourite"); - favContent.addEventListener(Events.ON_DROP, this); + int width = noOfCols <= 0 ? 100 : 100/noOfCols; - Panel viewPanel = new Panel(); - viewPanel.setStyle("margin-bottom:10px"); - left.appendChild(viewPanel); - viewPanel.setTitle("Views"); - viewPanel.setCollapsible(true); - viewPanel.setBorder("normal"); - Panelchildren viewContent = new Panelchildren(); - viewPanel.appendChild(viewContent); - viewContent.appendChild(createViewPanel()); - - Portalchildren center = new Portalchildren(); - layout.appendChild(center); - center.setWidth("45%"); - center.setStyle("padding: 5px"); - - Panel calPanel = new Panel(); - calPanel.setStyle("margin-bottom:10px"); - calPanel.setTitle("Calendar"); - calPanel.setCollapsible(true); - calPanel.setBorder("normal"); - center.appendChild(calPanel); - Panelchildren calContent = new Panelchildren(); - calPanel.appendChild(calContent); - - Iframe iframe = new Iframe("http://www.google.com/calendar/embed?showTitle=0&showTabs=0&height=300&wkst=1&bgcolor=%23FFFFFF&color=%232952A3"); - iframe.setStyle("border-width: 0;"); - iframe.setScrolling("no"); - iframe.setWidth("300px"); - iframe.setHeight("300px"); - calContent.appendChild(iframe); - - Panel actPanel = new Panel(); - actPanel.setStyle("margin-bottom:10px"); - actPanel.setTitle("Activities"); - actPanel.setCollapsible(true); - actPanel.setBorder("normal"); - center.appendChild(actPanel); - Panelchildren actContent = new Panelchildren(); - actPanel.appendChild(actContent); - actContent.appendChild(createActivitiesPanel()); - - Portalchildren right = new Portalchildren(); - layout.appendChild(right); - right.setWidth("25%"); - right.setStyle("padding: 5px"); - - WPAPanel paPanel = WPAPanel.get(); - if (paPanel != null) { - Panel wpaPanel = new Panel(); - wpaPanel.setStyle("margin-bottom:10px"); - wpaPanel.setCollapsible(true); - wpaPanel.setBorder("normal"); - wpaPanel.setTitle("Performance"); - right.appendChild(wpaPanel); - Panelchildren wpaContent = new Panelchildren(); - wpaPanel.appendChild(wpaContent); - wpaContent.appendChild(paPanel); - } + sql = "SELECT x.*, m.AD_MENU_ID " + + "FROM PA_DASHBOARDCONTENT x " + + "LEFT OUTER JOIN AD_MENU m ON x.AD_WINDOW_ID=m.AD_WINDOW_ID " + + "WHERE (x.AD_CLIENT_ID=0 OR x.AD_CLIENT_ID=?) AND x.ISACTIVE='Y' " + + "ORDER BY x.COLUMNNO, x.AD_CLIENT_ID, x.LINE "; + PreparedStatement pstmt = null; + ResultSet rs = null; + try + { + pstmt = DB.prepareStatement(sql, null); + pstmt.setInt(1, Env.getAD_Client_ID(Env.getCtx())); + rs = pstmt.executeQuery(); + + while (rs.next()) + { + int columnNo = rs.getInt(X_PA_DashboardContent.COLUMNNAME_ColumnNo); + if(portalchildren == null || currentColumnNo != columnNo) + { + portalchildren = new Portalchildren(); + layout.appendChild(portalchildren); + portalchildren.setWidth(width + "%"); + portalchildren.setStyle("padding: 5px"); + + currentColumnNo = columnNo; + } + + Panel panel = new Panel(); + panel.setStyle("margin-bottom:10px"); + panel.setTitle(rs.getString(X_PA_DashboardContent.COLUMNNAME_Name)); + + String description = rs.getString(X_PA_DashboardContent.COLUMNNAME_Description); + if(description != null) + panel.setTooltiptext(description); + + panel.setCollapsible(true); + panel.setBorder("normal"); + portalchildren.appendChild(panel); + Panelchildren content = new Panelchildren(); + panel.appendChild(content); + + boolean panelEmpty = true; + + // HTML content + String htmlContent = rs.getString(X_PA_DashboardContent.COLUMNNAME_HTML); + if(htmlContent != null) + { + StringBuffer result = new StringBuffer(""); + + URL url = getClass().getClassLoader(). + getResource("org/compiere/images/PAPanel.css"); + InputStreamReader ins; + try { + ins = new InputStreamReader(url.openStream()); + BufferedReader bufferedReader = new BufferedReader( ins ); + String cssLine; + while ((cssLine = bufferedReader.readLine()) != null) + result.append(cssLine + "\n"); + } catch (IOException e1) { + logger.log(Level.SEVERE, e1.getLocalizedMessage(), e1); + } + + result.append("
\n"); + +// if(description != null) +// result.append("

" + description + "

\n"); + result.append(stripHtml(htmlContent, false) + "
\n"); + result.append("
\n\n\n"); + + Html html = new Html(); + html.setContent(result.toString()); + content.appendChild(html); + panelEmpty = false; + } + + // Window + int AD_Window_ID = rs.getInt(X_PA_DashboardContent.COLUMNNAME_AD_Window_ID); + if(AD_Window_ID > 0) + { + int AD_Menu_ID = rs.getInt(X_AD_Menu.COLUMNNAME_AD_Menu_ID); + ToolBarButton btn = new ToolBarButton(String.valueOf(AD_Menu_ID)); +// if(description == null) +// { + MMenu menu = new MMenu(Env.getCtx(), AD_Menu_ID, null); + btn.setLabel(menu.getName()); +// } +// else +// { +// btn.setLabel(description); +// } + btn.addEventListener(Events.ON_CLICK, this); + content.appendChild(btn); + panelEmpty = false; + } + + // Goal + int PA_Goal_ID = rs.getInt(X_PA_DashboardContent.COLUMNNAME_PA_Goal_ID); + if(PA_Goal_ID > 0) + { + StringBuffer result = new StringBuffer(""); + + URL url = getClass().getClassLoader(). + getResource("org/compiere/images/PAPanel.css"); + InputStreamReader ins; + try { + ins = new InputStreamReader(url.openStream()); + BufferedReader bufferedReader = new BufferedReader( ins ); + String cssLine; + while ((cssLine = bufferedReader.readLine()) != null) + result.append(cssLine + "\n"); + } catch (IOException e1) { + logger.log(Level.SEVERE, e1.getLocalizedMessage(), e1); + } + + result.append("
\n"); + result.append(goalsDetail(PA_Goal_ID, content)); + result.append("
\n\n\n"); + + Html html = new Html(); + html.setContent(result.toString()); + content.appendChild(html); + panelEmpty = false; + } + + // ZUL file url + String url = rs.getString(X_PA_DashboardContent.COLUMNNAME_ZulFilePath); + if(url != null) + { + try { + Component component = Executions.createComponents(url, content, null); + if(component != null && component instanceof DashboardPanel) + { + DashboardPanel dashboardPanel = (DashboardPanel) component; + if (!dashboardPanel.getChildren().isEmpty()) { + content.appendChild(dashboardPanel); + dashboardPanels.add(dashboardPanel); + panelEmpty = false; + } + } + } catch (Exception e) { + logger.log(Level.WARNING, "Failed to create components", e); + } + } + + if (panelEmpty) + panel.detach(); + } + } catch(Exception e) { + logger.log(Level.WARNING, "Failed to create dashboard content", e); + } finally { + DB.close(rs, pstmt); + } + // //register as 0 registerWindow(homeTab); @@ -270,6 +357,118 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl new Thread(new UpdateInfoRunnable(layout.getDesktop())).start(); } + private String goalsDetail(int AD_Table_ID, Panelchildren panel) + { + String output = ""; + if (m_goals == null) + return output; + + for (int i = 0; i < m_goals.length; i++) + { + MMeasureCalc mc = MMeasureCalc.get(Env.getCtx(), m_goals[i].getMeasure().getPA_MeasureCalc_ID()); + + if (AD_Table_ID == m_goals[i].getPA_Goal_ID()) + { + output += "\n\n"; + output += "\n"; + output += "\n"; + + WBarGraph barPanel = new WBarGraph(m_goals[i]); + BarGraphColumn[] bList = barPanel.getBarGraphColumnList(); + MQuery query = null; + output += "\n"; + + for (int k = 0; k < bList.length; k++) + { + BarGraphColumn bgc = bList[k]; + if (k > 0) + output += ""; + if (bgc.getAchievement() != null) // Single Achievement + { + MAchievement a = bgc.getAchievement(); + query = MQuery.getEqualQuery("PA_Measure_ID", a.getPA_Measure_ID()); + } + else if (bgc.getGoal() != null) // Multiple Achievements + { + MGoal goal = bgc.getGoal(); + query = MQuery.getEqualQuery("PA_Measure_ID", goal.getPA_Measure_ID()); + } + else if (bgc.getMeasureCalc() != null) // Document + { + mc = bgc.getMeasureCalc(); + query = mc.getQuery(m_goals[i].getRestrictions(false), bgc.getMeasureDisplay(), + bgc.getDate(), MRole.getDefault()); // logged in role + } + else if (bgc.getProjectType() != null) // Document + { + MProjectType pt = bgc.getProjectType(); + query = pt.getQuery(m_goals[i].getRestrictions(false), bgc.getMeasureDisplay(), + bgc.getDate(), bgc.getID(), MRole.getDefault()); // logged in role + } + else if (bgc.getRequestType() != null) // Document + { + MRequestType rt = bgc.getRequestType(); + query = rt.getQuery(m_goals[i].getRestrictions(false), bgc.getMeasureDisplay(), + bgc.getDate(), bgc.getID(), MRole.getDefault()); // logged in role + } + output += ""; + } + output += "" + + "" + + "
" + + m_goals[i].getName() + "
Target" + + m_goals[i].getMeasureTarget() + "
Actual" + + m_goals[i].getMeasureActual() + "
" + + m_goals[i].getXAxisText() + "
" + bgc.getLabel() + + ""; + if (query != null) { + Button btn = new Button(); + btn.setId(String.valueOf(key + queryZoom.size())); + btn.addEventListener(Events.ON_CLICK, this); + btn.setVisible(false); + panel.appendChild(btn); + + output += "" + + bgc.getValue() + + "
\n"; + + queryZoom.add(query); + } else { + logger.info("Nothing to zoom to - " + bgc); + output += bgc.getValue(); + } + output += "
" + + m_goals[i].getDescription() + + "
" + + stripHtml(m_goals[i].getColorSchema() + .getDescription(), true) + "
\n"; + bList = null; + barPanel = null; + } + } + + return output; + } + + private String stripHtml(String htmlString, boolean all) { + htmlString = htmlString + .replace("", "") + .replace("", "") + .replace("", "") + .replace("", "") + .replace("", "") + .replace("", ""); + + if (all) + htmlString = htmlString + .replace(">", ">") + .replace("<", "<"); + return htmlString; + } + private class UpdateInfoRunnable implements Runnable { private org.zkoss.zk.ui.Desktop desktop; UpdateInfoRunnable(org.zkoss.zk.ui.Desktop desktop) { @@ -295,250 +494,6 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl } } - private Box createActivitiesPanel() - { - Vbox vbox = new Vbox(); - - btnNotice = new Button(); - vbox.appendChild(btnNotice); - btnNotice.setLabel("Notice : 0"); - btnNotice.setTooltiptext("Notice"); - btnNotice.setImage("/images/GetMail16.png"); - int AD_Menu_ID = DB.getSQLValue(null, "SELECT AD_Menu_ID FROM AD_Menu WHERE Name = 'Notice' AND IsSummary = 'N'"); - btnNotice.setName(String.valueOf(AD_Menu_ID)); - btnNotice.addEventListener(Events.ON_CLICK, this); - - btnRequest = new Button(); - vbox.appendChild(btnRequest); - btnRequest.setLabel("Request : 0"); - btnRequest.setTooltiptext("Request"); - btnRequest.setImage("/images/Request16.png"); - AD_Menu_ID = DB.getSQLValue(null, "SELECT AD_Menu_ID FROM AD_Menu WHERE Name = 'Request' AND IsSummary = 'N'"); - btnRequest.setName(String.valueOf(AD_Menu_ID)); - btnRequest.addEventListener(Events.ON_CLICK, this); - - btnWorkflow = new Button(); - vbox.appendChild(btnWorkflow); - btnWorkflow.setLabel("Workflow Activities : 0"); - btnWorkflow.setTooltiptext("Workflow Activities"); - btnWorkflow.setImage("/images/Assignment16.png"); - AD_Menu_ID = DB.getSQLValue(null, "SELECT AD_Menu_ID FROM AD_Menu WHERE Name = 'Workflow Activities' AND IsSummary = 'N'"); - btnWorkflow.setName(String.valueOf(AD_Menu_ID)); - btnWorkflow.addEventListener(Events.ON_CLICK, this); - - return vbox; - } - - private Box createFavouritesPanel() - { - bxFav = new Vbox(); - - int AD_Role_ID = Env.getAD_Role_ID(Env.getCtx()); - int AD_Tree_ID = DB.getSQLValue(null, - "SELECT COALESCE(r.AD_Tree_Menu_ID, ci.AD_Tree_Menu_ID)" - + "FROM AD_ClientInfo ci" - + " INNER JOIN AD_Role r ON (ci.AD_Client_ID=r.AD_Client_ID) " - + "WHERE AD_Role_ID=?", AD_Role_ID); - if (AD_Tree_ID <= 0) - AD_Tree_ID = 10; // Menu - - m_AD_Tree_ID = AD_Tree_ID; - - MTree vTree = new MTree(Env.getCtx(), AD_Tree_ID, false, true, null); - MTreeNode m_root = vTree.getRoot(); - Enumeration enTop = m_root.children(); - while(enTop.hasMoreElements()) - { - MTreeNode ndTop = (MTreeNode)enTop.nextElement(); - Enumeration en = ndTop.preorderEnumeration(); - while (en.hasMoreElements()) - { - MTreeNode nd = (MTreeNode)en.nextElement(); - if (nd.isOnBar()) { - String label = nd.toString().trim(); - ToolBarButton btnFavItem = new ToolBarButton(String.valueOf(nd.getNode_ID())); - btnFavItem.setLabel(label); - btnFavItem.setDraggable("deleteFav"); - btnFavItem.addEventListener(Events.ON_CLICK, this); - btnFavItem.addEventListener(Events.ON_DROP, this); - bxFav.appendChild(btnFavItem); - } - } - } - - return bxFav; - } - - private Box createViewPanel() - { - Vbox vbox = new Vbox(); - - if (MRole.getDefault().isAllow_Info_Product()) - { - ToolBarButton btnViewItem = new ToolBarButton("InfoProduct"); - btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoProduct")); - btnViewItem.addEventListener(Events.ON_CLICK, this); - vbox.appendChild(btnViewItem); - } - if (MRole.getDefault().isAllow_Info_BPartner()) - { - ToolBarButton btnViewItem = new ToolBarButton("InfoBPartner"); - btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoBPartner")); - btnViewItem.addEventListener(Events.ON_CLICK, this); - vbox.appendChild(btnViewItem); - } - if (MRole.getDefault().isShowAcct() && MRole.getDefault().isAllow_Info_Account()) - { - ToolBarButton btnViewItem = new ToolBarButton("InfoAccount"); - btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoAccount")); - btnViewItem.addEventListener(Events.ON_CLICK, this); - vbox.appendChild(btnViewItem); - } - if (MRole.getDefault().isAllow_Info_Schedule()) - { - ToolBarButton btnViewItem = new ToolBarButton("InfoSchedule"); - btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoSchedule")); - btnViewItem.addEventListener(Events.ON_CLICK, this); - vbox.appendChild(btnViewItem); - } - vbox.appendChild(new Separator("horizontal")); - if (MRole.getDefault().isAllow_Info_Order()) - { - ToolBarButton btnViewItem = new ToolBarButton("InfoOrder"); - btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoOrder")); - btnViewItem.addEventListener(Events.ON_CLICK, this); - vbox.appendChild(btnViewItem); - } - if (MRole.getDefault().isAllow_Info_Invoice()) - { - ToolBarButton btnViewItem = new ToolBarButton("InfoInvoice"); - btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoInvoice")); - btnViewItem.addEventListener(Events.ON_CLICK, this); - vbox.appendChild(btnViewItem); - } - if (MRole.getDefault().isAllow_Info_InOut()) - { - ToolBarButton btnViewItem = new ToolBarButton("InfoInOut"); - btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoInOut")); - btnViewItem.addEventListener(Events.ON_CLICK, this); - vbox.appendChild(btnViewItem); - } - if (MRole.getDefault().isAllow_Info_Payment()) - { - ToolBarButton btnViewItem = new ToolBarButton("InfoPayment"); - btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoPayment")); - btnViewItem.addEventListener(Events.ON_CLICK, this); - vbox.appendChild(btnViewItem); - } - if (MRole.getDefault().isAllow_Info_CashJournal()) - { - ToolBarButton btnViewItem = new ToolBarButton("InfoCashLine"); - btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoCashLine")); - btnViewItem.addEventListener(Events.ON_CLICK, this); - vbox.appendChild(btnViewItem); - } - if (MRole.getDefault().isAllow_Info_Resource()) - { - ToolBarButton btnViewItem = new ToolBarButton("InfoAssignment"); - btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoAssignment")); - btnViewItem.addEventListener(Events.ON_CLICK, this); - vbox.appendChild(btnViewItem); - } - if (MRole.getDefault().isAllow_Info_Asset()) - { - ToolBarButton btnViewItem = new ToolBarButton("InfoAsset"); - btnViewItem.setLabel(Msg.getMsg(Env.getCtx(), "InfoAsset")); - btnViewItem.addEventListener(Events.ON_CLICK, this); - vbox.appendChild(btnViewItem); - } - - return vbox; - } - - private int getNoticeCount() - { - String sql = "SELECT COUNT(1) FROM AD_Note " - + "WHERE AD_Client_ID=? AND AD_User_ID IN (0,?)" - + " AND Processed='N'"; - int retValue = DB.getSQLValue(null, sql, Env.getAD_Client_ID(Env.getCtx()), Env.getAD_User_ID(Env.getCtx())); - return retValue; - } - - private int getRequestCount() - { - String sql = MRole.getDefault().addAccessSQL ("SELECT COUNT(1) FROM R_Request " - + "WHERE (SalesRep_ID=? OR AD_Role_ID=?) AND Processed='N'" - + " AND (DateNextAction IS NULL OR TRUNC(DateNextAction) <= TRUNC(SysDate))" - + " AND (R_Status_ID IS NULL OR R_Status_ID IN (SELECT R_Status_ID FROM R_Status WHERE IsClosed='N'))", - "R_Request", false, true); // not qualified - RW - int retValue = DB.getSQLValue(null, sql, Env.getAD_User_ID(Env.getCtx()), Env.getAD_Role_ID(Env.getCtx())); - return retValue; - } - - public int getWorkflowCount() - { - int count = 0; - - String sql = "SELECT count(*) FROM AD_WF_Activity a " - + "WHERE a.Processed='N' AND a.WFState='OS' AND (" - // Owner of Activity - + " a.AD_User_ID=?" // #1 - // Invoker (if no invoker = all) - + " OR EXISTS (SELECT * FROM AD_WF_Responsible r WHERE a.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID" - + " AND COALESCE(r.AD_User_ID,0)=0 AND COALESCE(r.AD_Role_ID,0)=0 AND (a.AD_User_ID=? OR a.AD_User_ID IS NULL))" // #2 - // Responsible User - + " OR EXISTS (SELECT * FROM AD_WF_Responsible r WHERE a.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID" - + " AND r.AD_User_ID=?)" // #3 - // Responsible Role - + " OR EXISTS (SELECT * FROM AD_WF_Responsible r INNER JOIN AD_User_Roles ur ON (r.AD_Role_ID=ur.AD_Role_ID)" - + " WHERE a.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID AND ur.AD_User_ID=?))"; // #4 - // - //+ ") ORDER BY a.Priority DESC, Created"; - int AD_User_ID = Env.getAD_User_ID(Env.getCtx()); - PreparedStatement pstmt = null; - ResultSet rs = null; - try - { - pstmt = DB.prepareStatement (sql, null); - pstmt.setInt (1, AD_User_ID); - pstmt.setInt (2, AD_User_ID); - pstmt.setInt (3, AD_User_ID); - pstmt.setInt (4, AD_User_ID); - rs = pstmt.executeQuery (); - if (rs.next ()) { - count = rs.getInt(1); - } - } - catch (Exception e) - { - logger.log(Level.SEVERE, sql, e); - } - finally - { - DB.close(rs, pstmt); - rs = null; pstmt = null; - } - - return count; - } - - private void updateInfo() - { - int noOfNotice = getNoticeCount(); - int noOfRequest = getRequestCount(); - int noOfWorkflow = getWorkflowCount(); - int total = noOfNotice + noOfRequest + noOfWorkflow; - - btnNotice.setLabel("Notice : " + noOfNotice); - btnRequest.setLabel("Request : " + noOfRequest); - btnWorkflow.setLabel("Workflow Activities : " + noOfWorkflow); - windowContainer.setTabTitle(0, "Home (" + total + ")", - "Notice : " + noOfNotice + ", Request : " + noOfRequest + ", Workflow Activities : " + noOfWorkflow); - } - - /** - * @param event - */ public void onEvent(Event event) { Component comp = event.getTarget(); @@ -560,155 +515,34 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl } if(menuId > 0) onMenuSelected(menuId); - else - { - String actionCommand = btn.getName(); - int WindowNo = 0; - - if (actionCommand.equals("InfoProduct") && AEnv.canAccessInfo("PRODUCT")) - { - InfoPanel.showProduct(WindowNo); - } - else if (actionCommand.equals("InfoBPartner") && AEnv.canAccessInfo("BPARTNER")) - { - InfoPanel.showBPartner(WindowNo); - } - else if (actionCommand.equals("InfoAsset") && AEnv.canAccessInfo("ASSET")) - { - InfoPanel.showAsset(WindowNo); - } - else if (actionCommand.equals("InfoAccount") && - MRole.getDefault().isShowAcct() && - AEnv.canAccessInfo("ACCOUNT")) - { - new org.adempiere.webui.acct.WAcctViewer(); - } - else if (actionCommand.equals("InfoSchedule") && AEnv.canAccessInfo("SCHEDULE")) - { - new InfoSchedule(null, false); - } - else if (actionCommand.equals("InfoOrder") && AEnv.canAccessInfo("ORDER")) - { - InfoPanel.showOrder(WindowNo, ""); - } - else if (actionCommand.equals("InfoInvoice") && AEnv.canAccessInfo("INVOICE")) - { - InfoPanel.showInvoice(WindowNo, ""); - } - else if (actionCommand.equals("InfoInOut") && AEnv.canAccessInfo("INOUT")) - { - InfoPanel.showInOut(WindowNo, ""); - } - else if (actionCommand.equals("InfoPayment") && AEnv.canAccessInfo("PAYMENT")) - { - InfoPanel.showPayment(WindowNo, ""); - } - else if (actionCommand.equals("InfoCashLine") && AEnv.canAccessInfo("CASHJOURNAL")) - { - InfoPanel.showCashLine(WindowNo, ""); - } - else if (actionCommand.equals("InfoAssignment") && AEnv.canAccessInfo("RESOURCE")) - { - InfoPanel.showAssignment(WindowNo, ""); - } - } } else if(comp instanceof Button) { - Button btn = (Button) comp; - - int menuId = 0; - try + String id = comp.getId(); + String key = "queryZoom"; + if(id.startsWith(key)) { - menuId = Integer.valueOf(btn.getName()); + String ss = id.substring(key.length()); + int index = Integer.parseInt(String.valueOf(ss)); + if ((index >= 0) && (index < queryZoom.size())) + AEnv.zoom(queryZoom.get(index)); } - catch (Exception e) { - - } - - if(menuId > 0) onMenuSelected(menuId); } } - // Elaine 2008/07/24 - else if(eventName.equals(Events.ON_DROP)) - { - DropEvent de = (DropEvent) event; - Component dragged = de.getDragged(); - - if(comp instanceof Panelchildren) - { - if(dragged instanceof Treerow) - { - Treerow treerow = (Treerow) dragged; - Treeitem treeitem = (Treeitem) treerow.getParent(); - - Object value = treeitem.getValue(); - if(value != null) - { - int Node_ID = Integer.valueOf(value.toString()); - if(barDBupdate(true, Node_ID)) - { - String label = treeitem.getLabel().trim(); - ToolBarButton btnFavItem = new ToolBarButton(String.valueOf(Node_ID)); - btnFavItem.setLabel(label); - btnFavItem.setDraggable("deleteFav"); - btnFavItem.addEventListener(Events.ON_CLICK, this); - btnFavItem.addEventListener(Events.ON_DROP, this); - bxFav.appendChild(btnFavItem); - bxFav.invalidate(); - } - } - } - } - else if(comp instanceof Image) - { - if(dragged instanceof ToolBarButton) - { - ToolBarButton btn = (ToolBarButton) dragged; - String value = btn.getName(); - - if(value != null) - { - int Node_ID = Integer.valueOf(value.toString()); - if(barDBupdate(false, Node_ID)) - { - bxFav.removeChild(btn); - bxFav.invalidate(); - } - } - } - } - } - // - } - - /** - * Make Bar add/remove persistent - * @param add true if add - otherwise remove - * @param Node_ID Node ID - * @return true if updated - */ - private boolean barDBupdate(boolean add, int Node_ID) + } + + private void updateInfo() { - int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx()); - int AD_Org_ID = Env.getContextAsInt(Env.getCtx(), "#AD_Org_ID"); - int AD_User_ID = Env.getContextAsInt(Env.getCtx(), "#AD_User_ID"); - StringBuffer sql = new StringBuffer(); - if (add) - sql.append("INSERT INTO AD_TreeBar " - + "(AD_Tree_ID,AD_User_ID,Node_ID, " - + "AD_Client_ID,AD_Org_ID, " - + "IsActive,Created,CreatedBy,Updated,UpdatedBy)VALUES (") - .append(m_AD_Tree_ID).append(",").append(AD_User_ID).append(",").append(Node_ID).append(",") - .append(AD_Client_ID).append(",").append(AD_Org_ID).append(",") - .append("'Y',SysDate,").append(AD_User_ID).append(",SysDate,").append(AD_User_ID).append(")"); - // if already exist, will result in ORA-00001: unique constraint (ADEMPIERE.AD_TREEBAR_KEY) - else - sql.append("DELETE AD_TreeBar WHERE AD_Tree_ID=").append(m_AD_Tree_ID) - .append(" AND AD_User_ID=").append(AD_User_ID) - .append(" AND Node_ID=").append(Node_ID); - int no = DB.executeUpdate(sql.toString(), false, null); - return no == 1; + for(int i = 0; i < dashboardPanels.size(); i++) + dashboardPanels.get(i).updateInfo(); + + int noOfNotice = DPActivities.getNoticeCount(); + int noOfRequest = DPActivities.getRequestCount(); + int noOfWorkflow = DPActivities.getWorkflowCount(); + int total = noOfNotice + noOfRequest + noOfWorkflow; + + windowContainer.setTabTitle(0, "Home (" + total + ")", + "Notice : " + noOfNotice + ", Request : " + noOfRequest + ", Workflow Activities : " + noOfWorkflow); } /** diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/IDashboardPanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/IDashboardPanel.java new file mode 100644 index 0000000000..bdfdf6864a --- /dev/null +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/IDashboardPanel.java @@ -0,0 +1,7 @@ +package org.adempiere.webui; + +public interface IDashboardPanel { + + public void updateInfo(); + +} diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/component/CWindowToolbar.java b/zkwebui/WEB-INF/src/org/adempiere/webui/component/CWindowToolbar.java index 77cbd124e6..90df4b716b 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/component/CWindowToolbar.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/component/CWindowToolbar.java @@ -56,7 +56,7 @@ public class CWindowToolbar extends FToolbar implements EventListener private ToolBarButton btnIgnore; - private ToolBarButton btnHelp, btnNew, btnDelete, btnSave; + private ToolBarButton btnHelp, btnNew, btnCopy, btnDelete, btnSave; private ToolBarButton btnRefresh, btnFind, btnAttachment; @@ -93,6 +93,7 @@ public class CWindowToolbar extends FToolbar implements EventListener addSeparator(); btnHelp = createButton("Help", "Help24.png","Help"); btnNew = createButton("New", "New24.png", "New"); + btnCopy = createButton("Copy", "Copy24.png", "Copy"); btnDelete = createButton("Delete", "Delete24.png", "Delete"); btnSave = createButton("Save", "Save24.png", "Save"); addSeparator(); @@ -325,6 +326,7 @@ public class CWindowToolbar extends FToolbar implements EventListener public void enableChanges(boolean enabled) { this.btnNew.setDisabled(!enabled); + this.btnCopy.setDisabled(!enabled); } public void enableIgnore(boolean enabled) @@ -354,6 +356,7 @@ public class CWindowToolbar extends FToolbar implements EventListener public void enableCopy(boolean enabled) { + this.btnCopy.setDisabled(!enabled); } public void enableFind(boolean enabled) diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java index 729b63df85..d1c8a0d54f 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java @@ -615,6 +615,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To private void updateToolbar() { toolbar.enableChanges(curTab.isReadOnly()); toolbar.enabledNew(curTab.isInsertRecord()); + toolbar.enableCopy(curTab.isInsertRecord()); toolbar.enableTabNavigation(curTabIndex > 0, curTabIndex < (adTab.getTabCount() - 1)); @@ -825,10 +826,9 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To return; } - newRecord = curTab.dataNew (false); + newRecord = curTab.dataNew(false); if (newRecord) { - curTabpanel.editRecord(true); curTabpanel.dynamicDisplay(0); toolbar.enableChanges(false); @@ -843,9 +843,40 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To { logger.severe("Could not create new record"); } - } + // Elaine 2008/11/19 + /** + * @see ToolbarListener#onCopy() + */ + public void onCopy() + { + if (!curTab.isInsertRecord()) + { + logger.warning("Insert Record disabled for Tab"); + return; + } + + newRecord = curTab.dataNew(true); + if (newRecord) + { + curTabpanel.editRecord(true); + curTabpanel.dynamicDisplay(0); + toolbar.enableChanges(false); + toolbar.enableDelete(false); + toolbar.enableNavigation(false); + toolbar.enableTabNavigation(false); + toolbar.enableIgnore(true); + toolbar.enablePrint(true); + toolbar.enableReport(true); + } + else + { + logger.severe("Could not create new record"); + } + } + // + /** * @see ToolbarListener#onFind() */ @@ -903,6 +934,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To curTabpanel.editRecord(true); toolbar.enableIgnore(true); toolbar.enabledNew(false); + toolbar.enableCopy(false); toolbar.enableDelete(false); toolbar.enableNavigation(false); toolbar.enableTabNavigation(false); diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/HeaderPanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/HeaderPanel.java index bde833b191..fcefb57042 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/HeaderPanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/HeaderPanel.java @@ -55,7 +55,7 @@ public class HeaderPanel extends Panel implements EventListener { LayoutUtils.addSclass("header", this); - UserPanel userPanel = new UserPanel(); + UserPanel userPanel = new UserPanel(); String logoURL = MSysConfig.getValue("WEBUI_LOGOURL", "/images/AD10030.png"); image.setSrc(logoURL); @@ -71,7 +71,7 @@ public class HeaderPanel extends Panel implements EventListener Vbox vb = new Vbox(); vb.setParent(west); vb.setHeight("100%"); - vb.setWidth("100%"); +// vb.setWidth("100%"); // Elaine 2008/11/19 the role and logout links don't work if width is set to 100% vb.setPack("center"); vb.setAlign("left"); @@ -92,10 +92,14 @@ public class HeaderPanel extends Panel implements EventListener } public void onEvent(Event event) throws Exception { + System.out.println(event.getTarget()); if (Events.ON_CLICK.equals(event.getName())) { - AboutWindow w = new AboutWindow(); - w.setPage(this.getPage()); - w.doModal(); + if(event.getTarget() == image) + { + AboutWindow w = new AboutWindow(); + w.setPage(this.getPage()); + w.doModal(); + } } } diff --git a/zkwebui/zul/activities.zul b/zkwebui/zul/activities.zul new file mode 100644 index 0000000000..22eda91baf --- /dev/null +++ b/zkwebui/zul/activities.zul @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/zkwebui/zul/calendar.zul b/zkwebui/zul/calendar.zul new file mode 100644 index 0000000000..4118f73fec --- /dev/null +++ b/zkwebui/zul/calendar.zul @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/zkwebui/zul/favourites.zul b/zkwebui/zul/favourites.zul new file mode 100644 index 0000000000..4ee81bf1a5 --- /dev/null +++ b/zkwebui/zul/favourites.zul @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/zkwebui/zul/performance.zul b/zkwebui/zul/performance.zul new file mode 100644 index 0000000000..52b8f22588 --- /dev/null +++ b/zkwebui/zul/performance.zul @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/zkwebui/zul/views.zul b/zkwebui/zul/views.zul new file mode 100644 index 0000000000..0cb859fe68 --- /dev/null +++ b/zkwebui/zul/views.zul @@ -0,0 +1,2 @@ + + \ No newline at end of file