From 3fe9471960dbfad6cbf98fb0a9b9b4da1b3c258e Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 22 Nov 2013 16:18:39 -0500 Subject: [PATCH] IDEMPIERE-325 Complete AD based info window / Fix sync terminology failing to delete used elements in info column / add tab Use in Info Column to Element window --- .../oracle/201311221611_IDEMPIERE-325.sql | 23 +++++++++++++++++++ .../postgresql/201311221611_IDEMPIERE-325.sql | 20 ++++++++++++++++ .../oracle/02_SynchronizeTerminology.sql | 4 ++-- .../postgresql/02_SynchronizeTerminology.sql | 4 ++-- .../process/SynchronizeTerminology.java | 8 +++++-- 5 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 migration/i2.0/oracle/201311221611_IDEMPIERE-325.sql create mode 100644 migration/i2.0/postgresql/201311221611_IDEMPIERE-325.sql diff --git a/migration/i2.0/oracle/201311221611_IDEMPIERE-325.sql b/migration/i2.0/oracle/201311221611_IDEMPIERE-325.sql new file mode 100644 index 0000000000..b37fca5b85 --- /dev/null +++ b/migration/i2.0/oracle/201311221611_IDEMPIERE-325.sql @@ -0,0 +1,23 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Nov 22, 2013 3:55:16 PM COT +-- IDEMPIERE-325 Complete AD based info window +INSERT INTO AD_Tab (ImportFields,Processing,IsSingleRow,AD_Window_ID,SeqNo,IsTranslationTab,IsSortTab,AD_Table_ID,HasTree,IsInfoTab,IsReadOnly,AD_Column_ID,IsInsertRecord,IsAdvancedTab,TabLevel,AD_Tab_UU,EntityType,Name,AD_Tab_ID,AD_Org_ID,Created,CreatedBy,Updated,UpdatedBy,IsActive,AD_Client_ID) VALUES ('N','N','Y',151,50,'N','N',897,'N','N','Y',15790,'N','N',1,'9bad0b5e-9dc9-421f-9156-c6ee736f6f46','D','Used in Info Column',200113,0,TO_DATE('2013-11-22 15:55:06','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2013-11-22 15:55:06','YYYY-MM-DD HH24:MI:SS'),100,'Y',0) +; + +-- Nov 22, 2013 3:58:20 PM COT +INSERT INTO AD_Field (SortNo,IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,EntityType,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,ColumnSpan,NumLines,IsAdvancedField) VALUES (0,'N',200113,14,'N','N',15784,10,'Y',202536,'Y','The Info window is used to search and select records as well as display information relevant to the selection.','D','Info and search/select Window','Info Window','6ca76b42-60e2-42fd-b0da-d1139bcc2dbf','Y','N',100,0,TO_DATE('2013-11-22 15:58:11','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2013-11-22 15:58:11','YYYY-MM-DD HH24:MI:SS'),'Y','Y',10,1,'N',0,2,1,'N') +; + +-- Nov 22, 2013 4:00:15 PM COT +INSERT INTO AD_Field (SortNo,IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,AD_Reference_ID,EntityType,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,ColumnSpan,NumLines,IsAdvancedField) VALUES (0,'N',200113,10,'N','N',15773,20,'Y',202537,'Y','Column in the Info Window for display and/or selection. If used for selection, the column cannot be a SQL expression. The SQL clause must be fully qualified based on the FROM clause in the Info Window definition',19,'D','Info Window Column','Info Column','77dbd70f-6abb-4853-8d4d-f500e69d6bf6','Y','N',100,0,TO_DATE('2013-11-22 16:00:07','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2013-11-22 16:00:07','YYYY-MM-DD HH24:MI:SS'),'Y','Y',20,1,'N',0,2,1,'N') +; + +-- Nov 22, 2013 4:01:08 PM COT +INSERT INTO AD_Field (SortNo,IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,EntityType,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,ColumnSpan,NumLines,IsAdvancedField) VALUES (0,'N',200113,10,'N','N',208350,30,'Y',202538,'N','The Column Name indicates the name of a column on a table as defined in the database.','D','Name of the column in the database','DB Column Name','fbf25dc2-a23a-481b-8578-73d6e3ed4fcb','Y','N',100,0,TO_DATE('2013-11-22 16:01:00','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2013-11-22 16:01:00','YYYY-MM-DD HH24:MI:SS'),'Y','Y',30,4,'N',0,2,1,'N') +; + +SELECT register_migration_script('201311221611_IDEMPIERE-325.sql') FROM dual +; + diff --git a/migration/i2.0/postgresql/201311221611_IDEMPIERE-325.sql b/migration/i2.0/postgresql/201311221611_IDEMPIERE-325.sql new file mode 100644 index 0000000000..042027a224 --- /dev/null +++ b/migration/i2.0/postgresql/201311221611_IDEMPIERE-325.sql @@ -0,0 +1,20 @@ +-- Nov 22, 2013 3:55:16 PM COT +-- IDEMPIERE-325 Complete AD based info window +INSERT INTO AD_Tab (ImportFields,Processing,IsSingleRow,AD_Window_ID,SeqNo,IsTranslationTab,IsSortTab,AD_Table_ID,HasTree,IsInfoTab,IsReadOnly,AD_Column_ID,IsInsertRecord,IsAdvancedTab,TabLevel,AD_Tab_UU,EntityType,Name,AD_Tab_ID,AD_Org_ID,Created,CreatedBy,Updated,UpdatedBy,IsActive,AD_Client_ID) VALUES ('N','N','Y',151,50,'N','N',897,'N','N','Y',15790,'N','N',1,'9bad0b5e-9dc9-421f-9156-c6ee736f6f46','D','Used in Info Column',200113,0,TO_TIMESTAMP('2013-11-22 15:55:06','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2013-11-22 15:55:06','YYYY-MM-DD HH24:MI:SS'),100,'Y',0) +; + +-- Nov 22, 2013 3:58:20 PM COT +INSERT INTO AD_Field (SortNo,IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,EntityType,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,ColumnSpan,NumLines,IsAdvancedField) VALUES (0,'N',200113,14,'N','N',15784,10,'Y',202536,'Y','The Info window is used to search and select records as well as display information relevant to the selection.','D','Info and search/select Window','Info Window','6ca76b42-60e2-42fd-b0da-d1139bcc2dbf','Y','N',100,0,TO_TIMESTAMP('2013-11-22 15:58:11','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2013-11-22 15:58:11','YYYY-MM-DD HH24:MI:SS'),'Y','Y',10,1,'N',0,2,1,'N') +; + +-- Nov 22, 2013 4:00:15 PM COT +INSERT INTO AD_Field (SortNo,IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,AD_Reference_ID,EntityType,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,ColumnSpan,NumLines,IsAdvancedField) VALUES (0,'N',200113,10,'N','N',15773,20,'Y',202537,'Y','Column in the Info Window for display and/or selection. If used for selection, the column cannot be a SQL expression. The SQL clause must be fully qualified based on the FROM clause in the Info Window definition',19,'D','Info Window Column','Info Column','77dbd70f-6abb-4853-8d4d-f500e69d6bf6','Y','N',100,0,TO_TIMESTAMP('2013-11-22 16:00:07','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2013-11-22 16:00:07','YYYY-MM-DD HH24:MI:SS'),'Y','Y',20,1,'N',0,2,1,'N') +; + +-- Nov 22, 2013 4:01:08 PM COT +INSERT INTO AD_Field (SortNo,IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,EntityType,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,ColumnSpan,NumLines,IsAdvancedField) VALUES (0,'N',200113,10,'N','N',208350,30,'Y',202538,'N','The Column Name indicates the name of a column on a table as defined in the database.','D','Name of the column in the database','DB Column Name','fbf25dc2-a23a-481b-8578-73d6e3ed4fcb','Y','N',100,0,TO_TIMESTAMP('2013-11-22 16:01:00','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2013-11-22 16:01:00','YYYY-MM-DD HH24:MI:SS'),'Y','Y',30,4,'N',0,2,1,'N') +; + +SELECT register_migration_script('201311221611_IDEMPIERE-325.sql') FROM dual +; + diff --git a/migration/processes_post_migration/oracle/02_SynchronizeTerminology.sql b/migration/processes_post_migration/oracle/02_SynchronizeTerminology.sql index 94bc083d03..24650ecdae 100644 --- a/migration/processes_post_migration/oracle/02_SynchronizeTerminology.sql +++ b/migration/processes_post_migration/oracle/02_SynchronizeTerminology.sql @@ -6,10 +6,10 @@ INSERT INTO AD_ELEMENT_TRL (AD_Element_ID, AD_LANGUAGE, AD_Client_ID, AD_Org_ID, UPDATE AD_COLUMN c SET AD_Element_id = (SELECT AD_Element_ID FROM AD_ELEMENT e WHERE UPPER(c.ColumnName)=UPPER(e.ColumnName)) WHERE AD_Element_ID IS NULL ; -DELETE AD_ELEMENT_TRL WHERE AD_Element_ID >= 1000000 AND AD_Element_ID IN (SELECT AD_Element_ID FROM AD_ELEMENT e WHERE NOT EXISTS (SELECT 1 FROM AD_COLUMN c WHERE UPPER(e.ColumnName)=UPPER(c.ColumnName)) AND NOT EXISTS (SELECT 1 FROM AD_PROCESS_PARA p WHERE UPPER(e.ColumnName)=UPPER(p.ColumnName))) +DELETE AD_ELEMENT_TRL WHERE AD_Element_ID >= 1000000 AND AD_Element_ID IN (SELECT AD_Element_ID FROM AD_ELEMENT e WHERE NOT EXISTS (SELECT 1 FROM AD_COLUMN c WHERE UPPER(e.ColumnName)=UPPER(c.ColumnName)) AND NOT EXISTS (SELECT 1 FROM AD_PROCESS_PARA p WHERE UPPER(e.ColumnName)=UPPER(p.ColumnName)) AND NOT EXISTS (SELECT 1 FROM AD_INFOCOLUMN i WHERE UPPER(e.ColumnName)=UPPER(i.ColumnName))) ; -DELETE AD_ELEMENT e WHERE AD_Element_ID >= 1000000 AND NOT EXISTS (SELECT 1 FROM AD_COLUMN c WHERE UPPER(e.ColumnName)=UPPER(c.ColumnName)) AND NOT EXISTS (SELECT 1 FROM AD_PROCESS_PARA p WHERE UPPER(e.ColumnName)=UPPER(p.ColumnName)) +DELETE AD_ELEMENT e WHERE AD_Element_ID >= 1000000 AND NOT EXISTS (SELECT 1 FROM AD_COLUMN c WHERE UPPER(e.ColumnName)=UPPER(c.ColumnName)) AND NOT EXISTS (SELECT 1 FROM AD_PROCESS_PARA p WHERE UPPER(e.ColumnName)=UPPER(p.ColumnName)) AND NOT EXISTS (SELECT 1 FROM AD_INFOCOLUMN i WHERE UPPER(e.ColumnName)=UPPER(i.ColumnName)) ; UPDATE AD_COLUMN c SET (ColumnName, Name, Description, Help) = (SELECT ColumnName, Name, Description, Help FROM AD_ELEMENT e WHERE c.AD_Element_ID=e.AD_Element_ID), Updated = SYSDATE WHERE EXISTS (SELECT 1 FROM AD_ELEMENT e WHERE c.AD_Element_ID=e.AD_Element_ID AND (c.ColumnName <> e.ColumnName OR c.Name <> e.Name OR NVL(c.Description,' ') <> NVL(e.Description,' ') OR NVL(c.Help,' ') <> NVL(e.Help,' '))) diff --git a/migration/processes_post_migration/postgresql/02_SynchronizeTerminology.sql b/migration/processes_post_migration/postgresql/02_SynchronizeTerminology.sql index eb055b67f0..3f7436df17 100644 --- a/migration/processes_post_migration/postgresql/02_SynchronizeTerminology.sql +++ b/migration/processes_post_migration/postgresql/02_SynchronizeTerminology.sql @@ -6,10 +6,10 @@ INSERT INTO AD_ELEMENT_TRL (AD_Element_ID, AD_LANGUAGE, AD_Client_ID, AD_Org_ID, UPDATE AD_COLUMN SET AD_Element_id = (SELECT AD_Element_ID FROM AD_ELEMENT e WHERE UPPER(AD_COLUMN.ColumnName)=UPPER(e.ColumnName)) WHERE AD_Element_ID IS NULL ; -DELETE FROM AD_ELEMENT_TRL WHERE AD_Element_ID >= 1000000 AND AD_Element_ID IN (SELECT AD_Element_ID FROM AD_ELEMENT e WHERE NOT EXISTS (SELECT 1 FROM AD_COLUMN c WHERE UPPER(e.ColumnName)=UPPER(c.ColumnName)) AND NOT EXISTS (SELECT 1 FROM AD_PROCESS_PARA p WHERE UPPER(e.ColumnName)=UPPER(p.ColumnName))) +DELETE FROM AD_ELEMENT_TRL WHERE AD_Element_ID >= 1000000 AND AD_Element_ID IN (SELECT AD_Element_ID FROM AD_ELEMENT e WHERE NOT EXISTS (SELECT 1 FROM AD_COLUMN c WHERE UPPER(e.ColumnName)=UPPER(c.ColumnName)) AND NOT EXISTS (SELECT 1 FROM AD_PROCESS_PARA p WHERE UPPER(e.ColumnName)=UPPER(p.ColumnName)) AND NOT EXISTS (SELECT 1 FROM AD_INFOCOLUMN i WHERE UPPER(e.ColumnName)=UPPER(i.ColumnName))) ; -DELETE FROM AD_ELEMENT WHERE AD_Element_ID >= 1000000 AND NOT EXISTS (SELECT 1 FROM AD_COLUMN c WHERE UPPER(AD_ELEMENT.ColumnName)=UPPER(c.ColumnName)) AND NOT EXISTS (SELECT 1 FROM AD_PROCESS_PARA p WHERE UPPER(AD_ELEMENT.ColumnName)=UPPER(p.ColumnName)) +DELETE FROM AD_ELEMENT WHERE AD_Element_ID >= 1000000 AND NOT EXISTS (SELECT 1 FROM AD_COLUMN c WHERE UPPER(AD_ELEMENT.ColumnName)=UPPER(c.ColumnName)) AND NOT EXISTS (SELECT 1 FROM AD_PROCESS_PARA p WHERE UPPER(AD_ELEMENT.ColumnName)=UPPER(p.ColumnName)) AND NOT EXISTS (SELECT 1 FROM AD_INFOCOLUMN i WHERE UPPER(AD_ELEMENT.ColumnName)=UPPER(i.ColumnName)) ; UPDATE AD_COLUMN SET ColumnName=e.ColumnName,Name=e.Name,Description=e.Description,Help=e.Help, Updated = statement_timestamp() FROM AD_ELEMENT e WHERE AD_COLUMN.AD_Element_ID=e.AD_Element_ID AND EXISTS (SELECT 1 FROM AD_ELEMENT e WHERE AD_COLUMN.AD_Element_ID=e.AD_Element_ID AND (AD_COLUMN.ColumnName <> e.ColumnName OR AD_COLUMN.Name <> e.Name OR COALESCE(AD_COLUMN.Description,' ') <> COALESCE(e.Description,' ') OR COALESCE(AD_COLUMN.Help,' ') <> COALESCE(e.Help,' '))) diff --git a/org.adempiere.base.process/src/org/compiere/process/SynchronizeTerminology.java b/org.adempiere.base.process/src/org/compiere/process/SynchronizeTerminology.java index 90ae5a868a..f8487f246e 100644 --- a/org.adempiere.base.process/src/org/compiere/process/SynchronizeTerminology.java +++ b/org.adempiere.base.process/src/org/compiere/process/SynchronizeTerminology.java @@ -138,7 +138,9 @@ public class SynchronizeTerminology extends SvrProcess +" WHERE NOT EXISTS" +" (SELECT 1 FROM AD_COLUMN c WHERE UPPER(e.ColumnName)=UPPER(c.ColumnName))" +" AND NOT EXISTS" - +" (SELECT 1 FROM AD_PROCESS_PARA p WHERE UPPER(e.ColumnName)=UPPER(p.ColumnName)))"; + +" (SELECT 1 FROM AD_PROCESS_PARA p WHERE UPPER(e.ColumnName)=UPPER(p.ColumnName))" + +" AND NOT EXISTS" + +" (SELECT 1 FROM AD_INFOCOLUMN i WHERE UPPER(e.ColumnName)=UPPER(i.ColumnName)))"; no = DB.executeUpdate(sql, false, get_TrxName()); if (log.isLoggable(Level.INFO)) log.info(" rows deleted: "+no); trx.commit(true); @@ -147,7 +149,9 @@ public class SynchronizeTerminology extends SvrProcess +" WHERE AD_Element_ID >= 1000000 AND NOT EXISTS" +" (SELECT 1 FROM AD_COLUMN c WHERE UPPER(e.ColumnName)=UPPER(c.ColumnName))" +" AND NOT EXISTS" - +" (SELECT 1 FROM AD_PROCESS_PARA p WHERE UPPER(e.ColumnName)=UPPER(p.ColumnName))"; + +" (SELECT 1 FROM AD_PROCESS_PARA p WHERE UPPER(e.ColumnName)=UPPER(p.ColumnName))" + +" AND NOT EXISTS" + +" (SELECT 1 FROM AD_INFOCOLUMN i WHERE UPPER(e.ColumnName)=UPPER(i.ColumnName))"; no = DB.executeUpdate(sql, false, get_TrxName()); if (log.isLoggable(Level.INFO)) log.info(" rows deleted: "+no); trx.commit(true);