From eb3db56364abc68955878c49cf0a57ebbff64410 Mon Sep 17 00:00:00 2001 From: gsjeffen <58989269+gsjeffen@users.noreply.github.com> Date: Tue, 12 Oct 2021 03:27:26 +0200 Subject: [PATCH] IDEMPIERE-4863 Enable save column width in WListBox (#883) * IDEMPIERE-4863-1 Enable save column width in WListBox This PR is the base for implementing save of column width of a wlistbox in forms and windows. * IDEMPIERE-4863-1 Enable save column width in WListBox implementation example This commit is showing examples implementation of this PR, it is for infoProductWindow and infoWindow --- .../oracle/202110081200_IDEMPIERE-4863.sql | 120 +++++++++++++ .../202110081200_IDEMPIERE-4863.sql | 118 +++++++++++++ .../model/MWlistboxCustomization.java | 153 ++++++++++++++++ .../model/I_AD_Wlistbox_Customization.java | 160 +++++++++++++++++ .../model/X_AD_Wlistbox_Customization.java | 166 ++++++++++++++++++ .../adempiere/webui/component/WListbox.java | 124 ++++++++++++- .../webui/info/InfoProductWindow.java | 100 ++++++----- .../org/adempiere/webui/panel/InfoPanel.java | 25 ++- .../src/org/compiere/minigrid/ColumnInfo.java | 13 ++ 9 files changed, 929 insertions(+), 50 deletions(-) create mode 100644 migration/i8.2z/oracle/202110081200_IDEMPIERE-4863.sql create mode 100644 migration/i8.2z/postgresql/202110081200_IDEMPIERE-4863.sql create mode 100644 org.adempiere.base/src/org/adempiere/model/MWlistboxCustomization.java create mode 100644 org.adempiere.base/src/org/compiere/model/I_AD_Wlistbox_Customization.java create mode 100644 org.adempiere.base/src/org/compiere/model/X_AD_Wlistbox_Customization.java diff --git a/migration/i8.2z/oracle/202110081200_IDEMPIERE-4863.sql b/migration/i8.2z/oracle/202110081200_IDEMPIERE-4863.sql new file mode 100644 index 0000000000..bf2fcc53bf --- /dev/null +++ b/migration/i8.2z/oracle/202110081200_IDEMPIERE-4863.sql @@ -0,0 +1,120 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF +-- IDEMPIERE-4863 Enable save column width in WListBox +-- Jul 3, 2021, 11:06:24 PM CEST +INSERT INTO AD_Table (AD_Table_ID,Name,TableName,LoadSeq,AccessLevel,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsSecurityEnabled,IsDeleteable,IsHighVolume,IsView,EntityType,ImportTable,IsChangeLog,ReplicationType,CopyColumnsFromTable,IsCentrallyMaintained,AD_Table_UU,Processing,DatabaseViewDrop,CopyComponentsFromView,CreateWindowFromTable) VALUES (200279,'Customization of the Wlistbox','AD_Wlistbox_Customization',0,'4',0,0,'Y',TO_DATE('2021-07-03 23:06:23','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-07-03 23:06:23','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','N','N','D','N','Y','L','N','Y','ecb85e34-2b9f-4265-9dbd-5c4ae7a83641','N','N','N','N') +; + +-- Jul 3, 2021, 11:06:24 PM CEST +INSERT INTO AD_Sequence (Name,CurrentNext,IsAudited,StartNewYear,Description,IsActive,IsTableID,AD_Client_ID,AD_Org_ID,Created,CreatedBy,Updated,UpdatedBy,AD_Sequence_ID,IsAutoSequence,StartNo,IncrementNo,CurrentNextSys,AD_Sequence_UU) VALUES ('AD_Wlistbox_Customization',1000000,'N','N','Table AD_Wlistbox_Customization','Y','Y',0,0,TO_DATE('2021-07-03 23:06:24','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-07-03 23:06:24','YYYY-MM-DD HH24:MI:SS'),100,200348,'Y',1000000,1,200000,'f74ad7f0-fac9-4681-8dcd-dd957cec31cb') +; + +-- Jul 3, 2021, 11:07:57 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,AD_Val_Rule_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton,FKConstraintType) VALUES (214533,0.0,'Client','Client/Tenant for this installation.','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.',200279,129,'AD_Client_ID','@#AD_Client_ID@',10,'N','N','Y','N','N','N',19,0,0,'Y',TO_DATE('2021-07-03 23:07:57','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-07-03 23:07:57','YYYY-MM-DD HH24:MI:SS'),100,102,'N','N','D','N','c14eacf4-83b4-4687-aaab-37fdba6279e1','N','D') +; + +-- Jul 3, 2021, 11:07:58 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,AD_Val_Rule_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton,FKConstraintType) VALUES (214534,0.0,'Organization','Organizational entity within client','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.',200279,104,'AD_Org_ID','@#AD_Org_ID@',10,'N','N','Y','N','N','N',19,0,0,'Y',TO_DATE('2021-07-03 23:07:57','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-07-03 23:07:57','YYYY-MM-DD HH24:MI:SS'),100,113,'N','N','D','N','badb2479-a81f-4014-a10f-b886de27440f','N','D') +; + +-- Jul 3, 2021, 11:07:58 PM CEST +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203521,0,0,'Y',TO_DATE('2021-07-03 23:07:58','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-07-03 23:07:58','YYYY-MM-DD HH24:MI:SS'),100,'AD_Wlistbox_Customization_ID','Customization of the Wlistbox','Customization of the Wlistbox','D','9e48b43a-5fac-4f10-b1f8-18ee6ce341c6') +; + +-- Jul 3, 2021, 11:07:58 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (214535,0.0,'Customization of the Wlistbox',200279,'AD_Wlistbox_Customization_ID',10,'Y','N','Y','N','N','N',13,0,0,'Y',TO_DATE('2021-07-03 23:07:58','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-07-03 23:07:58','YYYY-MM-DD HH24:MI:SS'),100,203521,'N','N','D','N','3c21f840-2cc9-4b68-96a3-3d21f0f61961','N') +; + +-- Jul 3, 2021, 11:07:59 PM CEST +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203522,0,0,'Y',TO_DATE('2021-07-03 23:07:58','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-07-03 23:07:58','YYYY-MM-DD HH24:MI:SS'),100,'WlistboxName','WlistboxName','WlistboxName','D','8cb159d1-d1e6-4b89-97cb-7eb04fa36f0d') +; + +-- Jul 3, 2021, 11:07:59 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (214536,0.0,'WlistboxName',200279,'WlistboxName',80,'N','N','Y','N','N','N',10,0,0,'Y',TO_DATE('2021-07-03 23:07:58','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-07-03 23:07:58','YYYY-MM-DD HH24:MI:SS'),100,203522,'Y','N','D','N','093a2a9a-f52c-4812-aa2d-65abacc2460b','N') +; + +-- Jul 3, 2021, 11:07:59 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (214537,0.0,'User/Contact','User within the system - Internal or Business Partner Contact','The User identifies a unique user in the system. This could be an internal user or a business partner contact',200279,'AD_User_ID',10,'N','N','Y','N','N','N',30,0,0,'Y',TO_DATE('2021-07-03 23:07:59','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-07-03 23:07:59','YYYY-MM-DD HH24:MI:SS'),100,138,'N','N','D','N','c807cc23-e699-4e9c-871e-ef75d40a10d0','N') +; + +-- Jul 3, 2021, 11:08:00 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (214538,0.0,'Created','Date this record was created','The Created field indicates the date that this record was created.',200279,'Created','SYSDATE',29,'N','N','Y','N','N','N',16,0,0,'Y',TO_DATE('2021-07-03 23:07:59','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-07-03 23:07:59','YYYY-MM-DD HH24:MI:SS'),100,245,'N','N','D','N','4182cb49-9352-44d1-9587-b20d86f07d4c','N') +; + +-- Jul 3, 2021, 11:08:00 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton,FKConstraintType) VALUES (214539,0.0,'Created By','User who created this records','The Created By field indicates the user who created this record.',200279,'CreatedBy',10,'N','N','Y','N','N','N',30,110,0,0,'Y',TO_DATE('2021-07-03 23:08:00','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-07-03 23:08:00','YYYY-MM-DD HH24:MI:SS'),100,246,'N','N','D','N','9334abbb-1604-4da6-b35a-5c5caf80f156','N','D') +; + +-- Jul 3, 2021, 11:08:00 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (214540,0.0,'Custom',200279,'Custom',2000,'N','N','Y','N','N','N',10,0,0,'Y',TO_DATE('2021-07-03 23:08:00','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-07-03 23:08:00','YYYY-MM-DD HH24:MI:SS'),100,200082,'Y','N','D','N','cc4aefa8-582d-49c3-91fa-28669cef8853','N') +; + +-- Jul 3, 2021, 11:08:01 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (214541,0.0,'Active','The record is active in the system','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.',200279,'IsActive','Y',1,'N','N','Y','N','N','N',20,0,0,'Y',TO_DATE('2021-07-03 23:08:00','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-07-03 23:08:00','YYYY-MM-DD HH24:MI:SS'),100,348,'Y','N','D','N','b15ddae4-9c92-4d3c-8eb5-81561fd11b6e','N') +; + +-- Jul 3, 2021, 11:08:01 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (214542,0.0,'Updated','Date this record was updated','The Updated field indicates the date that this record was updated.',200279,'Updated','SYSDATE',29,'N','N','Y','N','N','N',16,0,0,'Y',TO_DATE('2021-07-03 23:08:01','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-07-03 23:08:01','YYYY-MM-DD HH24:MI:SS'),100,607,'N','N','D','N','2269b1a5-728e-4405-b636-7d8cf415d9e4','N') +; + +-- Jul 3, 2021, 11:08:01 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton,FKConstraintType) VALUES (214543,0.0,'Updated By','User who updated this records','The Updated By field indicates the user who updated this record.',200279,'UpdatedBy',10,'N','N','Y','N','N','N',30,110,0,0,'Y',TO_DATE('2021-07-03 23:08:01','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-07-03 23:08:01','YYYY-MM-DD HH24:MI:SS'),100,608,'N','N','D','N','a1b4cbbb-41d5-4ebb-a9b9-14008fadc7d9','N','D') +; + +-- Jul 3, 2021, 11:08:01 PM CEST +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203523,0,0,'Y',TO_DATE('2021-07-03 23:08:01','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-07-03 23:08:01','YYYY-MM-DD HH24:MI:SS'),100,'AD_Wlistbox_Customization_UU','AD_Wlistbox_Customization_UU','AD_Wlistbox_Customization_UU','D','5f67b77c-08f9-4c20-9463-bedde0025842') +; + +-- Jul 3, 2021, 11:08:02 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (214544,0.0,'AD_Wlistbox_Customization_UU',200279,'AD_Wlistbox_Customization_UU',36,'N','N','N','N','N','N',10,0,0,'Y',TO_DATE('2021-07-03 23:08:01','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-07-03 23:08:01','YYYY-MM-DD HH24:MI:SS'),100,203523,'N','N','D','N','71dec96d-d4d6-4e4e-b6c9-3091a6784973','N') +; + +-- Table: AD_Wlistbox_Customization +-- Sep 27, 2021, 11:54:39 AM CEST +UPDATE AD_Column SET FKConstraintName='ADUser_ADWlistboxCustomization', FKConstraintType='N',Updated=TO_DATE('2021-09-27 11:54:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=214537 +; + +-- Sep 27, 2021, 11:54:39 AM CEST +CREATE TABLE AD_Wlistbox_Customization (AD_Client_ID NUMBER(10) NOT NULL, AD_Org_ID NUMBER(10) NOT NULL, AD_User_ID NUMBER(10) NOT NULL, AD_Wlistbox_Customization_ID NUMBER(10) NOT NULL, AD_Wlistbox_Customization_UU VARCHAR2(36 CHAR) DEFAULT NULL , Created DATE DEFAULT SYSDATE NOT NULL, CreatedBy NUMBER(10) NOT NULL, Custom VARCHAR2(2000 CHAR) NOT NULL, IsActive CHAR(1) DEFAULT 'Y' CHECK (IsActive IN ('Y','N')) NOT NULL, Updated DATE DEFAULT SYSDATE NOT NULL, UpdatedBy NUMBER(10) NOT NULL, WlistboxName VARCHAR2(80 CHAR) NOT NULL, CONSTRAINT AD_Wlistbox_Customization_Key PRIMARY KEY (AD_Wlistbox_Customization_ID), CONSTRAINT AD_Wlistbox_Customizationuuidx UNIQUE (AD_Wlistbox_Customization_UU)) +; + +-- Sep 27, 2021, 11:54:39 AM CEST +ALTER TABLE AD_Wlistbox_Customization ADD CONSTRAINT ADUser_ADWlistboxCustomization FOREIGN KEY (AD_User_ID) REFERENCES ad_user(ad_user_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Sep 27, 2021, 11:57:43 AM CEST +INSERT INTO AD_TableIndex (AD_Client_ID,AD_Org_ID,AD_TableIndex_ID,AD_TableIndex_UU,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,AD_Table_ID,IsCreateConstraint,IsUnique,Processing,TableIndexDrop,IsKey) VALUES (0,0,201090,'663c5e7b-9a1c-46c5-ab61-5a67c0605d17',TO_DATE('2021-09-27 11:57:43','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','ad_wlistbox_customization_uu_idx',TO_DATE('2021-09-27 11:57:43','YYYY-MM-DD HH24:MI:SS'),100,200279,'N','Y','N','N','N') +; + +-- Sep 27, 2021, 11:57:53 AM CEST +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201430,'7bfe450f-6651-4331-97f2-2c66a8699dd8',TO_DATE('2021-09-27 11:57:53','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_DATE('2021-09-27 11:57:53','YYYY-MM-DD HH24:MI:SS'),100,214544,201090,10) +; + +-- Sep 27, 2021, 11:58:00 AM CEST +CREATE UNIQUE INDEX ad_wlistbox_customization_uu_idx ON AD_Wlistbox_Customization (AD_Wlistbox_Customization_UU) +; + +-- Oct 8, 2021, 9:36:28 PM MYT +INSERT INTO AD_TableIndex (AD_Client_ID,AD_Org_ID,AD_TableIndex_ID,AD_TableIndex_UU,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,AD_Table_ID,IsCreateConstraint,IsUnique,Processing,TableIndexDrop,IsKey) VALUES (0,0,201095,'358b9fa7-8229-4076-b330-7914e9e46c22',TO_DATE('2021-10-08 21:36:27','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','ad_wlistbox_custom_name_idx',TO_DATE('2021-10-08 21:36:27','YYYY-MM-DD HH24:MI:SS'),100,200279,'N','Y','N','N','N') +; + +-- Oct 8, 2021, 9:36:42 PM MYT +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201439,'475230ad-650c-4430-b9d6-29deb6526bb1',TO_DATE('2021-10-08 21:36:41','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_DATE('2021-10-08 21:36:41','YYYY-MM-DD HH24:MI:SS'),100,214533,201095,10) +; + +-- Oct 8, 2021, 9:36:51 PM MYT +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201440,'0fd0469d-be21-4e00-a7a0-996013871f08',TO_DATE('2021-10-08 21:36:51','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_DATE('2021-10-08 21:36:51','YYYY-MM-DD HH24:MI:SS'),100,214537,201095,20) +; + +-- Oct 8, 2021, 9:37:11 PM MYT +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201441,'f705108e-a2cd-480e-8a84-8157537af6be',TO_DATE('2021-10-08 21:37:10','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_DATE('2021-10-08 21:37:10','YYYY-MM-DD HH24:MI:SS'),100,214536,201095,30) +; + +-- Oct 8, 2021, 9:37:22 PM MYT +CREATE UNIQUE INDEX ad_wlistbox_custom_name_idx ON AD_Wlistbox_Customization (AD_Client_ID,AD_User_ID,WlistboxName) +; + +SELECT register_migration_script('202110081200_IDEMPIERE-4863.sql') FROM dual; diff --git a/migration/i8.2z/postgresql/202110081200_IDEMPIERE-4863.sql b/migration/i8.2z/postgresql/202110081200_IDEMPIERE-4863.sql new file mode 100644 index 0000000000..06e18072c4 --- /dev/null +++ b/migration/i8.2z/postgresql/202110081200_IDEMPIERE-4863.sql @@ -0,0 +1,118 @@ +-- IDEMPIERE-4863 Enable save column width in WListBox +-- Jul 3, 2021, 11:06:24 PM CEST +INSERT INTO AD_Table (AD_Table_ID,Name,TableName,LoadSeq,AccessLevel,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsSecurityEnabled,IsDeleteable,IsHighVolume,IsView,EntityType,ImportTable,IsChangeLog,ReplicationType,CopyColumnsFromTable,IsCentrallyMaintained,AD_Table_UU,Processing,DatabaseViewDrop,CopyComponentsFromView,CreateWindowFromTable) VALUES (200279,'Customization of the Wlistbox','AD_Wlistbox_Customization',0,'4',0,0,'Y',TO_TIMESTAMP('2021-07-03 23:06:23','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-07-03 23:06:23','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','N','N','D','N','Y','L','N','Y','ecb85e34-2b9f-4265-9dbd-5c4ae7a83641','N','N','N','N') +; + +-- Jul 3, 2021, 11:06:24 PM CEST +INSERT INTO AD_Sequence (Name,CurrentNext,IsAudited,StartNewYear,Description,IsActive,IsTableID,AD_Client_ID,AD_Org_ID,Created,CreatedBy,Updated,UpdatedBy,AD_Sequence_ID,IsAutoSequence,StartNo,IncrementNo,CurrentNextSys,AD_Sequence_UU) VALUES ('AD_Wlistbox_Customization',1000000,'N','N','Table AD_Wlistbox_Customization','Y','Y',0,0,TO_TIMESTAMP('2021-07-03 23:06:24','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-07-03 23:06:24','YYYY-MM-DD HH24:MI:SS'),100,200348,'Y',1000000,1,200000,'f74ad7f0-fac9-4681-8dcd-dd957cec31cb') +; + +-- Jul 3, 2021, 11:07:57 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,AD_Val_Rule_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton,FKConstraintType) VALUES (214533,0.0,'Client','Client/Tenant for this installation.','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.',200279,129,'AD_Client_ID','@#AD_Client_ID@',10,'N','N','Y','N','N','N',19,0,0,'Y',TO_TIMESTAMP('2021-07-03 23:07:57','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-07-03 23:07:57','YYYY-MM-DD HH24:MI:SS'),100,102,'N','N','D','N','c14eacf4-83b4-4687-aaab-37fdba6279e1','N','D') +; + +-- Jul 3, 2021, 11:07:58 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,AD_Val_Rule_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton,FKConstraintType) VALUES (214534,0.0,'Organization','Organizational entity within client','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.',200279,104,'AD_Org_ID','@#AD_Org_ID@',10,'N','N','Y','N','N','N',19,0,0,'Y',TO_TIMESTAMP('2021-07-03 23:07:57','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-07-03 23:07:57','YYYY-MM-DD HH24:MI:SS'),100,113,'N','N','D','N','badb2479-a81f-4014-a10f-b886de27440f','N','D') +; + +-- Jul 3, 2021, 11:07:58 PM CEST +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203521,0,0,'Y',TO_TIMESTAMP('2021-07-03 23:07:58','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-07-03 23:07:58','YYYY-MM-DD HH24:MI:SS'),100,'AD_Wlistbox_Customization_ID','Customization of the Wlistbox','Customization of the Wlistbox','D','9e48b43a-5fac-4f10-b1f8-18ee6ce341c6') +; + +-- Jul 3, 2021, 11:07:58 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (214535,0.0,'Customization of the Wlistbox',200279,'AD_Wlistbox_Customization_ID',10,'Y','N','Y','N','N','N',13,0,0,'Y',TO_TIMESTAMP('2021-07-03 23:07:58','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-07-03 23:07:58','YYYY-MM-DD HH24:MI:SS'),100,203521,'N','N','D','N','3c21f840-2cc9-4b68-96a3-3d21f0f61961','N') +; + +-- Jul 3, 2021, 11:07:59 PM CEST +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203522,0,0,'Y',TO_TIMESTAMP('2021-07-03 23:07:58','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-07-03 23:07:58','YYYY-MM-DD HH24:MI:SS'),100,'WlistboxName','WlistboxName','WlistboxName','D','8cb159d1-d1e6-4b89-97cb-7eb04fa36f0d') +; + +-- Jul 3, 2021, 11:07:59 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (214536,0.0,'WlistboxName',200279,'WlistboxName',80,'N','N','Y','N','N','N',10,0,0,'Y',TO_TIMESTAMP('2021-07-03 23:07:58','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-07-03 23:07:58','YYYY-MM-DD HH24:MI:SS'),100,203522,'Y','N','D','N','093a2a9a-f52c-4812-aa2d-65abacc2460b','N') +; + +-- Jul 3, 2021, 11:07:59 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (214537,0.0,'User/Contact','User within the system - Internal or Business Partner Contact','The User identifies a unique user in the system. This could be an internal user or a business partner contact',200279,'AD_User_ID',10,'N','N','Y','N','N','N',30,0,0,'Y',TO_TIMESTAMP('2021-07-03 23:07:59','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-07-03 23:07:59','YYYY-MM-DD HH24:MI:SS'),100,138,'N','N','D','N','c807cc23-e699-4e9c-871e-ef75d40a10d0','N') +; + +-- Jul 3, 2021, 11:08:00 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (214538,0.0,'Created','Date this record was created','The Created field indicates the date that this record was created.',200279,'Created','SYSDATE',29,'N','N','Y','N','N','N',16,0,0,'Y',TO_TIMESTAMP('2021-07-03 23:07:59','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-07-03 23:07:59','YYYY-MM-DD HH24:MI:SS'),100,245,'N','N','D','N','4182cb49-9352-44d1-9587-b20d86f07d4c','N') +; + +-- Jul 3, 2021, 11:08:00 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton,FKConstraintType) VALUES (214539,0.0,'Created By','User who created this records','The Created By field indicates the user who created this record.',200279,'CreatedBy',10,'N','N','Y','N','N','N',30,110,0,0,'Y',TO_TIMESTAMP('2021-07-03 23:08:00','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-07-03 23:08:00','YYYY-MM-DD HH24:MI:SS'),100,246,'N','N','D','N','9334abbb-1604-4da6-b35a-5c5caf80f156','N','D') +; + +-- Jul 3, 2021, 11:08:00 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (214540,0.0,'Custom',200279,'Custom',2000,'N','N','Y','N','N','N',10,0,0,'Y',TO_TIMESTAMP('2021-07-03 23:08:00','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-07-03 23:08:00','YYYY-MM-DD HH24:MI:SS'),100,200082,'Y','N','D','N','cc4aefa8-582d-49c3-91fa-28669cef8853','N') +; + +-- Jul 3, 2021, 11:08:01 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (214541,0.0,'Active','The record is active in the system','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.',200279,'IsActive','Y',1,'N','N','Y','N','N','N',20,0,0,'Y',TO_TIMESTAMP('2021-07-03 23:08:00','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-07-03 23:08:00','YYYY-MM-DD HH24:MI:SS'),100,348,'Y','N','D','N','b15ddae4-9c92-4d3c-8eb5-81561fd11b6e','N') +; + +-- Jul 3, 2021, 11:08:01 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (214542,0.0,'Updated','Date this record was updated','The Updated field indicates the date that this record was updated.',200279,'Updated','SYSDATE',29,'N','N','Y','N','N','N',16,0,0,'Y',TO_TIMESTAMP('2021-07-03 23:08:01','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-07-03 23:08:01','YYYY-MM-DD HH24:MI:SS'),100,607,'N','N','D','N','2269b1a5-728e-4405-b636-7d8cf415d9e4','N') +; + +-- Jul 3, 2021, 11:08:01 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton,FKConstraintType) VALUES (214543,0.0,'Updated By','User who updated this records','The Updated By field indicates the user who updated this record.',200279,'UpdatedBy',10,'N','N','Y','N','N','N',30,110,0,0,'Y',TO_TIMESTAMP('2021-07-03 23:08:01','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-07-03 23:08:01','YYYY-MM-DD HH24:MI:SS'),100,608,'N','N','D','N','a1b4cbbb-41d5-4ebb-a9b9-14008fadc7d9','N','D') +; + +-- Jul 3, 2021, 11:08:01 PM CEST +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203523,0,0,'Y',TO_TIMESTAMP('2021-07-03 23:08:01','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-07-03 23:08:01','YYYY-MM-DD HH24:MI:SS'),100,'AD_Wlistbox_Customization_UU','AD_Wlistbox_Customization_UU','AD_Wlistbox_Customization_UU','D','5f67b77c-08f9-4c20-9463-bedde0025842') +; + +-- Jul 3, 2021, 11:08:02 PM CEST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsAlwaysUpdateable,AD_Column_UU,IsToolbarButton) VALUES (214544,0.0,'AD_Wlistbox_Customization_UU',200279,'AD_Wlistbox_Customization_UU',36,'N','N','N','N','N','N',10,0,0,'Y',TO_TIMESTAMP('2021-07-03 23:08:01','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-07-03 23:08:01','YYYY-MM-DD HH24:MI:SS'),100,203523,'N','N','D','N','71dec96d-d4d6-4e4e-b6c9-3091a6784973','N') +; + +-- Table: AD_Wlistbox_Customization +-- Sep 27, 2021, 11:54:39 AM CEST +UPDATE AD_Column SET FKConstraintName='ADUser_ADWlistboxCustomization', FKConstraintType='N',Updated=TO_TIMESTAMP('2021-09-27 11:54:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=214537 +; + +-- Sep 27, 2021, 11:54:39 AM CEST +CREATE TABLE AD_Wlistbox_Customization (AD_Client_ID NUMERIC(10) NOT NULL, AD_Org_ID NUMERIC(10) NOT NULL, AD_User_ID NUMERIC(10) NOT NULL, AD_Wlistbox_Customization_ID NUMERIC(10) NOT NULL, AD_Wlistbox_Customization_UU VARCHAR(36) DEFAULT NULL , Created TIMESTAMP DEFAULT statement_timestamp() NOT NULL, CreatedBy NUMERIC(10) NOT NULL, Custom VARCHAR(2000) NOT NULL, IsActive CHAR(1) DEFAULT 'Y' CHECK (IsActive IN ('Y','N')) NOT NULL, Updated TIMESTAMP DEFAULT statement_timestamp() NOT NULL, UpdatedBy NUMERIC(10) NOT NULL, WlistboxName VARCHAR(80) NOT NULL, CONSTRAINT AD_Wlistbox_Customization_Key PRIMARY KEY (AD_Wlistbox_Customization_ID), CONSTRAINT AD_Wlistbox_Customizationuuidx UNIQUE (AD_Wlistbox_Customization_UU)) +; + +-- Sep 27, 2021, 11:54:39 AM CEST +ALTER TABLE AD_Wlistbox_Customization ADD CONSTRAINT ADUser_ADWlistboxCustomization FOREIGN KEY (AD_User_ID) REFERENCES ad_user(ad_user_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Sep 27, 2021, 11:57:43 AM CEST +INSERT INTO AD_TableIndex (AD_Client_ID,AD_Org_ID,AD_TableIndex_ID,AD_TableIndex_UU,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,AD_Table_ID,IsCreateConstraint,IsUnique,Processing,TableIndexDrop,IsKey) VALUES (0,0,201090,'663c5e7b-9a1c-46c5-ab61-5a67c0605d17',TO_TIMESTAMP('2021-09-27 11:57:43','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','ad_wlistbox_customization_uu_idx',TO_TIMESTAMP('2021-09-27 11:57:43','YYYY-MM-DD HH24:MI:SS'),100,200279,'N','Y','N','N','N') +; + +-- Sep 27, 2021, 11:57:53 AM CEST +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201430,'7bfe450f-6651-4331-97f2-2c66a8699dd8',TO_TIMESTAMP('2021-09-27 11:57:53','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2021-09-27 11:57:53','YYYY-MM-DD HH24:MI:SS'),100,214544,201090,10) +; + +-- Sep 27, 2021, 11:58:00 AM CEST +CREATE UNIQUE INDEX ad_wlistbox_customization_uu_idx ON AD_Wlistbox_Customization (AD_Wlistbox_Customization_UU) +; +-- IDEMPIERE-4863 Enable save column width in WListBox +-- Oct 8, 2021, 9:36:28 PM MYT +INSERT INTO AD_TableIndex (AD_Client_ID,AD_Org_ID,AD_TableIndex_ID,AD_TableIndex_UU,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,AD_Table_ID,IsCreateConstraint,IsUnique,Processing,TableIndexDrop,IsKey) VALUES (0,0,201095,'358b9fa7-8229-4076-b330-7914e9e46c22',TO_TIMESTAMP('2021-10-08 21:36:27','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','ad_wlistbox_custom_name_idx',TO_TIMESTAMP('2021-10-08 21:36:27','YYYY-MM-DD HH24:MI:SS'),100,200279,'N','Y','N','N','N') +; + +-- Oct 8, 2021, 9:36:42 PM MYT +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201439,'475230ad-650c-4430-b9d6-29deb6526bb1',TO_TIMESTAMP('2021-10-08 21:36:41','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2021-10-08 21:36:41','YYYY-MM-DD HH24:MI:SS'),100,214533,201095,10) +; + +-- Oct 8, 2021, 9:36:51 PM MYT +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201440,'0fd0469d-be21-4e00-a7a0-996013871f08',TO_TIMESTAMP('2021-10-08 21:36:51','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2021-10-08 21:36:51','YYYY-MM-DD HH24:MI:SS'),100,214537,201095,20) +; + +-- Oct 8, 2021, 9:37:11 PM MYT +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201441,'f705108e-a2cd-480e-8a84-8157537af6be',TO_TIMESTAMP('2021-10-08 21:37:10','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2021-10-08 21:37:10','YYYY-MM-DD HH24:MI:SS'),100,214536,201095,30) +; + +-- Oct 8, 2021, 9:37:22 PM MYT +CREATE UNIQUE INDEX ad_wlistbox_custom_name_idx ON AD_Wlistbox_Customization (AD_Client_ID,AD_User_ID,WlistboxName) +; + +SELECT register_migration_script('202110081200_IDEMPIERE-4863.sql') FROM dual; diff --git a/org.adempiere.base/src/org/adempiere/model/MWlistboxCustomization.java b/org.adempiere.base/src/org/adempiere/model/MWlistboxCustomization.java new file mode 100644 index 0000000000..a3b842fa86 --- /dev/null +++ b/org.adempiere.base/src/org/adempiere/model/MWlistboxCustomization.java @@ -0,0 +1,153 @@ +/****************************************************************************** + * Product: iDempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. * + * 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. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.adempiere.model; + +import java.sql.ResultSet; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Properties; + +import org.compiere.model.Query; +import org.compiere.model.X_AD_Wlistbox_Customization; + +public class MWlistboxCustomization extends X_AD_Wlistbox_Customization { + + /** + * + */ + private static final long serialVersionUID = -3220641197739038436L; + + /** + * @param ctx + * @param AD_WListboxName + * @param AD_Wlistbox_Customization_ID + * @param trxName + * @return + */ + public MWlistboxCustomization(Properties ctx, int AD_Wlistbox_Customization_ID, String trxName) { + super(ctx, AD_Wlistbox_Customization_ID, trxName); + } + + /** + * @param ctx + * @param rs + * @param trxName + * @return + */ + public MWlistboxCustomization(Properties ctx, ResultSet rs, String trxName) { + super(ctx, rs, trxName); + } + + /** + * @param ctx + * @param AD_User_ID + * @param AD_WListboxName + * @param trxName + * @return + */ + public static MWlistboxCustomization get(Properties ctx, + int AD_User_ID, + String AD_WListboxName, + String trxName) + { + Query query = new Query(ctx, Table_Name, "AD_User_ID=? AND WListboxName=?", trxName); + return query.setClient_ID().setOnlyActiveRecords(true).setParameters(new Object[] { AD_User_ID, AD_WListboxName}).first(); + } + + + private static List cleanCustomization (String[] CustomizationNew) + { + for (int i = 0; i < CustomizationNew.length; i++ ) + { + CustomizationNew[i] = CustomizationNew[i].substring(0, CustomizationNew[i].indexOf("=") ); + } + return Arrays.asList(CustomizationNew); + } + + private static int columnIndex(String searchColumnName, + List columnList) + { + for (int i = 0; i < columnList.size(); i++) + { + if (columnList.get(i).equals(searchColumnName)) + { + return i; + } + } + return -1; + } + + /** + * Save the columnWidth of the columns of the WListBox + * @param ctx + * @param AD_WListboxName + * @param AD_User_ID + * @param Custom + * @param trxName + * @return + */ + + public static void saveData(Properties ctx, + String AD_WListboxName, + int AD_User_ID, + String Custom, + String trxName) + { + MWlistboxCustomization WlistBoxCust = get(ctx, AD_User_ID, AD_WListboxName, trxName); + + if (WlistBoxCust != null && WlistBoxCust.getAD_Wlistbox_Customization_ID()> 0) + { + String[] custOrg = WlistBoxCust.getCustom().split(","); + List newColumnList = Arrays.asList(Custom.trim().split(",")); + ArrayList orgColumnList = new ArrayList<>( Arrays.asList(WlistBoxCust.getCustom().trim().split(",")) ); + //only run through this if the with has changed for a column + if (!orgColumnList.equals(newColumnList)) + { + List columnSearch = cleanCustomization (custOrg); + List addColumn = new ArrayList(); + + for (int i = 0; i < newColumnList.size(); i++) + { + String searchColumnName = newColumnList.get(i).substring(0,newColumnList.get(i).indexOf("=")); + int n = columnIndex(searchColumnName, columnSearch); + if(n > -1) + { + orgColumnList.set(n, newColumnList.get(i).stripLeading()); + } + else + { + addColumn.add(newColumnList.get(i).stripLeading()); + } + } + if (addColumn.size() > 0) + { + orgColumnList.addAll(addColumn); + } + WlistBoxCust.setCustom(orgColumnList.toString().substring(1, orgColumnList.toString().length() -1).replaceAll("\\s", "") ); + } + } + else + { + WlistBoxCust = new MWlistboxCustomization(ctx, 0, trxName); + WlistBoxCust.setWlistboxName(AD_WListboxName); + WlistBoxCust.setAD_User_ID(AD_User_ID); + WlistBoxCust.setCustom(Custom); + } + WlistBoxCust.saveEx(); + } // saveData +} diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_Wlistbox_Customization.java b/org.adempiere.base/src/org/compiere/model/I_AD_Wlistbox_Customization.java new file mode 100644 index 0000000000..4869ad98ac --- /dev/null +++ b/org.adempiere.base/src/org/compiere/model/I_AD_Wlistbox_Customization.java @@ -0,0 +1,160 @@ +/****************************************************************************** + * Product: iDempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. * + * 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. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.model; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import org.compiere.util.KeyNamePair; + +/** Generated Interface for AD_Wlistbox_Customization + * @author iDempiere (generated) + * @version Development 9.0 + */ +public interface I_AD_Wlistbox_Customization +{ + + /** TableName=AD_Wlistbox_Customization */ + public static final String Table_Name = "AD_Wlistbox_Customization"; + + /** AD_Table_ID=200279 */ + public static final int Table_ID = 200279; + + KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name); + + /** AccessLevel = 4 - System + */ + BigDecimal accessLevel = BigDecimal.valueOf(4); + + /** Load Meta Data */ + + /** Column name AD_Client_ID */ + public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID"; + + /** Get Client. + * Client/Tenant for this installation. + */ + public int getAD_Client_ID(); + + /** Column name AD_Org_ID */ + public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID"; + + /** Set Organization. + * Organizational entity within client + */ + public void setAD_Org_ID (int AD_Org_ID); + + /** Get Organization. + * Organizational entity within client + */ + public int getAD_Org_ID(); + + /** Column name AD_User_ID */ + public static final String COLUMNNAME_AD_User_ID = "AD_User_ID"; + + /** Set User/Contact. + * User within the system - Internal or Business Partner Contact + */ + public void setAD_User_ID (int AD_User_ID); + + /** Get User/Contact. + * User within the system - Internal or Business Partner Contact + */ + public int getAD_User_ID(); + + public org.compiere.model.I_AD_User getAD_User() throws RuntimeException; + + /** Column name AD_Wlistbox_Customization_ID */ + public static final String COLUMNNAME_AD_Wlistbox_Customization_ID = "AD_Wlistbox_Customization_ID"; + + /** Set Customization of the Wlistbox */ + public void setAD_Wlistbox_Customization_ID (int AD_Wlistbox_Customization_ID); + + /** Get Customization of the Wlistbox */ + public int getAD_Wlistbox_Customization_ID(); + + /** Column name AD_Wlistbox_Customization_UU */ + public static final String COLUMNNAME_AD_Wlistbox_Customization_UU = "AD_Wlistbox_Customization_UU"; + + /** Set AD_Wlistbox_Customization_UU */ + public void setAD_Wlistbox_Customization_UU (String AD_Wlistbox_Customization_UU); + + /** Get AD_Wlistbox_Customization_UU */ + public String getAD_Wlistbox_Customization_UU(); + + /** Column name Created */ + public static final String COLUMNNAME_Created = "Created"; + + /** Get Created. + * Date this record was created + */ + public Timestamp getCreated(); + + /** Column name CreatedBy */ + public static final String COLUMNNAME_CreatedBy = "CreatedBy"; + + /** Get Created By. + * User who created this records + */ + public int getCreatedBy(); + + /** Column name Custom */ + public static final String COLUMNNAME_Custom = "Custom"; + + /** Set Custom */ + public void setCustom (String Custom); + + /** Get Custom */ + public String getCustom(); + + /** Column name IsActive */ + public static final String COLUMNNAME_IsActive = "IsActive"; + + /** Set Active. + * The record is active in the system + */ + public void setIsActive (boolean IsActive); + + /** Get Active. + * The record is active in the system + */ + public boolean isActive(); + + /** Column name Updated */ + public static final String COLUMNNAME_Updated = "Updated"; + + /** Get Updated. + * Date this record was updated + */ + public Timestamp getUpdated(); + + /** Column name UpdatedBy */ + public static final String COLUMNNAME_UpdatedBy = "UpdatedBy"; + + /** Get Updated By. + * User who updated this records + */ + public int getUpdatedBy(); + + /** Column name WlistboxName */ + public static final String COLUMNNAME_WlistboxName = "WlistboxName"; + + /** Set WlistboxName */ + public void setWlistboxName (String WlistboxName); + + /** Get WlistboxName */ + public String getWlistboxName(); +} diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_Wlistbox_Customization.java b/org.adempiere.base/src/org/compiere/model/X_AD_Wlistbox_Customization.java new file mode 100644 index 0000000000..75a1146b3b --- /dev/null +++ b/org.adempiere.base/src/org/compiere/model/X_AD_Wlistbox_Customization.java @@ -0,0 +1,166 @@ +/****************************************************************************** + * Product: iDempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. * + * 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. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +/** Generated Model - DO NOT CHANGE */ +package org.compiere.model; + +import java.sql.ResultSet; +import java.util.Properties; + +/** Generated Model for AD_Wlistbox_Customization + * @author iDempiere (generated) + * @version Development 9.0 - $Id$ */ +@org.adempiere.base.Model(table="AD_Wlistbox_Customization") +public class X_AD_Wlistbox_Customization extends PO implements I_AD_Wlistbox_Customization, I_Persistent +{ + + /** + * + */ + private static final long serialVersionUID = 20210927L; + + /** Standard Constructor */ + public X_AD_Wlistbox_Customization (Properties ctx, int AD_Wlistbox_Customization_ID, String trxName) + { + super (ctx, AD_Wlistbox_Customization_ID, trxName); + /** if (AD_Wlistbox_Customization_ID == 0) + { + setAD_User_ID (0); + setAD_Wlistbox_Customization_ID (0); + setCustom (null); + setWlistboxName (null); + } */ + } + + /** Load Constructor */ + public X_AD_Wlistbox_Customization (Properties ctx, ResultSet rs, String trxName) + { + super (ctx, rs, trxName); + } + + /** AccessLevel + * @return 4 - System + */ + protected int get_AccessLevel() + { + return accessLevel.intValue(); + } + + /** Load Meta Data */ + protected POInfo initPO (Properties ctx) + { + POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName()); + return poi; + } + + public String toString() + { + StringBuilder sb = new StringBuilder ("X_AD_Wlistbox_Customization[") + .append(get_ID()).append("]"); + return sb.toString(); + } + + public org.compiere.model.I_AD_User getAD_User() throws RuntimeException + { + return (org.compiere.model.I_AD_User)MTable.get(getCtx(), org.compiere.model.I_AD_User.Table_ID) + .getPO(getAD_User_ID(), get_TrxName()); + } + + /** Set User/Contact. + @param AD_User_ID + User within the system - Internal or Business Partner Contact + */ + public void setAD_User_ID (int AD_User_ID) + { + if (AD_User_ID < 1) + set_ValueNoCheck (COLUMNNAME_AD_User_ID, null); + else + set_ValueNoCheck (COLUMNNAME_AD_User_ID, Integer.valueOf(AD_User_ID)); + } + + /** Get User/Contact. + @return User within the system - Internal or Business Partner Contact + */ + public int getAD_User_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Customization of the Wlistbox. + @param AD_Wlistbox_Customization_ID Customization of the Wlistbox */ + public void setAD_Wlistbox_Customization_ID (int AD_Wlistbox_Customization_ID) + { + if (AD_Wlistbox_Customization_ID < 1) + set_ValueNoCheck (COLUMNNAME_AD_Wlistbox_Customization_ID, null); + else + set_ValueNoCheck (COLUMNNAME_AD_Wlistbox_Customization_ID, Integer.valueOf(AD_Wlistbox_Customization_ID)); + } + + /** Get Customization of the Wlistbox. + @return Customization of the Wlistbox */ + public int getAD_Wlistbox_Customization_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_Wlistbox_Customization_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set AD_Wlistbox_Customization_UU. + @param AD_Wlistbox_Customization_UU AD_Wlistbox_Customization_UU */ + public void setAD_Wlistbox_Customization_UU (String AD_Wlistbox_Customization_UU) + { + set_ValueNoCheck (COLUMNNAME_AD_Wlistbox_Customization_UU, AD_Wlistbox_Customization_UU); + } + + /** Get AD_Wlistbox_Customization_UU. + @return AD_Wlistbox_Customization_UU */ + public String getAD_Wlistbox_Customization_UU () + { + return (String)get_Value(COLUMNNAME_AD_Wlistbox_Customization_UU); + } + + /** Set Custom. + @param Custom Custom */ + public void setCustom (String Custom) + { + set_Value (COLUMNNAME_Custom, Custom); + } + + /** Get Custom. + @return Custom */ + public String getCustom () + { + return (String)get_Value(COLUMNNAME_Custom); + } + + /** Set WlistboxName. + @param WlistboxName WlistboxName */ + public void setWlistboxName (String WlistboxName) + { + set_Value (COLUMNNAME_WlistboxName, WlistboxName); + } + + /** Get WlistboxName. + @return WlistboxName */ + public String getWlistboxName () + { + return (String)get_Value(COLUMNNAME_WlistboxName); + } +} diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListbox.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListbox.java index b700b15d5b..fba2103d5b 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListbox.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListbox.java @@ -22,14 +22,17 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.logging.Level; +import org.adempiere.model.MWlistboxCustomization; import org.adempiere.webui.event.TableValueChangeEvent; import org.adempiere.webui.event.TableValueChangeListener; import org.adempiere.webui.event.WTableModelEvent; import org.adempiere.webui.event.WTableModelListener; import org.adempiere.webui.exception.ApplicationException; +import org.adempiere.webui.util.ZKUpdateUtil; import org.compiere.minigrid.ColumnInfo; import org.compiere.minigrid.IDColumn; import org.compiere.minigrid.IMiniTable; @@ -40,6 +43,8 @@ import org.compiere.util.Env; import org.compiere.util.KeyNamePair; import org.compiere.util.Util; import org.zkoss.zul.ListModel; +import org.zkoss.zul.Listhead; +import org.zkoss.zul.Listheader; /** * Replacement for the Swing client minigrid component @@ -84,7 +89,8 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis // F3P: support IDColumn for selection private boolean allowIDColumnForReadWrite = false; - + //support for saving column width + private String wListBoxName = null; /** * Default constructor. * @@ -373,7 +379,8 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis String from, String where, boolean multiSelection, - String tableName,boolean addAccessSQL) + String tableName, + boolean addAccessSQL) { int columnIndex = 0; StringBuilder sql = new StringBuilder ("SELECT "); @@ -867,6 +874,21 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis return; } // setRowCount + /* + * Set the name of the wListbox. This is use to save the width of columns + * into ad_wlistbox_customization. + */ + public void setwListBoxName(String wListBoxName) { + this.wListBoxName = wListBoxName; + } + + /* + * Get the name of the wListbox + */ + public String getwListBoxName() { + return wListBoxName; + } + /** * Get Layout. * @@ -1085,6 +1107,7 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis { // create header (if needed) initialiseHeader(); + renderCustomHeaderWidth(); invalidate(); } @@ -1255,5 +1278,102 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis { this.allowIDColumnForReadWrite = allowIDColumnForReadWrite; } + + /** + * Retrieve the width of the column + * + * @param columnName the name of the column to find the width of. + * @param columnList list of the columns and their width + * @return the width of the column + */ + private String getColumnWidth(String columnName, ListcolumnList) + { + String width ="null"; + String[] w; + + for (String column : columnList) + { + w = column.trim().split("="); + if (w[0].equals(columnName)) + { + return w[1]; + } + } + return width; + } + + /** + * Render the header of the WListbox with the columns width of the saved column width + * + */ + public void renderCustomHeaderWidth () + { + if (wListBoxName != null && getListHead() != null) + { + MWlistboxCustomization WListBoxCustomization = MWlistboxCustomization.get(Env.getCtx(), Env.getAD_User_ID(Env.getCtx()), wListBoxName, null); + Boolean isHasCustomizeData = WListBoxCustomization != null && + WListBoxCustomization.getAD_Wlistbox_Customization_ID() > 0 && + WListBoxCustomization.getCustom() != null && + WListBoxCustomization.getCustom().trim().length() > 0; + if (isHasCustomizeData) + { + String[] custom = WListBoxCustomization.getCustom().trim().split(","); + ListcolumnList = Arrays.asList(custom); + ColumnInfo[] Columns = this.getLayout(); + Listhead listHead = getListhead(); + if (listHead != null && columnList.size() > 0) + { + List headers = listHead.getChildren(); + int i = 0; + for(Object obj : headers) + { + Listheader header = (Listheader) obj; + String columnWidth = this.getColumnWidth(Columns[i].getColumnName(), columnList); + if (!("null".equals(columnWidth))) + ZKUpdateUtil.setWidth(header, columnWidth); + i++; + } + } + } + } + } + + /** + * Save the width of all the columns in the WLsitbox + */ + public void saveColumnWidth() + { + if (!Util.isEmpty(getwListBoxName())) + { + StringBuilder custom = new StringBuilder(); + Listhead listHead = getListHead(); + ColumnInfo[] layout = getLayout(); + if (listHead != null && layout != null) + { + List headers = listHead.getChildren(); + int i = 0; + for(Object obj : headers) + { + Listheader header = (Listheader) obj; + String width = header.getWidth(); + String colName = layout[i].getColumnName(); + if (colName != null && !colName.isEmpty()) + { + custom.append (colName + "="); + if (width == null) + { + width = "null"; + } + custom.append(width); + custom.append(","); + } + i++; + } + if (custom.length() > 0) + custom.deleteCharAt(custom.length() - 1); + MWlistboxCustomization.saveData(Env.getCtx(), getwListBoxName(), Env.getAD_User_ID(Env.getCtx()), custom.toString(), null); + } + } + } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoProductWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoProductWindow.java index 3ee256a024..374b0f1669 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoProductWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoProductWindow.java @@ -174,10 +174,10 @@ public class InfoProductWindow extends InfoWindow { @Override protected void renderContentPane(Center center) { ColumnInfo[] s_layoutWarehouse = new ColumnInfo[]{ - new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "Warehouse", String.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "sum(QtyAvailable)", Double.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "sum(QtyOnHand)", Double.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "sum(QtyReserved)", Double.class)}; + new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "Warehouse", String.class, true, "Warehouse"), + new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "sum(QtyAvailable)", Double.class, true, "QtyAvailable"), + new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "sum(QtyOnHand)", Double.class, true, "QtyOnHand"), + new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "sum(QtyReserved)", Double.class, true, "QtyReserved")}; /** From Clause */ String s_sqlFrom = " M_PRODUCT_STOCK_V "; /** Where Clause */ @@ -188,77 +188,77 @@ public class InfoProductWindow extends InfoWindow { warehouseTbl.setMultiSelection(false); warehouseTbl.setShowTotals(true); warehouseTbl.autoSize(); + warehouseTbl.setwListBoxName("AD_InfoWindow_UU|"+ infoWindow.getAD_InfoWindow_UU() +"|stock"); // warehouseTbl.getModel().addTableModelListener(this); ColumnInfo[] s_layoutSubstitute = new ColumnInfo[]{ - new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class), - new ColumnInfo( - Msg.translate(Env.getCtx(), "Value"), + new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class, true, "orgname"), + new ColumnInfo(Msg.translate(Env.getCtx(), "Value"), "(Select Value from M_Product p where p.M_Product_ID=M_PRODUCT_SUBSTITUTERELATED_V.Substitute_ID)", - String.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "Name", String.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "PriceStd", Double.class)}; + String.class , true, "Value"), + new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "Name", String.class, true, "Name"), + new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class, true, "QtyAvailable"), + new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class, true, "QtyOnHand"), + new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class, true, "QtyReserved"), + new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "PriceStd", Double.class, true, "PriceStd")}; s_sqlFrom = "M_PRODUCT_SUBSTITUTERELATED_V"; s_sqlWhere = "M_Product_ID = ? AND M_PriceList_Version_ID = ? and RowType = 'S'"; substituteTbl = ListboxFactory.newDataTableAutoSize(); m_sqlSubstitute = substituteTbl.prepareTable(s_layoutSubstitute, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_SUBSTITUTERELATED_V"); substituteTbl.setMultiSelection(false); substituteTbl.autoSize(); + substituteTbl.setwListBoxName("AD_InfoWindow_UU|"+ infoWindow.getAD_InfoWindow_UU() + "|substitute"); // substituteTbl.getModel().addTableModelListener(this); ColumnInfo[] s_layoutRelated = new ColumnInfo[]{ - new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class), + new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class, true, "orgname"), new ColumnInfo( Msg.translate(Env.getCtx(), "Value"), "(Select Value from M_Product p where p.M_Product_ID=M_PRODUCT_SUBSTITUTERELATED_V.Substitute_ID)", - String.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "Name", String.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "PriceStd", Double.class)}; + String.class, true, "Value"), + new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "Name", String.class, true, "Name"), + new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class, true, "QtyAvailable"), + new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class, true, "QtyOnHand"), + new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class, true, "QtyReserved"), + new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "PriceStd", Double.class, true, "PriceStd")}; s_sqlFrom = "M_PRODUCT_SUBSTITUTERELATED_V"; s_sqlWhere = "M_Product_ID = ? AND M_PriceList_Version_ID = ? and RowType = 'R'"; relatedTbl = ListboxFactory.newDataTableAutoSize(); m_sqlRelated = relatedTbl.prepareTable(s_layoutRelated, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_SUBSTITUTERELATED_V"); relatedTbl.setMultiSelection(false); relatedTbl.autoSize(); - + relatedTbl.setwListBoxName("AD_InfoWindow_UU|"+ infoWindow.getAD_InfoWindow_UU() + "|related"); //Available to Promise Tab // Header - - ColumnInfo[] s_LayoutAtp = new ColumnInfo[]{ - new ColumnInfo(Msg.translate(Env.getCtx(), "Date"), "Date", Timestamp.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "C_BPartner_ID"), "C_BPartner_ID", String.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOrdered"), "QtyOrdered", Double.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "M_Locator_ID"), "M_Locator_ID", String.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "M_AttributeSetInstance_ID"), "M_AttributeSetInstance_ID", String.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "DocumentNo"), "DocumentNo", String.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "M_Warehouse_ID"), "M_Warehouse_ID", String.class) - }; + ColumnInfo[] s_LayoutAtp = new ColumnInfo[]{ + new ColumnInfo(Msg.translate(Env.getCtx(), "Date"), "Date", String.class, true, "Date"), + new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class, true, "QtyOnHand"), + new ColumnInfo(Msg.translate(Env.getCtx(), "C_BPartner_ID"), "C_BPartner_ID", Double.class, true, "C_BPartner_ID"), + new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOrdered"), "QtyOrdered", Double.class, true, "QtyOrdered"), + new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class, true, "QtyReserved"), + new ColumnInfo(Msg.translate(Env.getCtx(), "M_Locator_ID"), "M_Locator_ID", Double.class, true, "M_Locator_ID"), + new ColumnInfo(Msg.translate(Env.getCtx(), "M_AttributeSetInstance_ID"), "M_AttributeSetInstance_ID", Double.class, true, "M_AttributeSetInstance_ID"), + new ColumnInfo(Msg.translate(Env.getCtx(), "DocumentNo"), "DocumentNo", Double.class, true, "DocumentNo"), + new ColumnInfo(Msg.translate(Env.getCtx(), "M_Warehouse_ID"), "M_Warehouse_ID", Double.class, true, "M_Warehouse_ID")}; m_tableAtp = ListboxFactory.newDataTableAutoSize(); m_tableAtp.setMultiSelection(false); - m_tableAtp.prepareTable(s_LayoutAtp, "", "", false, ""); - + m_tableAtp.prepareTable(s_LayoutAtp, "M_Storage", null , false, "M_Storage"); + m_tableAtp.setwListBoxName("AD_InfoWindow_UU|" + infoWindow.getAD_InfoWindow_UU() +"|ATP"); + //IDEMPIERE-337 ArrayList list = new ArrayList(); - list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "PriceListVersion"), "plv.Name", String.class)); - list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "ValidFrom"), "plv.ValidFrom", Timestamp.class)); + list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "PriceListVersion"), "plv.Name", String.class, true, "PriceListVersion")); + list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "ValidFrom"), "plv.ValidFrom", Timestamp.class, true, "ValidFrom")); if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3027/*PriceList*/, false)) - list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "PriceList"), "bomPriceList(pp.M_Product_ID, pp.M_PriceList_Version_ID) AS PriceList", Double.class)); + list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "PriceList"), "bomPriceList(pp.M_Product_ID, pp.M_PriceList_Version_ID) AS PriceList", Double.class, true, "PriceList")); if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3028/*PriceStd*/, false)) - list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "bomPriceStd(pp.M_Product_ID, pp.M_PriceList_Version_ID) AS PriceStd", Double.class)); + list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "bomPriceStd(pp.M_Product_ID, pp.M_PriceList_Version_ID) AS PriceStd", Double.class, true, "PriceStd")); if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3028/*PriceStd*/, false) && MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3029/*PriceLimit*/, false)) - list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "Margin"), "bomPriceStd(pp.M_Product_ID, pp.M_PriceList_Version_ID)-bomPriceLimit(pp.M_Product_ID, pp.M_PriceList_Version_ID) AS Margin", Double.class)); + list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "Margin"), "bomPriceStd(pp.M_Product_ID, pp.M_PriceList_Version_ID)-bomPriceLimit(pp.M_Product_ID, pp.M_PriceList_Version_ID) AS Margin", Double.class, true, "Margin")); if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3029/*PriceLimit*/, false)) - list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "PriceLimit"), "bomPriceLimit(pp.M_Product_ID, pp.M_PriceList_Version_ID) AS PriceLimit", Double.class)); + list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "PriceLimit"), "bomPriceLimit(pp.M_Product_ID, pp.M_PriceList_Version_ID) AS PriceLimit", Double.class, true, "PriceLimit")); ColumnInfo[] s_layoutProductPrice = new ColumnInfo[list.size()]; list.toArray(s_layoutProductPrice); s_sqlFrom = "M_ProductPrice pp INNER JOIN M_PriceList_Version plv ON (pp.M_PriceList_Version_ID = plv.M_PriceList_Version_ID)"; @@ -267,6 +267,7 @@ public class InfoProductWindow extends InfoWindow { m_sqlProductprice = productpriceTbl.prepareTable(s_layoutProductPrice, s_sqlFrom, s_sqlWhere, false, "pp") + " ORDER BY plv.ValidFrom DESC"; productpriceTbl.setMultiSelection(false); productpriceTbl.autoSize(); + productpriceTbl.setwListBoxName("AD_InfoWindow_UU|" + infoWindow.getAD_InfoWindow_UU() + "|price"); // productpriceTbl.getModel().addTableModelListener(this); tabbedPane = new Tabbox(); @@ -822,11 +823,20 @@ public class InfoProductWindow extends InfoWindow { // Table ListModelTable model = new ListModelTable(data); - Vector columnNames = new Vector(); - m_tableAtp.setData(model, columnNames); - m_tableAtp.autoSize(); - } // initAtpTab + Vector columnNames = new Vector(); + columnNames.add(Msg.translate(Env.getCtx(), "Date")); + columnNames.add(Msg.translate(Env.getCtx(), "QtyOnHand")); + columnNames.add(Msg.translate(Env.getCtx(), "C_BPartner_ID")); + columnNames.add(Msg.translate(Env.getCtx(), "QtyOrdered")); + columnNames.add(Msg.translate(Env.getCtx(), "QtyReserved")); + columnNames.add(Msg.translate(Env.getCtx(), "M_Locator_ID")); + columnNames.add(Msg.translate(Env.getCtx(), "M_AttributeSetInstance_ID")); + columnNames.add(Msg.translate(Env.getCtx(), "DocumentNo")); + columnNames.add(Msg.translate(Env.getCtx(), "M_Warehouse_ID")); + m_tableAtp.setData(model, columnNames); + } // initAtpTab + public boolean isShowDetailATP() { return chbShowDetailAtp.isChecked(); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java index e8d92abb4a..1457ce8ba8 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java @@ -92,6 +92,7 @@ import org.compiere.util.Trx; import org.compiere.util.Util; import org.compiere.util.ValueNamePair; import org.zkoss.zk.au.out.AuEcho; +import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.Page; import org.zkoss.zk.ui.event.Event; @@ -618,6 +619,8 @@ public abstract class InfoPanel extends Window implements EventListener, String sql =contentPanel.prepareTable(layout, from, where,p_multipleSelection, getTableName(),false); + if (infoWindow != null) + contentPanel.setwListBoxName("AD_InfoWindow_UU|"+ infoWindow.getAD_InfoWindow_UU() ); p_layout = contentPanel.getLayout(); m_sqlMain = sql; m_sqlCount = "SELECT COUNT(*) FROM " + from + " WHERE " + where; @@ -637,6 +640,7 @@ public abstract class InfoPanel extends Window implements EventListener, */ protected void executeQuery() { + saveWlistBoxColumnWidth(this.getFirstChild()); line = new ArrayList(); setCacheStart(-1); cacheEnd = -1; @@ -897,6 +901,7 @@ public abstract class InfoPanel extends Window implements EventListener, model.addTableModelListener(this); model.setMultiple(p_multipleSelection); contentPanel.setData(model, null); + contentPanel.renderCustomHeaderWidth(); } autoHideEmptyColumns(); restoreSelectedInPage(); @@ -2637,7 +2642,6 @@ public abstract class InfoPanel extends Window implements EventListener, { if (log.isLoggable(Level.CONFIG)) log.config("OK=" + ok); m_ok = ok; - // End Worker if (isLookup()) { @@ -2649,6 +2653,18 @@ public abstract class InfoPanel extends Window implements EventListener, this.detach(); } // dispose + private void saveWlistBoxColumnWidth(Component comp){ + + if(comp instanceof WListbox){ + ((WListbox)comp).saveColumnWidth(); + } + + List list = comp.getChildren(); + for(Component child:list){ + saveWlistBoxColumnWidth(child); + } + } + public void sort(Comparator cmpr, boolean ascending) { updateListSelected(); WListItemRenderer.ColumnComparator lsc = (WListItemRenderer.ColumnComparator) cmpr; @@ -2749,7 +2765,11 @@ public abstract class InfoPanel extends Window implements EventListener, super.onPageDetached(page); try { SessionManager.getSessionApplication().getKeylistener().removeEventListener(Events.ON_CTRL_KEY, this); - } catch (Exception e){} + if (infoWindow != null && getFirstChild() != null) + saveWlistBoxColumnWidth(getFirstChild()); + } catch (Exception e){ + log.log(Level.WARNING, e.getMessage(), e); + } } /** @@ -2769,4 +2789,3 @@ public abstract class InfoPanel extends Window implements EventListener, return pageSize; } } // Info - diff --git a/org.adempiere.ui/src/org/compiere/minigrid/ColumnInfo.java b/org.adempiere.ui/src/org/compiere/minigrid/ColumnInfo.java index fc69e23db9..86fe245694 100644 --- a/org.adempiere.ui/src/org/compiere/minigrid/ColumnInfo.java +++ b/org.adempiere.ui/src/org/compiere/minigrid/ColumnInfo.java @@ -117,6 +117,19 @@ public class ColumnInfo setKeyPairColSQL(keyPairColSQL); } // ColumnInfo + /** + * Create Info Column + * + * @param colHeader Column Header + * @param colSQL SQL select code for column + * @param colClass class of column - determines display + * @param readOnly column is read only + * @param columnName Column Name + */ + public ColumnInfo (String colHeader, String colSQL, Class colClass, boolean readOnly, String columnName) + { + this(colHeader, colSQL, colClass, readOnly, false, null, columnName); + } // ColumnInfo private String m_colHeader; private String m_columnName;