From 8f758ed90449cb957c8906ceafc5466cd18fd716 Mon Sep 17 00:00:00 2001 From: hengsin Date: Sat, 24 Jul 2021 17:05:49 +0800 Subject: [PATCH] =?UTF-8?q?IDEMPIERE-1994=20Ability=20to=20organise=20proc?= =?UTF-8?q?ess=20and=20report=20parameters=20by=20F=E2=80=A6=20(#791)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * IDEMPIERE-1994 Ability to organise process and report parameters by Field Group functionality * IDEMPIERE-1994 Ability to organise process and report parameters by Field Group functionality Fix collapsed by default not working. --- .../oracle/202107230228_IDEMPIERE-1994.sql | 57 ++++++++++ .../202107230228_IDEMPIERE-1994.sql | 54 ++++++++++ .../src/org/compiere/model/GridFieldVO.java | 9 ++ .../org/compiere/model/I_AD_Process_Para.java | 15 +++ .../model/I_AD_UserDef_Proc_Parameter.java | 15 +++ .../org/compiere/model/X_AD_Process_Para.java | 30 +++++- .../model/X_AD_UserDef_Proc_Parameter.java | 38 ++++++- .../WEB-INF/src/metainfo/zk/lang-addon.xml | 2 +- .../webui/apps/ProcessParameterPanel.java | 100 ++++++++++++++++-- .../css/fragment/parameter-process.css.dsp | 6 ++ 10 files changed, 308 insertions(+), 18 deletions(-) create mode 100644 migration/i8.2z/oracle/202107230228_IDEMPIERE-1994.sql create mode 100644 migration/i8.2z/postgresql/202107230228_IDEMPIERE-1994.sql diff --git a/migration/i8.2z/oracle/202107230228_IDEMPIERE-1994.sql b/migration/i8.2z/oracle/202107230228_IDEMPIERE-1994.sql new file mode 100644 index 0000000000..b25dce84fa --- /dev/null +++ b/migration/i8.2z/oracle/202107230228_IDEMPIERE-1994.sql @@ -0,0 +1,57 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-1994 Ability to organise process and report parameters by Field Group functionality +INSERT INTO AD_Column (AD_Column_ID,SeqNoSelection,IsSyncDatabase,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,Updated,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,IsActive,CreatedBy,UpdatedBy,IsAlwaysUpdateable,AD_Client_ID,AD_Org_ID,Created,EntityType,IsEncrypted,IsSecure,FKConstraintType,AD_Element_ID,AD_Table_ID,AD_Reference_ID,IsToolbarButton) VALUES (213251,0,'N',0,'N','N','N',0,'N',22,'N','N','N','Y','3bcbe6d5-bc98-4fde-b930-f45c3fc2e870',TO_DATE('2017-09-20 16:53:48','YYYY-MM-DD HH24:MI:SS'),'Y','AD_FieldGroup_ID','Logical grouping of fields','The Field Group indicates the logical group that this field belongs to (History, Amounts, Quantities)','Field Group','Y','Y',100,100,'N',0,0,TO_DATE('2017-09-20 16:53:48','YYYY-MM-DD HH24:MI:SS'),'D','N','N','N',1500,285,19,'N') +; + +-- Sep 20, 2017 4:53:56 PM SGT +INSERT INTO AD_TreeNode (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNode_UU) SELECT t.AD_Client_ID, 0, 'Y', SysDate, 100, SysDate, 100,t.AD_Tree_ID, 200007, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='TL' AND t.AD_Table_ID=282 AND NOT EXISTS (SELECT * FROM AD_TreeNode e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200007) +; + +-- Sep 20, 2017 4:53:57 PM SGT +UPDATE AD_Column SET FKConstraintName='ADFieldGroup_ADProcessPara', FKConstraintType='N',Updated=TO_DATE('2017-09-20 16:53:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213251 +; + +-- Sep 20, 2017 4:53:57 PM SGT +ALTER TABLE AD_Process_Para ADD AD_FieldGroup_ID NUMBER(10) DEFAULT NULL +; + +-- Sep 20, 2017 4:53:58 PM SGT +ALTER TABLE AD_Process_Para ADD CONSTRAINT ADFieldGroup_ADProcessPara FOREIGN KEY (AD_FieldGroup_ID) REFERENCES ad_fieldgroup(ad_fieldgroup_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Sep 20, 2017 4:55:11 PM SGT +INSERT INTO AD_TreeNode (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNode_UU) SELECT t.AD_Client_ID, 0, 'Y', SysDate, 100, SysDate, 100,t.AD_Tree_ID, 200008, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='TL' AND t.AD_Table_ID=282 AND NOT EXISTS (SELECT * FROM AD_TreeNode e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200008) +; + +-- Sep 20, 2017 4:55:13 PM SGT +INSERT INTO AD_Field (AD_Field_ID,IsEncrypted,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,IsReadOnly,Help,AD_Org_ID,Updated,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,CreatedBy,UpdatedBy,IsActive,IsDisplayedGrid,SeqNoGrid,AD_Client_ID,Created,ColumnSpan,AD_Column_ID,EntityType,AD_Tab_ID) VALUES (205238,'N',22,'N','N',280,'Y','N','The Field Group indicates the logical group that this field belongs to (History, Amounts, Quantities)',0,TO_DATE('2017-09-20 16:55:12','YYYY-MM-DD HH24:MI:SS'),'Logical grouping of fields','Field Group','50a7d3df-4713-4f7e-b030-7256d0f14c0c','Y','N',100,100,'Y','Y',280,0,TO_DATE('2017-09-20 16:55:12','YYYY-MM-DD HH24:MI:SS'),2,213251,'D',246) +; + +-- Sep 20, 2017 4:56:16 PM SGT +UPDATE AD_Field SET SeqNo=125, AD_Val_Rule_ID=NULL, SeqNoGrid=135, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-09-20 16:56:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205238 +; + +-- Jul 23, 2021, 11:03:55 AM MYT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (214564,0,'Field Group','Logical grouping of fields','The Field Group indicates the logical group that this field belongs to (History, Amounts, Quantities)',200233,'AD_FieldGroup_ID',22,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_DATE('2021-07-23 11:03:54','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-07-23 11:03:54','YYYY-MM-DD HH24:MI:SS'),100,1500,'Y','N','D','N','N','N','Y','5ba627b6-8511-4f2e-82ba-d7fbf6a8a2fd','Y',0,'N','N','N','N') +; + +-- Jul 23, 2021, 11:04:09 AM MYT +UPDATE AD_Column SET FKConstraintName='ADFieldGroup_ADUserDefProcPara', FKConstraintType='N',Updated=TO_DATE('2021-07-23 11:04:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=214564 +; + +-- Jul 23, 2021, 11:04:09 AM MYT +ALTER TABLE AD_UserDef_Proc_Parameter ADD AD_FieldGroup_ID NUMBER(10) DEFAULT NULL +; + +-- Jul 23, 2021, 11:04:09 AM MYT +ALTER TABLE AD_UserDef_Proc_Parameter ADD CONSTRAINT ADFieldGroup_ADUserDefProcPara FOREIGN KEY (AD_FieldGroup_ID) REFERENCES ad_fieldgroup(ad_fieldgroup_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Jul 23, 2021, 11:05:29 AM MYT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (206734,'Field Group','Logical grouping of fields','The Field Group indicates the logical group that this field belongs to (History, Amounts, Quantities)',200235,214564,'Y',0,260,0,'N','N','N','N',0,0,'Y',TO_DATE('2021-07-23 11:05:28','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-07-23 11:05:28','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','6a5df652-cd30-4f11-aa94-a66f14379cdb','Y',260,1,2,1,'N','N','N','N') +; + +SELECT register_migration_script('202107230228_IDEMPIERE-1994.sql') FROM dual +; diff --git a/migration/i8.2z/postgresql/202107230228_IDEMPIERE-1994.sql b/migration/i8.2z/postgresql/202107230228_IDEMPIERE-1994.sql new file mode 100644 index 0000000000..b36afa8ccb --- /dev/null +++ b/migration/i8.2z/postgresql/202107230228_IDEMPIERE-1994.sql @@ -0,0 +1,54 @@ +-- IDEMPIERE-1994 Ability to organise process and report parameters by Field Group functionality +INSERT INTO AD_Column (AD_Column_ID,SeqNoSelection,IsSyncDatabase,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,Updated,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,IsActive,CreatedBy,UpdatedBy,IsAlwaysUpdateable,AD_Client_ID,AD_Org_ID,Created,EntityType,IsEncrypted,IsSecure,FKConstraintType,AD_Element_ID,AD_Table_ID,AD_Reference_ID,IsToolbarButton) VALUES (213251,0,'N',0,'N','N','N',0,'N',22,'N','N','N','Y','3bcbe6d5-bc98-4fde-b930-f45c3fc2e870',TO_TIMESTAMP('2017-09-20 16:53:48','YYYY-MM-DD HH24:MI:SS'),'Y','AD_FieldGroup_ID','Logical grouping of fields','The Field Group indicates the logical group that this field belongs to (History, Amounts, Quantities)','Field Group','Y','Y',100,100,'N',0,0,TO_TIMESTAMP('2017-09-20 16:53:48','YYYY-MM-DD HH24:MI:SS'),'D','N','N','N',1500,285,19,'N') +; + +-- Sep 20, 2017 4:53:56 PM SGT +INSERT INTO AD_TreeNode (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNode_UU) SELECT t.AD_Client_ID, 0, 'Y', statement_timestamp(), 100, statement_timestamp(), 100,t.AD_Tree_ID, 200007, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='TL' AND t.AD_Table_ID=282 AND NOT EXISTS (SELECT * FROM AD_TreeNode e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200007) +; + +-- Sep 20, 2017 4:53:57 PM SGT +UPDATE AD_Column SET FKConstraintName='ADFieldGroup_ADProcessPara', FKConstraintType='N',Updated=TO_TIMESTAMP('2017-09-20 16:53:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213251 +; + +-- Sep 20, 2017 4:53:57 PM SGT +ALTER TABLE AD_Process_Para ADD COLUMN AD_FieldGroup_ID NUMERIC(10) DEFAULT NULL +; + +-- Sep 20, 2017 4:53:58 PM SGT +ALTER TABLE AD_Process_Para ADD CONSTRAINT ADFieldGroup_ADProcessPara FOREIGN KEY (AD_FieldGroup_ID) REFERENCES ad_fieldgroup(ad_fieldgroup_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Sep 20, 2017 4:55:11 PM SGT +INSERT INTO AD_TreeNode (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNode_UU) SELECT t.AD_Client_ID, 0, 'Y', statement_timestamp(), 100, statement_timestamp(), 100,t.AD_Tree_ID, 200008, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='TL' AND t.AD_Table_ID=282 AND NOT EXISTS (SELECT * FROM AD_TreeNode e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200008) +; + +-- Sep 20, 2017 4:55:13 PM SGT +INSERT INTO AD_Field (AD_Field_ID,IsEncrypted,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,IsReadOnly,Help,AD_Org_ID,Updated,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,CreatedBy,UpdatedBy,IsActive,IsDisplayedGrid,SeqNoGrid,AD_Client_ID,Created,ColumnSpan,AD_Column_ID,EntityType,AD_Tab_ID) VALUES (205238,'N',22,'N','N',280,'Y','N','The Field Group indicates the logical group that this field belongs to (History, Amounts, Quantities)',0,TO_TIMESTAMP('2017-09-20 16:55:12','YYYY-MM-DD HH24:MI:SS'),'Logical grouping of fields','Field Group','50a7d3df-4713-4f7e-b030-7256d0f14c0c','Y','N',100,100,'Y','Y',280,0,TO_TIMESTAMP('2017-09-20 16:55:12','YYYY-MM-DD HH24:MI:SS'),2,213251,'D',246) +; + +-- Sep 20, 2017 4:56:16 PM SGT +UPDATE AD_Field SET SeqNo=125, AD_Val_Rule_ID=NULL, SeqNoGrid=135, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-09-20 16:56:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205238 +; + +-- Jul 23, 2021, 11:03:55 AM MYT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (214564,0,'Field Group','Logical grouping of fields','The Field Group indicates the logical group that this field belongs to (History, Amounts, Quantities)',200233,'AD_FieldGroup_ID',22,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_TIMESTAMP('2021-07-23 11:03:54','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-07-23 11:03:54','YYYY-MM-DD HH24:MI:SS'),100,1500,'Y','N','D','N','N','N','Y','5ba627b6-8511-4f2e-82ba-d7fbf6a8a2fd','Y',0,'N','N','N','N') +; + +-- Jul 23, 2021, 11:04:09 AM MYT +UPDATE AD_Column SET FKConstraintName='ADFieldGroup_ADUserDefProcPara', FKConstraintType='N',Updated=TO_TIMESTAMP('2021-07-23 11:04:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=214564 +; + +-- Jul 23, 2021, 11:04:09 AM MYT +ALTER TABLE AD_UserDef_Proc_Parameter ADD COLUMN AD_FieldGroup_ID NUMERIC(10) DEFAULT NULL +; + +-- Jul 23, 2021, 11:04:09 AM MYT +ALTER TABLE AD_UserDef_Proc_Parameter ADD CONSTRAINT ADFieldGroup_ADUserDefProcPara FOREIGN KEY (AD_FieldGroup_ID) REFERENCES ad_fieldgroup(ad_fieldgroup_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Jul 23, 2021, 11:05:29 AM MYT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (206734,'Field Group','Logical grouping of fields','The Field Group indicates the logical group that this field belongs to (History, Amounts, Quantities)',200235,214564,'Y',0,260,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2021-07-23 11:05:28','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-07-23 11:05:28','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','6a5df652-cd30-4f11-aa94-a66f14379cdb','Y',260,1,2,1,'N','N','N','N') +; + +SELECT register_migration_script('202107230228_IDEMPIERE-1994.sql') FROM dual +; diff --git a/org.adempiere.base/src/org/compiere/model/GridFieldVO.java b/org.adempiere.base/src/org/compiere/model/GridFieldVO.java index cc34f0985f..13f882b185 100644 --- a/org.adempiere.base/src/org/compiere/model/GridFieldVO.java +++ b/org.adempiere.base/src/org/compiere/model/GridFieldVO.java @@ -430,6 +430,10 @@ public class GridFieldVO implements Serializable, Cloneable vo.Placeholder = rs.getString("Placeholder"); vo.Placeholder2 = rs.getString("Placeholder2"); vo.IsAutocomplete = "Y".equals(rs.getString("IsAutoComplete")); + // + vo.FieldGroup = rs.getString("FieldGroup"); + vo.FieldGroupType = rs.getString("FieldGroupType"); + vo.IsCollapsedByDefault = "Y".equals(rs.getString("IsCollapsedByDefault")); } catch (SQLException e) { @@ -477,6 +481,11 @@ public class GridFieldVO implements Serializable, Cloneable vo.ValueMax = userDef.getValueMax(); if (userDef.getIsMandatory()!= null) vo.IsMandatory = "Y".equals(userDef.getIsMandatory()); + if (userDef.getAD_FieldGroup_ID() > 0) { + X_AD_FieldGroup fg = new X_AD_FieldGroup(Env.getCtx(), userDef.getAD_FieldGroup_ID(), null); + vo.FieldGroup = fg.get_Translation(X_AD_FieldGroup.COLUMNNAME_Name); + vo.FieldGroupType = fg.getFieldGroupType(); + } } } //fim devCoffee - 3858 diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_Process_Para.java b/org.adempiere.base/src/org/compiere/model/I_AD_Process_Para.java index 36c2320a09..3dae66be02 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_Process_Para.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_Process_Para.java @@ -64,6 +64,21 @@ public interface I_AD_Process_Para public org.compiere.model.I_AD_Element getAD_Element() throws RuntimeException; + /** Column name AD_FieldGroup_ID */ + public static final String COLUMNNAME_AD_FieldGroup_ID = "AD_FieldGroup_ID"; + + /** Set Field Group. + * Logical grouping of fields + */ + public void setAD_FieldGroup_ID (int AD_FieldGroup_ID); + + /** Get Field Group. + * Logical grouping of fields + */ + public int getAD_FieldGroup_ID(); + + public org.compiere.model.I_AD_FieldGroup getAD_FieldGroup() throws RuntimeException; + /** Column name AD_Org_ID */ public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID"; diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_UserDef_Proc_Parameter.java b/org.adempiere.base/src/org/compiere/model/I_AD_UserDef_Proc_Parameter.java index 354152e54d..8b562d4d92 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_UserDef_Proc_Parameter.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_UserDef_Proc_Parameter.java @@ -49,6 +49,21 @@ public interface I_AD_UserDef_Proc_Parameter */ public int getAD_Client_ID(); + /** Column name AD_FieldGroup_ID */ + public static final String COLUMNNAME_AD_FieldGroup_ID = "AD_FieldGroup_ID"; + + /** Set Field Group. + * Logical grouping of fields + */ + public void setAD_FieldGroup_ID (int AD_FieldGroup_ID); + + /** Get Field Group. + * Logical grouping of fields + */ + public int getAD_FieldGroup_ID(); + + public org.compiere.model.I_AD_FieldGroup getAD_FieldGroup() throws RuntimeException; + /** Column name AD_Org_ID */ public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID"; diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_Process_Para.java b/org.adempiere.base/src/org/compiere/model/X_AD_Process_Para.java index aaf473441b..749866a61a 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_Process_Para.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_Process_Para.java @@ -30,7 +30,7 @@ public class X_AD_Process_Para extends PO implements I_AD_Process_Para, I_Persis /** * */ - private static final long serialVersionUID = 20201220L; + private static final long serialVersionUID = 20210723L; /** Standard Constructor */ public X_AD_Process_Para (Properties ctx, int AD_Process_Para_ID, String trxName) @@ -115,6 +115,34 @@ public class X_AD_Process_Para extends PO implements I_AD_Process_Para, I_Persis return ii.intValue(); } + public org.compiere.model.I_AD_FieldGroup getAD_FieldGroup() throws RuntimeException + { + return (org.compiere.model.I_AD_FieldGroup)MTable.get(getCtx(), org.compiere.model.I_AD_FieldGroup.Table_Name) + .getPO(getAD_FieldGroup_ID(), get_TrxName()); } + + /** Set Field Group. + @param AD_FieldGroup_ID + Logical grouping of fields + */ + public void setAD_FieldGroup_ID (int AD_FieldGroup_ID) + { + if (AD_FieldGroup_ID < 1) + set_Value (COLUMNNAME_AD_FieldGroup_ID, null); + else + set_Value (COLUMNNAME_AD_FieldGroup_ID, Integer.valueOf(AD_FieldGroup_ID)); + } + + /** Get Field Group. + @return Logical grouping of fields + */ + public int getAD_FieldGroup_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_FieldGroup_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + public org.compiere.model.I_AD_Process getAD_Process() throws RuntimeException { return (org.compiere.model.I_AD_Process)MTable.get(getCtx(), org.compiere.model.I_AD_Process.Table_Name) diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_UserDef_Proc_Parameter.java b/org.adempiere.base/src/org/compiere/model/X_AD_UserDef_Proc_Parameter.java index 7bae45c242..3406550f4f 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_UserDef_Proc_Parameter.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_UserDef_Proc_Parameter.java @@ -30,7 +30,7 @@ public class X_AD_UserDef_Proc_Parameter extends PO implements I_AD_UserDef_Proc /** * */ - private static final long serialVersionUID = 20201220L; + private static final long serialVersionUID = 20210723L; /** Standard Constructor */ public X_AD_UserDef_Proc_Parameter (Properties ctx, int AD_UserDef_Proc_Parameter_ID, String trxName) @@ -72,6 +72,34 @@ public class X_AD_UserDef_Proc_Parameter extends PO implements I_AD_UserDef_Proc return sb.toString(); } + public org.compiere.model.I_AD_FieldGroup getAD_FieldGroup() throws RuntimeException + { + return (org.compiere.model.I_AD_FieldGroup)MTable.get(getCtx(), org.compiere.model.I_AD_FieldGroup.Table_Name) + .getPO(getAD_FieldGroup_ID(), get_TrxName()); } + + /** Set Field Group. + @param AD_FieldGroup_ID + Logical grouping of fields + */ + public void setAD_FieldGroup_ID (int AD_FieldGroup_ID) + { + if (AD_FieldGroup_ID < 1) + set_Value (COLUMNNAME_AD_FieldGroup_ID, null); + else + set_Value (COLUMNNAME_AD_FieldGroup_ID, Integer.valueOf(AD_FieldGroup_ID)); + } + + /** Get Field Group. + @return Logical grouping of fields + */ + public int getAD_FieldGroup_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_FieldGroup_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + public org.compiere.model.I_AD_Process_Para getAD_Process_Para() throws RuntimeException { return (org.compiere.model.I_AD_Process_Para)MTable.get(getCtx(), org.compiere.model.I_AD_Process_Para.Table_Name) @@ -333,10 +361,10 @@ public class X_AD_UserDef_Proc_Parameter extends PO implements I_AD_UserDef_Proc /** IsDisplayed AD_Reference_ID=319 */ public static final int ISDISPLAYED_AD_Reference_ID=319; - /** Yes = Y */ - public static final String ISDISPLAYED_Yes = "Y"; /** No = N */ public static final String ISDISPLAYED_No = "N"; + /** Yes = Y */ + public static final String ISDISPLAYED_Yes = "Y"; /** Set Displayed. @param IsDisplayed Determines, if this field is displayed @@ -357,10 +385,10 @@ public class X_AD_UserDef_Proc_Parameter extends PO implements I_AD_UserDef_Proc /** IsMandatory AD_Reference_ID=319 */ public static final int ISMANDATORY_AD_Reference_ID=319; - /** Yes = Y */ - public static final String ISMANDATORY_Yes = "Y"; /** No = N */ public static final String ISMANDATORY_No = "N"; + /** Yes = Y */ + public static final String ISMANDATORY_Yes = "Y"; /** Set Mandatory. @param IsMandatory Data entry is required in this column diff --git a/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml b/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml index e633968bee..48a31abfef 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml +++ b/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml @@ -56,5 +56,5 @@ Copyright (C) 2007 Ashley G Ramdass (ADempiere WebUI). - + diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessParameterPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessParameterPanel.java index 693318e84b..c27d983686 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessParameterPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessParameterPanel.java @@ -21,7 +21,9 @@ import java.sql.SQLException; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.logging.Level; import org.adempiere.webui.Extensions; @@ -31,6 +33,7 @@ import org.adempiere.webui.component.Columns; import org.adempiere.webui.component.EditorBox; import org.adempiere.webui.component.Grid; import org.adempiere.webui.component.GridFactory; +import org.adempiere.webui.component.Group; import org.adempiere.webui.component.NumberBox; import org.adempiere.webui.component.Panel; import org.adempiere.webui.component.Row; @@ -55,6 +58,7 @@ import org.compiere.model.MLookup; import org.compiere.model.MPInstance; import org.compiere.model.MPInstancePara; import org.compiere.model.MProcess; +import org.compiere.model.X_AD_FieldGroup; import org.compiere.process.ProcessInfo; import org.compiere.util.CLogger; import org.compiere.util.DB; @@ -67,8 +71,10 @@ import org.zkoss.zk.ui.HtmlBasedComponent; 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.Cell; import org.zkoss.zul.Div; import org.zkoss.zul.Label; +import org.zkoss.zul.Separator; import org.zkoss.zul.Space; import org.zkoss.zul.impl.InputElement; import org.zkoss.zul.impl.XulElement; @@ -126,7 +132,7 @@ public class ProcessParameterPanel extends Panel implements private int m_WindowNo; private ProcessInfo m_processInfo; // AD_Window of window below this dialog in case show parameter dialog panel - private int m_AD_Window_ID = 0; + private int m_AD_Window_ID = 0; // infoWindowID of infoWindow below this dialog in case call process from infoWindow private int m_InfoWindowID = 0; /** Logger */ @@ -141,6 +147,11 @@ public class ProcessParameterPanel extends Panel implements private ArrayList m_separators = new ArrayList(); // private Grid centerPanel = null; + private Map> fieldGroupContents = new HashMap>(); + private Map> fieldGroupHeaders = new HashMap>(); + private ArrayList rowList; + private List allCollapsibleGroups = new ArrayList(); + private Group currentGroup; /** * Dispose @@ -210,9 +221,11 @@ public class ProcessParameterPanel extends Panel implements + "p.DefaultValue, p.DefaultValue2, p.VFormat, p.ValueMin, p.ValueMax, " + "p.SeqNo, p.AD_Reference_Value_ID, vr.Code AS ValidationCode, " + "p.ReadOnlyLogic, p.DisplayLogic, p.IsEncrypted, NULL AS FormatPattern, p.MandatoryLogic, p.Placeholder, p.Placeholder2, p.isAutoComplete, " - + "'' AS ValidationCodeLookup " + + "'' AS ValidationCodeLookup, " + + "fg.Name AS FieldGroup, fg.FieldGroupType, fg.IsCollapsedByDefault " + "FROM AD_Process_Para p" + " LEFT OUTER JOIN AD_Val_Rule vr ON (p.AD_Val_Rule_ID=vr.AD_Val_Rule_ID) " + + " LEFT OUTER JOIN AD_FieldGroup fg ON (p.AD_FieldGroup_ID=fg.AD_FieldGroup_ID) " + "WHERE p.AD_Process_ID=?" // 1 + " AND p.IsActive='Y' " + ASPFilter + " ORDER BY SeqNo"; else @@ -222,10 +235,13 @@ public class ProcessParameterPanel extends Panel implements + "p.DefaultValue, p.DefaultValue2, p.VFormat, p.ValueMin, p.ValueMax, " + "p.SeqNo, p.AD_Reference_Value_ID, vr.Code AS ValidationCode, " + "p.ReadOnlyLogic, p.DisplayLogic, p.IsEncrypted, NULL AS FormatPattern,p.MandatoryLogic, t.Placeholder, t.Placeholder2, p.isAutoComplete, " - + "'' AS ValidationCodeLookup " + + "'' AS ValidationCodeLookup, " + + "fgt.Name AS FieldGroup, fg.FieldGroupType, fg.IsCollapsedByDefault " + "FROM AD_Process_Para p" + " INNER JOIN AD_Process_Para_Trl t ON (p.AD_Process_Para_ID=t.AD_Process_Para_ID)" + " LEFT OUTER JOIN AD_Val_Rule vr ON (p.AD_Val_Rule_ID=vr.AD_Val_Rule_ID) " + + " LEFT OUTER JOIN AD_FieldGroup fg ON (p.AD_FieldGroup_ID=fg.AD_FieldGroup_ID) " + + " LEFT OUTER JOIN AD_FieldGroup_Trl fgt ON (p.AD_FieldGroup_ID=fgt.AD_FieldGroup_ID AND fgt.AD_Language='" + Env.getAD_Language(Env.getCtx()) + "') " + "WHERE p.AD_Process_ID=?" // 1 + " AND t.AD_Language='" + Env.getAD_Language(Env.getCtx()) + "'" + " AND p.IsActive='Y' " + ASPFilter @@ -233,7 +249,9 @@ public class ProcessParameterPanel extends Panel implements // Create Fields boolean hasFields = false; + String currentFieldGroup = null; Rows rows = new Rows(); + Row row = new Row(); PreparedStatement pstmt = null; ResultSet rs = null; try { @@ -241,6 +259,7 @@ public class ProcessParameterPanel extends Panel implements pstmt.setInt(1, m_processInfo.getAD_Process_ID()); rs = pstmt.executeQuery(); ArrayList listVO = new ArrayList(); + ListtoCollapsed = new ArrayList(); while (rs.next()) { hasFields = true; @@ -252,9 +271,72 @@ public class ProcessParameterPanel extends Panel implements for (int i = 0; i < listVO.size(); i++) { - createField(listVO.get(i), rows); + GridFieldVO voF = listVO.get(i); + GridField field = new GridField(voF); + m_mFields.add(field); // add to Fields + + String fieldGroup = field.getFieldGroup(); + if (!Util.isEmpty(fieldGroup) && !fieldGroup.equals(currentFieldGroup)) // group changed + { + currentFieldGroup = fieldGroup; + + row.setGroup(currentGroup); + rows.appendChild(row); + if (rowList != null) + rowList.add(row); + + List headerRows = new ArrayList(); + fieldGroupHeaders.put(fieldGroup, headerRows); + + rowList = new ArrayList(); + fieldGroupContents.put(fieldGroup, rowList); + + if (X_AD_FieldGroup.FIELDGROUPTYPE_Label.equals(field.getFieldGroupType())) + { + row = new Row(); + Label groupLabel = new Label(fieldGroup); + row.appendCellChild(groupLabel, 3); + rows.appendChild(row); + headerRows.add(row); + + row = new Row(); + Separator separator = new Separator(); + separator.setBar(true); + row.appendCellChild(separator, 3); + rows.appendChild(row); + headerRows.add(row); + currentGroup = null; + } + else + { + Group rowg = new Group(fieldGroup); + Cell cell = (Cell) rowg.getFirstChild(); + cell.setSclass("z-group-inner"); + cell.setColspan(3); + + allCollapsibleGroups.add(rowg); + if (X_AD_FieldGroup.FIELDGROUPTYPE_Tab.equals(field.getFieldGroupType()) || field.getIsCollapsedByDefault()) + { + toCollapsed.add(rowg); + } + currentGroup = rowg; + rows.appendChild(rowg); + headerRows.add(rowg); + } + row = new Row(); + } + + row = new Row(); + createField(voF, field, row); + + row.setGroup(currentGroup); + rows.appendChild(row); + if (rowList != null) + rowList.add(row); if (log.isLoggable(Level.INFO)) log.info(listVO.get(i).ColumnName + listVO.get(i).SeqNo); } + if (toCollapsed.size() > 0) + toCollapsed.stream().forEach(g -> g.setOpen(false)); } catch (SQLException e) { log.log(Level.SEVERE, sql, e); @@ -289,13 +371,10 @@ public class ProcessParameterPanel extends Panel implements * used to retrieve the value (no data binding) * * @param voF GridFieldVO + * @param mField + * @param row */ - private void createField(GridFieldVO voF, Rows rows) { - GridField mField = new GridField(voF); - m_mFields.add(mField); // add to Fields - - Row row = new Row(); - + private void createField(GridFieldVO voF, GridField mField, Row row) { // The Editor WEditor editor = WebEditorFactory.getEditor(mField, false); editor.setProcessParameter(true); @@ -388,7 +467,6 @@ public class ProcessParameterPanel extends Panel implements m_wEditors2.add(null); m_separators.add(null); } - rows.appendChild(row); } // createField private void setEditorPlaceHolder(WEditor editor, String msg) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/web/theme/default/css/fragment/parameter-process.css.dsp b/org.adempiere.ui.zk/WEB-INF/src/web/theme/default/css/fragment/parameter-process.css.dsp index 554191925a..81a81cebd4 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/web/theme/default/css/fragment/parameter-process.css.dsp +++ b/org.adempiere.ui.zk/WEB-INF/src/web/theme/default/css/fragment/parameter-process.css.dsp @@ -85,15 +85,21 @@ when detect side effect, fix to only apply for parameter window*/ .input-paramenter-layout{ width: 70%; + margin-left: 5%; + margin-right: 25%; } @media screen and (max-width: 700px) { .input-paramenter-layout{ width: 90% !important; + margin-left: 2% !important; + margin-right: 8% !important; } } @media screen and (max-width: 500px) { .input-paramenter-layout{ width: 100% !important; + margin-left: 0 !important; + margin-right: 0 !important; } }