From 9d3355d6b2b33dca66e18ab54c7ba7157dde48cc Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 25 Jan 2019 14:59:03 +0100 Subject: [PATCH] IDEMPIERE-1311 Ability to hide fields on Connection panel --- .../oracle/201810131655_IDEMPIERE-1311.sql | 2 +- .../oracle/201901251453_IDEMPIERE-1311.sql | 11 ++ .../201810131655_IDEMPIERE-1311.sql | 2 +- .../201901251453_IDEMPIERE-1311.sql | 8 ++ .../src/org/compiere/model/MSysConfig.java | 5 +- .../org/adempiere/webui/panel/RolePanel.java | 114 +++++++----------- 6 files changed, 67 insertions(+), 75 deletions(-) create mode 100644 migration/i6.2/oracle/201901251453_IDEMPIERE-1311.sql create mode 100644 migration/i6.2/postgresql/201901251453_IDEMPIERE-1311.sql diff --git a/migration/i6.2/oracle/201810131655_IDEMPIERE-1311.sql b/migration/i6.2/oracle/201810131655_IDEMPIERE-1311.sql index eff2bea673..089d3c6cc0 100644 --- a/migration/i6.2/oracle/201810131655_IDEMPIERE-1311.sql +++ b/migration/i6.2/oracle/201810131655_IDEMPIERE-1311.sql @@ -2,7 +2,7 @@ SET SQLBLANKLINES ON SET DEFINE OFF -- Oct 13, 2018 4:35:41 PM IST -INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200146,0,0,TO_DATE('2018-10-13 16:35:40','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-10-13 16:35:40','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ALogin_ShowDate','Y','Defaulted to Y. If value changed to N, date field is not displayed on role window.','U','S','54085add-8245-4bfe-a978-3583bbe2cc2a') +INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200146,0,0,TO_DATE('2018-10-13 16:35:40','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-10-13 16:35:40','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ALogin_ShowDate','Y','Defaulted to Y. If value changed to N, date field is not displayed on role window.','D','S','54085add-8245-4bfe-a978-3583bbe2cc2a') ; SELECT register_migration_script('201810131655_IDEMPIERE-1311.sql') FROM dual diff --git a/migration/i6.2/oracle/201901251453_IDEMPIERE-1311.sql b/migration/i6.2/oracle/201901251453_IDEMPIERE-1311.sql new file mode 100644 index 0000000000..8f608dd810 --- /dev/null +++ b/migration/i6.2/oracle/201901251453_IDEMPIERE-1311.sql @@ -0,0 +1,11 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-1311 Ability to hide fields on Connection panel +-- Jan 25, 2019, 2:53:25 PM CET +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Defaults',0,0,'Y',TO_DATE('2019-01-25 14:53:25','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-01-25 14:53:25','YYYY-MM-DD HH24:MI:SS'),100,200486,'Defaults','D','4b2b5e32-b978-47d9-a843-7e6c9eb647f2') +; + +SELECT register_migration_script('201901251453_IDEMPIERE-1311.sql') FROM dual +; + diff --git a/migration/i6.2/postgresql/201810131655_IDEMPIERE-1311.sql b/migration/i6.2/postgresql/201810131655_IDEMPIERE-1311.sql index 8bc9327e38..bf441026c5 100644 --- a/migration/i6.2/postgresql/201810131655_IDEMPIERE-1311.sql +++ b/migration/i6.2/postgresql/201810131655_IDEMPIERE-1311.sql @@ -1,5 +1,5 @@ -- Oct 13, 2018 4:35:41 PM IST -INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200146,0,0,TO_TIMESTAMP('2018-10-13 16:35:40','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-10-13 16:35:40','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ALogin_ShowDate','Y','Defaulted to Y. If value changed to N, date field is not displayed on role window.','U','S','54085add-8245-4bfe-a978-3583bbe2cc2a') +INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200146,0,0,TO_TIMESTAMP('2018-10-13 16:35:40','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-10-13 16:35:40','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ALogin_ShowDate','Y','Defaulted to Y. If value changed to N, date field is not displayed on role window.','D','S','54085add-8245-4bfe-a978-3583bbe2cc2a') ; SELECT register_migration_script('201810131655_IDEMPIERE-1311.sql') FROM dual diff --git a/migration/i6.2/postgresql/201901251453_IDEMPIERE-1311.sql b/migration/i6.2/postgresql/201901251453_IDEMPIERE-1311.sql new file mode 100644 index 0000000000..e54f78061c --- /dev/null +++ b/migration/i6.2/postgresql/201901251453_IDEMPIERE-1311.sql @@ -0,0 +1,8 @@ +-- IDEMPIERE-1311 Ability to hide fields on Connection panel +-- Jan 25, 2019, 2:53:25 PM CET +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Defaults',0,0,'Y',TO_TIMESTAMP('2019-01-25 14:53:25','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-01-25 14:53:25','YYYY-MM-DD HH24:MI:SS'),100,200486,'Defaults','D','4b2b5e32-b978-47d9-a843-7e6c9eb647f2') +; + +SELECT register_migration_script('201901251453_IDEMPIERE-1311.sql') FROM dual +; + diff --git a/org.adempiere.base/src/org/compiere/model/MSysConfig.java b/org.adempiere.base/src/org/compiere/model/MSysConfig.java index f515a6e80e..4e24f676fa 100644 --- a/org.adempiere.base/src/org/compiere/model/MSysConfig.java +++ b/org.adempiere.base/src/org/compiere/model/MSysConfig.java @@ -42,14 +42,15 @@ public class MSysConfig extends X_AD_SysConfig /** * */ - private static final long serialVersionUID = 2856526441538434702L; + private static final long serialVersionUID = -1401329788730986024L; public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION"; public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS"; public static final String ALLOCATION_DESCRIPTION = "ALLOCATION_DESCRIPTION"; public static final String ALLOW_APPLY_PAYMENT_TO_CREDITMEMO = "ALLOW_APPLY_PAYMENT_TO_CREDITMEMO"; public static final String ALLOW_OVER_APPLIED_PAYMENT = "ALLOW_OVER_APPLIED_PAYMENT"; - public static final String ALogin_ShowOneRole = "ALogin_ShowOneRole"; + public static final String ALogin_ShowDate = "ALogin_ShowDate"; + public static final String ALogin_ShowOneRole = "ALogin_ShowOneRole"; // deprecated public static final String APPLICATION_DATABASE_VERSION = "APPLICATION_DATABASE_VERSION"; public static final String APPLICATION_DATABASE_VERSION_SHOWN = "APPLICATION_DATABASE_VERSION_SHOWN"; public static final String APPLICATION_HOST_SHOWN = "APPLICATION_HOST_SHOWN"; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java index f6520f246a..f84899ecad 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java @@ -85,14 +85,13 @@ public class RolePanel extends Window implements EventListener, Deferrabl /** * */ - private static final long serialVersionUID = 372661654078492488L; + private static final long serialVersionUID = 4486118071892173802L; - private static final String ALOGIN_SHOWDATE = "ALogin_ShowDate"; protected LoginWindow wndLogin; protected Login login; protected Combobox lstRole, lstClient, lstOrganisation, lstWarehouse; - protected Label lblRole, lblClient, lblOrganisation, lblWarehouse, lblDate; + protected Label lblRole, lblClient, lblDef, lblOrganisation, lblWarehouse, lblDate; protected WDateEditor lstDate; protected Button btnOk, btnCancel; @@ -157,12 +156,10 @@ public class RolePanel extends Window implements EventListener, Deferrabl AuFocus auf = null; if (lstClient.getItemCount() > 1) { auf = new AuFocus(lstClient); + } else if (lstRole.getItemCount() > 1) { + auf = new AuFocus(lstRole); } else { - if (MSysConfig.getBooleanValue(MSysConfig.ALogin_ShowOneRole, true) || lstRole.getItemCount() > 1) { - auf = new AuFocus(lstRole); - } else { - auf = new AuFocus(lstOrganisation); - } + auf = new AuFocus(lstOrganisation); } Clients.response(auf); } else { @@ -226,6 +223,19 @@ public class RolePanel extends Window implements EventListener, Deferrabl tr.appendChild(td); td.appendChild(lstRole); + tr = new Tr(); + tr.setId("rowLabelDefault"); + table.appendChild(tr); + //td = new Td(); + //tr.appendChild(td); + td = new Td(); + tr.appendChild(td); + td.setSclass(ITheme.LOGIN_LABEL_CLASS); + div = new Div(); + div.setStyle("text-align: right; text-decoration: underline"); + div.appendChild(lblDef); + td.appendChild(div); + tr = new Tr(); tr.setId("rowOrganisation"); table.appendChild(tr); @@ -289,6 +299,10 @@ public class RolePanel extends Window implements EventListener, Deferrabl lblRole.setId("lblRole"); lblRole.setValue(Msg.getMsg(language,"Role")); + lblDef = new Label(); + lblDef.setId("lblDef"); + lblDef.setValue(Msg.getMsg(language,"Defaults")); + lblOrganisation = new Label(); lblOrganisation.setId("lblOrganisation"); lblOrganisation.setValue(Msg.getMsg(language,"Organization")); @@ -374,22 +388,19 @@ public class RolePanel extends Window implements EventListener, Deferrabl // if (m_clientKNPairs!=null && m_clientKNPairs.length == 1) { - // don't show client if is just one + // disable client if is just one lstClient.setSelectedIndex(0); - lblClient.setVisible(false); - lstClient.setVisible(false); + lstClient.setEnabled(false); } else { - lblClient.setVisible(true); - lstClient.setVisible(true); + lstClient.setEnabled(true); } // Disable date combo-box at login screen - if (!MSysConfig.getBooleanValue(ALOGIN_SHOWDATE, true)) + if (!MSysConfig.getBooleanValue(MSysConfig.ALogin_ShowDate, true)) { - lblDate.setVisible(false); - lstDate.setVisible(false); + lstDate.setReadWrite(false); } - + setUserID(); updateRoleList(); @@ -434,18 +445,14 @@ public class RolePanel extends Window implements EventListener, Deferrabl //force reload of default role MRole.getDefault(m_ctx, true); - - // If we have only one role, we can hide the combobox - metas-2009_0021_AP1_G94 - if (m_clientKNPairs.length == 1 && lstRole.getItemCount() == 1 && ! MSysConfig.getBooleanValue(MSysConfig.ALogin_ShowOneRole, true)) + + // If we have only one role, we can make readonly the combobox + if (lstRole.getItemCount() == 1) { lstRole.setSelectedIndex(0); - lblRole.setVisible(false); - lstRole.setVisible(false); - } - else - { - lblRole.setVisible(true); - lstRole.setVisible(true); + lstRole.setEnabled(false); + } else { + lstRole.setEnabled(true); } } setUserID(); @@ -481,33 +488,22 @@ public class RolePanel extends Window implements EventListener, Deferrabl lstOrganisation.setSelectedItem(ci); } - - // If we have only one org, we can hide combo-box at login - logilite - if (lstOrganisation.getItemCount() <= 1) - { - lstOrganisation.setSelectedIndex(0); - lstOrganisation.setVisible(false); - lblOrganisation.setVisible(false); - } - else - { - lstOrganisation.setVisible(true); - lblOrganisation.setVisible(true); - } - if (lstOrganisation.getSelectedIndex() == -1 && lstOrganisation.getItemCount() > 0) { m_show = true; // didn't find default organisation lstOrganisation.setSelectedIndex(0); } } + + // If we have only one org, we can make readonly the combobox + if (lstOrganisation.getItemCount() == 1) + { + lstOrganisation.setSelectedIndex(0); + lstOrganisation.setEnabled(false); + } else { + lstOrganisation.setEnabled(true); + } // } - else - { - lstOrganisation.setVisible(false); - lblOrganisation.setVisible(false); - } - updateWarehouseList(); } @@ -537,37 +533,13 @@ public class RolePanel extends Window implements EventListener, Deferrabl if(warehouseKNPairs[i].getID().equals(initDefault)) lstWarehouse.setSelectedItem(ci); } - - // we can hide ware house combo-box on selection of org - if (lstWarehouse.getItemCount() <= 1) - { - lstWarehouse.setSelectedIndex(0); - lstWarehouse.setVisible(false); - lblWarehouse.setVisible(false); - } - else - { - lstWarehouse.setVisible(true); - lblWarehouse.setVisible(true); - } - if (lstWarehouse.getSelectedIndex() == -1 && lstWarehouse.getItemCount() > 0) { m_show = true; // didn't find default warehouse lstWarehouse.setSelectedIndex(0); } } - else - { - lstWarehouse.setVisible(false); - lblWarehouse.setVisible(false); - } // } - else - { - lstWarehouse.setVisible(false); - lblWarehouse.setVisible(false); - } } public void onEvent(Event event)