From 8bc3e8895c6646b55ac41e0349e70bd775a922e5 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Thu, 12 Apr 2012 16:00:12 -0500 Subject: [PATCH 01/49] IDEMPIERE 195 Menu Auto Expand --- .../835_IDEMPIERE-195_MenuAutoExpand.sql | 345 ++++++++++++++++++ .../835_IDEMPIERE-195_MenuAutoExpand.sql | 345 ++++++++++++++++++ .../src/org/compiere/model/I_AD_Role.java | 16 +- .../src/org/compiere/model/I_AD_User.java | 16 +- .../src/org/compiere/model/X_AD_Role.java | 30 +- .../src/org/compiere/model/X_AD_User.java | 30 +- .../src/org/compiere/apps/AMenu.java | 6 + .../org/compiere/grid/tree/VTreePanel.java | 10 + .../org/adempiere/webui/panel/MenuPanel.java | 7 + 9 files changed, 799 insertions(+), 6 deletions(-) create mode 100644 migration/360lts-release/oracle/835_IDEMPIERE-195_MenuAutoExpand.sql create mode 100644 migration/360lts-release/postgresql/835_IDEMPIERE-195_MenuAutoExpand.sql diff --git a/migration/360lts-release/oracle/835_IDEMPIERE-195_MenuAutoExpand.sql b/migration/360lts-release/oracle/835_IDEMPIERE-195_MenuAutoExpand.sql new file mode 100644 index 0000000000..53936ca78d --- /dev/null +++ b/migration/360lts-release/oracle/835_IDEMPIERE-195_MenuAutoExpand.sql @@ -0,0 +1,345 @@ +-- Apr 12, 2012 11:08:20 AM CEST +-- IDEMPIERE-129 Expand menu automatically +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,200023,0,'IsMenuAutoExpand',TO_DATE('2012-04-12 11:08:19','YYYY-MM-DD HH24:MI:SS'),100,'If ticked, the menu is automatically expanded','D','Y','Auto expand menu','Auto expand menu',TO_DATE('2012-04-12 11:08:19','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Apr 12, 2012 11:08:21 AM CEST +-- IDEMPIERE-129 Expand menu automatically +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200023 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) +; + +-- Apr 12, 2012 11:09:31 AM CEST +-- IDEMPIERE-129 Expand menu automatically +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,IsActive,IsAllowCopy,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,200112,200023,0,20,156,'IsMenuAutoExpand',TO_DATE('2012-04-12 11:09:31','YYYY-MM-DD HH24:MI:SS'),100,'N','If ticked, the menu is automatically expanded','D',1,'Y','Y','Y','N','N','N','N','N','Y','N','N','N','N','Y','Auto expand menu',0,TO_DATE('2012-04-12 11:09:31','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Apr 12, 2012 11:09:31 AM CEST +-- IDEMPIERE-129 Expand menu automatically +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200112 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Apr 12, 2012 11:09:41 AM CEST +-- IDEMPIERE-129 Expand menu automatically +ALTER TABLE AD_Role ADD IsMenuAutoExpand CHAR(1) DEFAULT 'N' CHECK (IsMenuAutoExpand IN ('Y','N')) NOT NULL +; + +-- Apr 12, 2012 11:10:42 AM CEST +-- IDEMPIERE-129 Expand menu automatically +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,200112,200071,0,119,TO_DATE('2012-04-12 11:10:41','YYYY-MM-DD HH24:MI:SS'),100,'If ticked, the menu is automatically expanded',0,'D','Y','Y','Y','N','N','N','N','N','Auto expand menu',430,0,TO_DATE('2012-04-12 11:10:41','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Apr 12, 2012 11:10:42 AM CEST +-- IDEMPIERE-129 Expand menu automatically +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200071 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=300,IsDisplayed='Y' WHERE AD_Field_ID=200071 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=310,IsDisplayed='Y' WHERE AD_Field_ID=50168 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=320,IsDisplayed='Y' WHERE AD_Field_ID=50169 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=330,IsDisplayed='Y' WHERE AD_Field_ID=50170 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=340,IsDisplayed='Y' WHERE AD_Field_ID=50171 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=350,IsDisplayed='Y' WHERE AD_Field_ID=50172 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=360,IsDisplayed='Y' WHERE AD_Field_ID=50173 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=370,IsDisplayed='Y' WHERE AD_Field_ID=50174 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=380,IsDisplayed='Y' WHERE AD_Field_ID=50175 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=390,IsDisplayed='Y' WHERE AD_Field_ID=50176 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=400,IsDisplayed='Y' WHERE AD_Field_ID=50177 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=410,IsDisplayed='Y' WHERE AD_Field_ID=50178 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=420,IsDisplayed='Y' WHERE AD_Field_ID=55432 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=430,IsDisplayed='Y' WHERE AD_Field_ID=55433 +; + +-- Apr 12, 2012 11:12:28 AM CEST +-- IDEMPIERE-129 Expand menu automatically +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,IsActive,IsAllowCopy,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,200113,200023,0,20,114,'IsMenuAutoExpand',TO_DATE('2012-04-12 11:12:27','YYYY-MM-DD HH24:MI:SS'),100,'N','If ticked, the menu is automatically expanded','D',1,'Y','Y','Y','N','N','N','N','N','Y','N','N','N','N','Y','Auto expand menu',0,TO_DATE('2012-04-12 11:12:27','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Apr 12, 2012 11:12:28 AM CEST +-- IDEMPIERE-129 Expand menu automatically +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200113 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Apr 12, 2012 11:12:29 AM CEST +-- IDEMPIERE-129 Expand menu automatically +ALTER TABLE AD_User ADD IsMenuAutoExpand CHAR(1) DEFAULT 'N' CHECK (IsMenuAutoExpand IN ('Y','N')) NOT NULL +; + +-- Apr 12, 2012 11:13:08 AM CEST +-- IDEMPIERE-129 Expand menu automatically +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,200113,200072,0,118,TO_DATE('2012-04-12 11:13:07','YYYY-MM-DD HH24:MI:SS'),100,'If ticked, the menu is automatically expanded',0,'D','Y','Y','Y','N','N','N','N','N','Auto expand menu',310,0,TO_DATE('2012-04-12 11:13:07','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Apr 12, 2012 11:13:08 AM CEST +-- IDEMPIERE-129 Expand menu automatically +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200072 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=52010 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y' WHERE AD_Field_ID=6515 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y' WHERE AD_Field_ID=6517 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y' WHERE AD_Field_ID=6514 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y' WHERE AD_Field_ID=6518 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=180,IsDisplayed='Y' WHERE AD_Field_ID=11679 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y' WHERE AD_Field_ID=12324 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=12323 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y' WHERE AD_Field_ID=5883 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y' WHERE AD_Field_ID=5884 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=4261 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=10491 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=6511 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=12640 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=200072 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y' WHERE AD_Field_ID=6513 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=290,IsDisplayed='Y' WHERE AD_Field_ID=11525 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=300,IsDisplayed='Y' WHERE AD_Field_ID=6520 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=310,IsDisplayed='Y' WHERE AD_Field_ID=8342 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=320,IsDisplayed='Y' WHERE AD_Field_ID=6519 +; + +-- Apr 12, 2012 11:13:47 AM CEST +-- IDEMPIERE-129 Expand menu automatically +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,200113,200073,0,53282,TO_DATE('2012-04-12 11:13:46','YYYY-MM-DD HH24:MI:SS'),100,'If ticked, the menu is automatically expanded',0,'D','Y','Y','Y','N','N','N','N','N','Auto expand menu',310,0,TO_DATE('2012-04-12 11:13:46','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Apr 12, 2012 11:13:47 AM CEST +-- IDEMPIERE-129 Expand menu automatically +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200073 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=57995 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y' WHERE AD_Field_ID=57997 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y' WHERE AD_Field_ID=57998 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y' WHERE AD_Field_ID=57999 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y' WHERE AD_Field_ID=58000 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=180,IsDisplayed='Y' WHERE AD_Field_ID=58001 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y' WHERE AD_Field_ID=58002 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=58003 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y' WHERE AD_Field_ID=58004 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y' WHERE AD_Field_ID=58005 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=58006 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=58007 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=58008 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=58009 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=200073 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y' WHERE AD_Field_ID=58010 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=290,IsDisplayed='Y' WHERE AD_Field_ID=58011 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=300,IsDisplayed='Y' WHERE AD_Field_ID=58012 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=310,IsDisplayed='Y' WHERE AD_Field_ID=58013 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=320,IsDisplayed='Y' WHERE AD_Field_ID=58014 +; + +UPDATE AD_System + SET LastMigrationScriptApplied='835_IDEMPIERE-195_MenuAutoExpand.sql' +WHERE LastMigrationScriptApplied<'835_IDEMPIERE-195_MenuAutoExpand.sql' + OR LastMigrationScriptApplied IS NULL +; \ No newline at end of file diff --git a/migration/360lts-release/postgresql/835_IDEMPIERE-195_MenuAutoExpand.sql b/migration/360lts-release/postgresql/835_IDEMPIERE-195_MenuAutoExpand.sql new file mode 100644 index 0000000000..b721026327 --- /dev/null +++ b/migration/360lts-release/postgresql/835_IDEMPIERE-195_MenuAutoExpand.sql @@ -0,0 +1,345 @@ +-- Apr 12, 2012 11:08:21 AM CEST +-- IDEMPIERE-129 Expand menu automatically +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,200023,0,'IsMenuAutoExpand',TO_TIMESTAMP('2012-04-12 11:08:19','YYYY-MM-DD HH24:MI:SS'),100,'If ticked, the menu is automatically expanded','D','Y','Auto expand menu','Auto expand menu',TO_TIMESTAMP('2012-04-12 11:08:19','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Apr 12, 2012 11:08:21 AM CEST +-- IDEMPIERE-129 Expand menu automatically +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200023 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) +; + +-- Apr 12, 2012 11:09:31 AM CEST +-- IDEMPIERE-129 Expand menu automatically +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,IsActive,IsAllowCopy,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,200112,200023,0,20,156,'IsMenuAutoExpand',TO_TIMESTAMP('2012-04-12 11:09:31','YYYY-MM-DD HH24:MI:SS'),100,'N','If ticked, the menu is automatically expanded','D',1,'Y','Y','Y','N','N','N','N','N','Y','N','N','N','N','Y','Auto expand menu',0,TO_TIMESTAMP('2012-04-12 11:09:31','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Apr 12, 2012 11:09:31 AM CEST +-- IDEMPIERE-129 Expand menu automatically +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200112 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Apr 12, 2012 11:09:41 AM CEST +-- IDEMPIERE-129 Expand menu automatically +ALTER TABLE AD_Role ADD COLUMN IsMenuAutoExpand CHAR(1) DEFAULT 'N' CHECK (IsMenuAutoExpand IN ('Y','N')) NOT NULL +; + +-- Apr 12, 2012 11:10:42 AM CEST +-- IDEMPIERE-129 Expand menu automatically +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,200112,200071,0,119,TO_TIMESTAMP('2012-04-12 11:10:41','YYYY-MM-DD HH24:MI:SS'),100,'If ticked, the menu is automatically expanded',0,'D','Y','Y','Y','N','N','N','N','N','Auto expand menu',430,0,TO_TIMESTAMP('2012-04-12 11:10:41','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Apr 12, 2012 11:10:42 AM CEST +-- IDEMPIERE-129 Expand menu automatically +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200071 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=300,IsDisplayed='Y' WHERE AD_Field_ID=200071 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=310,IsDisplayed='Y' WHERE AD_Field_ID=50168 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=320,IsDisplayed='Y' WHERE AD_Field_ID=50169 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=330,IsDisplayed='Y' WHERE AD_Field_ID=50170 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=340,IsDisplayed='Y' WHERE AD_Field_ID=50171 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=350,IsDisplayed='Y' WHERE AD_Field_ID=50172 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=360,IsDisplayed='Y' WHERE AD_Field_ID=50173 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=370,IsDisplayed='Y' WHERE AD_Field_ID=50174 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=380,IsDisplayed='Y' WHERE AD_Field_ID=50175 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=390,IsDisplayed='Y' WHERE AD_Field_ID=50176 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=400,IsDisplayed='Y' WHERE AD_Field_ID=50177 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=410,IsDisplayed='Y' WHERE AD_Field_ID=50178 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=420,IsDisplayed='Y' WHERE AD_Field_ID=55432 +; + +-- Apr 12, 2012 11:11:23 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=430,IsDisplayed='Y' WHERE AD_Field_ID=55433 +; + +-- Apr 12, 2012 11:12:28 AM CEST +-- IDEMPIERE-129 Expand menu automatically +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,IsActive,IsAllowCopy,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,200113,200023,0,20,114,'IsMenuAutoExpand',TO_TIMESTAMP('2012-04-12 11:12:27','YYYY-MM-DD HH24:MI:SS'),100,'N','If ticked, the menu is automatically expanded','D',1,'Y','Y','Y','N','N','N','N','N','Y','N','N','N','N','Y','Auto expand menu',0,TO_TIMESTAMP('2012-04-12 11:12:27','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- Apr 12, 2012 11:12:28 AM CEST +-- IDEMPIERE-129 Expand menu automatically +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200113 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Apr 12, 2012 11:12:29 AM CEST +-- IDEMPIERE-129 Expand menu automatically +ALTER TABLE AD_User ADD COLUMN IsMenuAutoExpand CHAR(1) DEFAULT 'N' CHECK (IsMenuAutoExpand IN ('Y','N')) NOT NULL +; + +-- Apr 12, 2012 11:13:08 AM CEST +-- IDEMPIERE-129 Expand menu automatically +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,200113,200072,0,118,TO_TIMESTAMP('2012-04-12 11:13:07','YYYY-MM-DD HH24:MI:SS'),100,'If ticked, the menu is automatically expanded',0,'D','Y','Y','Y','N','N','N','N','N','Auto expand menu',310,0,TO_TIMESTAMP('2012-04-12 11:13:07','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Apr 12, 2012 11:13:08 AM CEST +-- IDEMPIERE-129 Expand menu automatically +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200072 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=52010 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y' WHERE AD_Field_ID=6515 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y' WHERE AD_Field_ID=6517 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y' WHERE AD_Field_ID=6514 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y' WHERE AD_Field_ID=6518 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=180,IsDisplayed='Y' WHERE AD_Field_ID=11679 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y' WHERE AD_Field_ID=12324 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=12323 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y' WHERE AD_Field_ID=5883 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y' WHERE AD_Field_ID=5884 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=4261 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=10491 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=6511 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=12640 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=200072 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y' WHERE AD_Field_ID=6513 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=290,IsDisplayed='Y' WHERE AD_Field_ID=11525 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=300,IsDisplayed='Y' WHERE AD_Field_ID=6520 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=310,IsDisplayed='Y' WHERE AD_Field_ID=8342 +; + +-- Apr 12, 2012 11:13:25 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=320,IsDisplayed='Y' WHERE AD_Field_ID=6519 +; + +-- Apr 12, 2012 11:13:47 AM CEST +-- IDEMPIERE-129 Expand menu automatically +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,200113,200073,0,53282,TO_TIMESTAMP('2012-04-12 11:13:46','YYYY-MM-DD HH24:MI:SS'),100,'If ticked, the menu is automatically expanded',0,'D','Y','Y','Y','N','N','N','N','N','Auto expand menu',310,0,TO_TIMESTAMP('2012-04-12 11:13:46','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- Apr 12, 2012 11:13:47 AM CEST +-- IDEMPIERE-129 Expand menu automatically +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200073 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=57995 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y' WHERE AD_Field_ID=57997 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y' WHERE AD_Field_ID=57998 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y' WHERE AD_Field_ID=57999 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y' WHERE AD_Field_ID=58000 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=180,IsDisplayed='Y' WHERE AD_Field_ID=58001 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y' WHERE AD_Field_ID=58002 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=58003 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y' WHERE AD_Field_ID=58004 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y' WHERE AD_Field_ID=58005 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=58006 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=58007 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=58008 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=58009 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=200073 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y' WHERE AD_Field_ID=58010 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=290,IsDisplayed='Y' WHERE AD_Field_ID=58011 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=300,IsDisplayed='Y' WHERE AD_Field_ID=58012 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=310,IsDisplayed='Y' WHERE AD_Field_ID=58013 +; + +-- Apr 12, 2012 11:13:58 AM CEST +-- IDEMPIERE-129 Expand menu automatically +UPDATE AD_Field SET SeqNo=320,IsDisplayed='Y' WHERE AD_Field_ID=58014 +; + +UPDATE AD_System + SET LastMigrationScriptApplied='835_IDEMPIERE-195_MenuAutoExpand.sql' +WHERE LastMigrationScriptApplied<'835_IDEMPIERE-195_MenuAutoExpand.sql' + OR LastMigrationScriptApplied IS NULL +; \ No newline at end of file diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_Role.java b/org.adempiere.base/src/org/compiere/model/I_AD_Role.java index fcff8d2a62..ab6fe4d37e 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_Role.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_Role.java @@ -18,11 +18,12 @@ package org.compiere.model; import java.math.BigDecimal; import java.sql.Timestamp; +import org.compiere.model.*; import org.compiere.util.KeyNamePair; /** Generated Interface for AD_Role * @author Adempiere (generated) - * @version Release 3.6.0LTS + * @version 360LTS.015 */ public interface I_AD_Role { @@ -440,6 +441,19 @@ public interface I_AD_Role */ public boolean isManual(); + /** Column name IsMenuAutoExpand */ + public static final String COLUMNNAME_IsMenuAutoExpand = "IsMenuAutoExpand"; + + /** Set Auto expand menu. + * If ticked, the menu is automatically expanded + */ + public void setIsMenuAutoExpand (boolean IsMenuAutoExpand); + + /** Get Auto expand menu. + * If ticked, the menu is automatically expanded + */ + public boolean isMenuAutoExpand(); + /** Column name IsPersonalAccess */ public static final String COLUMNNAME_IsPersonalAccess = "IsPersonalAccess"; diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_User.java b/org.adempiere.base/src/org/compiere/model/I_AD_User.java index f534f2c5e4..58837e3e97 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_User.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_User.java @@ -18,11 +18,12 @@ package org.compiere.model; import java.math.BigDecimal; import java.sql.Timestamp; +import org.compiere.model.*; import org.compiere.util.KeyNamePair; /** Generated Interface for AD_User * @author Adempiere (generated) - * @version Release 3.6.0LTS + * @version 360LTS.015 */ public interface I_AD_User { @@ -333,6 +334,19 @@ public interface I_AD_User */ public boolean isInPayroll(); + /** Column name IsMenuAutoExpand */ + public static final String COLUMNNAME_IsMenuAutoExpand = "IsMenuAutoExpand"; + + /** Set Auto expand menu. + * If ticked, the menu is automatically expanded + */ + public void setIsMenuAutoExpand (boolean IsMenuAutoExpand); + + /** Get Auto expand menu. + * If ticked, the menu is automatically expanded + */ + public boolean isMenuAutoExpand(); + /** Column name LastContact */ public static final String COLUMNNAME_LastContact = "LastContact"; diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_Role.java b/org.adempiere.base/src/org/compiere/model/X_AD_Role.java index 1e8bf998a0..ef96d7d83b 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_Role.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_Role.java @@ -25,14 +25,14 @@ import org.compiere.util.KeyNamePair; /** Generated Model for AD_Role * @author Adempiere (generated) - * @version Release 3.6.0LTS - $Id$ */ + * @version 360LTS.015 - $Id$ */ public class X_AD_Role extends PO implements I_AD_Role, I_Persistent { /** * */ - private static final long serialVersionUID = 20110325L; + private static final long serialVersionUID = 20120412L; /** Standard Constructor */ public X_AD_Role (Properties ctx, int AD_Role_ID, String trxName) @@ -81,6 +81,8 @@ public class X_AD_Role extends PO implements I_AD_Role, I_Persistent setIsDiscountAllowedOnTotal (false); setIsDiscountUptoLimitPrice (false); setIsManual (false); + setIsMenuAutoExpand (false); +// N setIsPersonalAccess (false); // N setIsPersonalLock (false); @@ -820,6 +822,30 @@ public class X_AD_Role extends PO implements I_AD_Role, I_Persistent return false; } + /** Set Auto expand menu. + @param IsMenuAutoExpand + If ticked, the menu is automatically expanded + */ + public void setIsMenuAutoExpand (boolean IsMenuAutoExpand) + { + set_Value (COLUMNNAME_IsMenuAutoExpand, Boolean.valueOf(IsMenuAutoExpand)); + } + + /** Get Auto expand menu. + @return If ticked, the menu is automatically expanded + */ + public boolean isMenuAutoExpand () + { + Object oo = get_Value(COLUMNNAME_IsMenuAutoExpand); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + /** Set Personal Access. @param IsPersonalAccess Allow access to all personal records diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_User.java b/org.adempiere.base/src/org/compiere/model/X_AD_User.java index bce757c9f9..c2457d4ed3 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_User.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_User.java @@ -24,14 +24,14 @@ import org.compiere.util.KeyNamePair; /** Generated Model for AD_User * @author Adempiere (generated) - * @version Release 3.6.0LTS - $Id$ */ + * @version 360LTS.015 - $Id$ */ public class X_AD_User extends PO implements I_AD_User, I_Persistent { /** * */ - private static final long serialVersionUID = 20100614L; + private static final long serialVersionUID = 20120412L; /** Standard Constructor */ public X_AD_User (Properties ctx, int AD_User_ID, String trxName) @@ -43,6 +43,8 @@ public class X_AD_User extends PO implements I_AD_User, I_Persistent setIsFullBPAccess (true); // Y setIsInPayroll (false); +// N + setIsMenuAutoExpand (false); // N setName (null); setNotificationType (null); @@ -465,6 +467,30 @@ public class X_AD_User extends PO implements I_AD_User, I_Persistent return false; } + /** Set Auto expand menu. + @param IsMenuAutoExpand + If ticked, the menu is automatically expanded + */ + public void setIsMenuAutoExpand (boolean IsMenuAutoExpand) + { + set_Value (COLUMNNAME_IsMenuAutoExpand, Boolean.valueOf(IsMenuAutoExpand)); + } + + /** Get Auto expand menu. + @return If ticked, the menu is automatically expanded + */ + public boolean isMenuAutoExpand () + { + Object oo = get_Value(COLUMNNAME_IsMenuAutoExpand); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + /** Set Last Contact. @param LastContact Date this individual was last contacted diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java b/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java index 24c99f9f4c..7156d83960 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java @@ -195,6 +195,12 @@ public final class AMenu extends CFrame infoUpdater = new InfoUpdater(); infoUpdaterThread = new Thread(infoUpdater, "InfoUpdater"); infoUpdaterThread.start(); + + // Auto Expand Tree - nmicoud IDEMPIERE 195 + if (MRole.getDefault().isMenuAutoExpand() || new MUser(m_ctx, m_AD_User_ID, null).isMenuAutoExpand()) + treePanel.expandTree(true); + // Auto Expand Tree - nmicoud IDEMPIERE 195 + // Env.addEventListener(this); // diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/tree/VTreePanel.java b/org.adempiere.ui.swing/src/org/compiere/grid/tree/VTreePanel.java index 47f9690638..0b7f09e9ec 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/tree/VTreePanel.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/tree/VTreePanel.java @@ -962,6 +962,16 @@ public final class VTreePanel extends CPanel return no == 1; } // barDBupdate + // Auto Expand Tree - nmicoud IDEMPIERE 195 + /** + * Expand/Collapse tree + * @param expand true if tree should be expanded + */ + public void expandTree(boolean expand) + { + treeExpand.setSelected(expand); + expandTree(); + } /** * Clicked on Expand All diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java index 8d75cc9c57..bc8f5fc8c6 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java @@ -26,8 +26,10 @@ import org.adempiere.webui.event.MenuListener; import org.adempiere.webui.exception.ApplicationException; import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.util.TreeUtils; +import org.compiere.model.MRole; import org.compiere.model.MTree; import org.compiere.model.MTreeNode; +import org.compiere.model.MUser; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; @@ -80,6 +82,11 @@ public class MenuPanel extends Panel implements EventListener init(); initMenu(rootNode); pnlSearch.initialise(); + + // Auto Expand Tree - nmicoud IDEMPIERE 195 + if (MRole.getDefault().isMenuAutoExpand() || new MUser(ctx, Env.getAD_User_ID(ctx), null).isMenuAutoExpand()) + expandAll(); + // Auto Expand Tree - nmicoud IDEMPIERE 195 } private void init() From b70cd913b4fe9e03cacfc40da17b41c92c04e8de Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 12 Apr 2012 16:02:11 -0500 Subject: [PATCH 02/49] IDEMPIERE-195 Expand menu automatically - minor improvement to use cached version of the current user --- org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java | 2 +- .../src/org/compiere/grid/tree/VTreePanel.java | 2 +- .../WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java b/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java index 7156d83960..6e18b6e81e 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java @@ -197,7 +197,7 @@ public final class AMenu extends CFrame infoUpdaterThread.start(); // Auto Expand Tree - nmicoud IDEMPIERE 195 - if (MRole.getDefault().isMenuAutoExpand() || new MUser(m_ctx, m_AD_User_ID, null).isMenuAutoExpand()) + if (MRole.getDefault().isMenuAutoExpand() || MUser.get(m_ctx).isMenuAutoExpand()) treePanel.expandTree(true); // Auto Expand Tree - nmicoud IDEMPIERE 195 diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/tree/VTreePanel.java b/org.adempiere.ui.swing/src/org/compiere/grid/tree/VTreePanel.java index 0b7f09e9ec..5f07552b21 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/tree/VTreePanel.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/tree/VTreePanel.java @@ -173,7 +173,7 @@ public final class VTreePanel extends CPanel /** * */ - private static final long serialVersionUID = -6798614427038652192L; + private static final long serialVersionUID = -7188402231414573844L; private static final String PREFIX_DOCUMENT_SEARCH = "/"; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java index bc8f5fc8c6..a5602c0c22 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java @@ -84,7 +84,7 @@ public class MenuPanel extends Panel implements EventListener pnlSearch.initialise(); // Auto Expand Tree - nmicoud IDEMPIERE 195 - if (MRole.getDefault().isMenuAutoExpand() || new MUser(ctx, Env.getAD_User_ID(ctx), null).isMenuAutoExpand()) + if (MRole.getDefault().isMenuAutoExpand() || MUser.get(ctx).isMenuAutoExpand()) expandAll(); // Auto Expand Tree - nmicoud IDEMPIERE 195 } From e118afeadf3179f905cef3dc9b99c090b664d19b Mon Sep 17 00:00:00 2001 From: Juliana Corredor Date: Thu, 12 Apr 2012 16:13:02 -0500 Subject: [PATCH 03/49] IDEMPIERE-156 Add column/field C_BankAccount.Name --- .../oracle/836_IDEMPIERE-156.sql | 205 +++++++++++++++++ .../postgresql/836_IDEMPIERE-156.sql | 207 ++++++++++++++++++ 2 files changed, 412 insertions(+) create mode 100644 migration/360lts-release/oracle/836_IDEMPIERE-156.sql create mode 100644 migration/360lts-release/postgresql/836_IDEMPIERE-156.sql diff --git a/migration/360lts-release/oracle/836_IDEMPIERE-156.sql b/migration/360lts-release/oracle/836_IDEMPIERE-156.sql new file mode 100644 index 0000000000..3fd83ea15c --- /dev/null +++ b/migration/360lts-release/oracle/836_IDEMPIERE-156.sql @@ -0,0 +1,205 @@ +-- 12/04/2012 09:40:45 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,Description,Name,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,ColumnName,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (62513,297,'U',0,'N','N','N',0,'The name of an entity (record) is used as an default search option in addition to the search key. The name is up to 60 characters in length.','N','Alphanumeric identifier of the entity','Name',60,'N',10,'N','N',469,'N','Y','Name','N','Y','N','Y',0,TO_DATE('2012-04-12 09:40:44','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-04-12 09:40:44','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- 12/04/2012 09:40:45 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=62513 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- 12/04/2012 09:43:11 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +ALTER TABLE C_BankAccount ADD Name NVARCHAR2(60) DEFAULT NULL +; + +-- 12/04/2012 09:44:29 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,Description,Name,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,ColumnName,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (62512,297,'U',0,'N','N','N',0,'A search key allows you a fast method of finding a particular record. +If you leave the search key empty, the system automatically creates a numeric number. The document sequence used for this fallback number is defined in the "Maintain Sequence" window with the name "DocumentNo_", where TableName is the actual name of the table (e.g. C_Order).','N','Search key for the record in the format required - must be unique','Search Key',40,'N',10,'N','N',620,'N','Y','Value','N','Y','N','Y',0,TO_DATE('2012-04-12 09:44:29','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-04-12 09:44:29','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- 12/04/2012 09:44:29 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=62512 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- 12/04/2012 09:44:58 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +ALTER TABLE C_BankAccount ADD Value NVARCHAR2(40) DEFAULT NULL +; + +-- 12/04/2012 09:49:26 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Field (IsEncrypted,Description,DisplayLength,Name,IsDisplayed,IsSameLine,IsHeading,AD_Column_ID,IsFieldOnly,IsCentrallyMaintained,AD_Tab_ID,AD_Field_ID,IsReadOnly,Help,EntityType,UpdatedBy,AD_Org_ID,IsActive,Created,AD_Client_ID,CreatedBy,Updated) VALUES ('N','Alphanumeric identifier of the entity',60,'Name','Y','N','N',62513,'N','Y',228,63003,'N','The name of an entity (record) is used as an default search option in addition to the search key. The name is up to 60 characters in length.','U',0,0,'Y',TO_DATE('2012-04-12 09:49:26','YYYY-MM-DD HH24:MI:SS'),0,0,TO_DATE('2012-04-12 09:49:26','YYYY-MM-DD HH24:MI:SS')) +; + +-- 12/04/2012 09:49:26 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Name,Help, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Name,t.Help, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=63003 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; + +-- 12/04/2012 09:49:26 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Field (IsEncrypted,Description,DisplayLength,Name,IsDisplayed,IsSameLine,IsHeading,AD_Column_ID,IsFieldOnly,IsCentrallyMaintained,AD_Tab_ID,AD_Field_ID,IsReadOnly,Help,EntityType,UpdatedBy,AD_Org_ID,IsActive,Created,AD_Client_ID,CreatedBy,Updated) VALUES ('N','Search key for the record in the format required - must be unique',40,'Search Key','Y','N','N',62512,'N','Y',228,63002,'N','A search key allows you a fast method of finding a particular record. +If you leave the search key empty, the system automatically creates a numeric number. The document sequence used for this fallback number is defined in the "Maintain Sequence" window with the name "DocumentNo_", where TableName is the actual name of the table (e.g. C_Order).','U',0,0,'Y',TO_DATE('2012-04-12 09:49:26','YYYY-MM-DD HH24:MI:SS'),0,0,TO_DATE('2012-04-12 09:49:26','YYYY-MM-DD HH24:MI:SS')) +; + +-- 12/04/2012 09:49:26 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Name,Help, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Name,t.Help, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=63002 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=30,IsDisplayed='Y' WHERE AD_Field_ID=63002 +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=40,IsDisplayed='Y' WHERE AD_Field_ID=63003 +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=50,IsDisplayed='Y' WHERE AD_Field_ID=2217 +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=60,IsDisplayed='Y' WHERE AD_Field_ID=2214 +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=70,IsDisplayed='Y' WHERE AD_Field_ID=11201 +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=11017 +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=11016 +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=2222 +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=3220 +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=2219 +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=4114 +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y' WHERE AD_Field_ID=2220 +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y' WHERE AD_Field_ID=2221 +; + +-- 12/04/2012 09:51:08 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Column SET IsIdentifier='N',Updated=TO_DATE('2012-04-12 09:51:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=3074 +; + +-- 12/04/2012 09:51:23 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Column SET IsIdentifier='Y',Updated=TO_DATE('2012-04-12 09:51:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=62513 +; + +-- 12/04/2012 09:51:34 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Column SET IsIdentifier='Y', SeqNo=3,Updated=TO_DATE('2012-04-12 09:51:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=62512 +; + +update c_bankaccount set name=accountno,value=accountno; + +-- 12/04/2012 11:46:17 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Column SET SeqNo=0,Updated=TO_DATE('2012-04-12 11:46:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=3074 +; + +-- 12/04/2012 11:46:49 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Column SET IsIdentifier='N', SeqNo=0,Updated=TO_DATE('2012-04-12 11:46:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=62512 +; + +-- 12/04/2012 11:47:00 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Column SET SeqNo=2, IsUpdateable='N',Updated=TO_DATE('2012-04-12 11:47:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=3072 +; + +-- 12/04/2012 11:47:07 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Column SET SeqNo=1,Updated=TO_DATE('2012-04-12 11:47:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=62513 +; + +-- 12/04/2012 11:50:38 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Column SET IsMandatory='Y',Updated=TO_DATE('2012-04-12 11:50:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=62513 +; + +-- 12/04/2012 11:50:43 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +ALTER TABLE C_BankAccount MODIFY Name NVARCHAR2(60) +; + +-- 12/04/2012 11:50:43 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +ALTER TABLE C_BankAccount MODIFY Name NOT NULL +; + +-- 12/04/2012 11:50:58 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Column SET IsMandatory='Y',Updated=TO_DATE('2012-04-12 11:50:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=62512 +; + +-- 12/04/2012 11:51:01 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +ALTER TABLE C_BankAccount MODIFY Value NVARCHAR2(40) +; + +-- 12/04/2012 11:51:01 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +ALTER TABLE C_BankAccount MODIFY Value NOT NULL +; + +-- 12/04/2012 11:51:29 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Column SET EntityType='D',Updated=TO_DATE('2012-04-12 11:51:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=62512 +; + + +-- 12/04/2012 11:51:46 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Column SET EntityType='D',Updated=TO_DATE('2012-04-12 11:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=62513 +; + +-- 12/04/2012 11:53:28 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Ref_Table SET AD_Display=62513,Updated=TO_DATE('2012-04-12 11:53:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Reference_ID=53283 +; + +UPDATE AD_System + SET LastMigrationScriptApplied='836_IDEMPIERE-156.sql' +WHERE LastMigrationScriptApplied<'836_IDEMPIERE-156.sql' + OR LastMigrationScriptApplied IS NULL +; diff --git a/migration/360lts-release/postgresql/836_IDEMPIERE-156.sql b/migration/360lts-release/postgresql/836_IDEMPIERE-156.sql new file mode 100644 index 0000000000..80350a7159 --- /dev/null +++ b/migration/360lts-release/postgresql/836_IDEMPIERE-156.sql @@ -0,0 +1,207 @@ +-- 12/04/2012 09:40:45 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,Description,Name,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,ColumnName,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (62513,297,'U',0,'N','N','N',0,'The name of an entity (record) is used as an default search option in addition to the search key. The name is up to 60 characters in length.','N','Alphanumeric identifier of the entity','Name',60,'N',10,'N','N',469,'N','Y','Name','N','Y','N','Y',0,TO_TIMESTAMP('2012-04-12 09:40:44','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-04-12 09:40:44','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- 12/04/2012 09:40:45 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=62513 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- 12/04/2012 09:43:11 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +ALTER TABLE C_BankAccount ADD COLUMN Name VARCHAR(60) DEFAULT NULL +; + +-- 12/04/2012 09:44:29 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,Description,Name,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,ColumnName,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (62512,297,'U',0,'N','N','N',0,'A search key allows you a fast method of finding a particular record. +If you leave the search key empty, the system automatically creates a numeric number. The document sequence used for this fallback number is defined in the "Maintain Sequence" window with the name "DocumentNo_", where TableName is the actual name of the table (e.g. C_Order).','N','Search key for the record in the format required - must be unique','Search Key',40,'N',10,'N','N',620,'N','Y','Value','N','Y','N','Y',0,TO_TIMESTAMP('2012-04-12 09:44:29','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-04-12 09:44:29','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- 12/04/2012 09:44:29 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=62512 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- 12/04/2012 09:44:58 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +ALTER TABLE C_BankAccount ADD COLUMN Value VARCHAR(40) DEFAULT NULL +; + +-- 12/04/2012 09:49:26 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Field (IsEncrypted,Description,DisplayLength,Name,IsDisplayed,IsSameLine,IsHeading,AD_Column_ID,IsFieldOnly,IsCentrallyMaintained,AD_Tab_ID,AD_Field_ID,IsReadOnly,Help,EntityType,UpdatedBy,AD_Org_ID,IsActive,Created,AD_Client_ID,CreatedBy,Updated) VALUES ('N','Alphanumeric identifier of the entity',60,'Name','Y','N','N',62513,'N','Y',228,63003,'N','The name of an entity (record) is used as an default search option in addition to the search key. The name is up to 60 characters in length.','U',0,0,'Y',TO_TIMESTAMP('2012-04-12 09:49:26','YYYY-MM-DD HH24:MI:SS'),0,0,TO_TIMESTAMP('2012-04-12 09:49:26','YYYY-MM-DD HH24:MI:SS')) +; + +-- 12/04/2012 09:49:26 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Name,Help, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Name,t.Help, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=63003 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; + +-- 12/04/2012 09:49:26 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Field (IsEncrypted,Description,DisplayLength,Name,IsDisplayed,IsSameLine,IsHeading,AD_Column_ID,IsFieldOnly,IsCentrallyMaintained,AD_Tab_ID,AD_Field_ID,IsReadOnly,Help,EntityType,UpdatedBy,AD_Org_ID,IsActive,Created,AD_Client_ID,CreatedBy,Updated) VALUES ('N','Search key for the record in the format required - must be unique',40,'Search Key','Y','N','N',62512,'N','Y',228,63002,'N','A search key allows you a fast method of finding a particular record. +If you leave the search key empty, the system automatically creates a numeric number. The document sequence used for this fallback number is defined in the "Maintain Sequence" window with the name "DocumentNo_", where TableName is the actual name of the table (e.g. C_Order).','U',0,0,'Y',TO_TIMESTAMP('2012-04-12 09:49:26','YYYY-MM-DD HH24:MI:SS'),0,0,TO_TIMESTAMP('2012-04-12 09:49:26','YYYY-MM-DD HH24:MI:SS')) +; + +-- 12/04/2012 09:49:26 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Name,Help, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Name,t.Help, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=63002 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=30,IsDisplayed='Y' WHERE AD_Field_ID=63002 +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=40,IsDisplayed='Y' WHERE AD_Field_ID=63003 +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=50,IsDisplayed='Y' WHERE AD_Field_ID=2217 +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=60,IsDisplayed='Y' WHERE AD_Field_ID=2214 +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=70,IsDisplayed='Y' WHERE AD_Field_ID=11201 +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=11017 +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=11016 +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=2222 +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=3220 +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=2219 +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=4114 +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y' WHERE AD_Field_ID=2220 +; + +-- 12/04/2012 09:50:39 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y' WHERE AD_Field_ID=2221 +; + +-- 12/04/2012 09:51:08 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Column SET IsIdentifier='N',Updated=TO_TIMESTAMP('2012-04-12 09:51:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=3074 +; + +-- 12/04/2012 09:51:23 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Column SET IsIdentifier='Y',Updated=TO_TIMESTAMP('2012-04-12 09:51:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=62513 +; + +-- 12/04/2012 09:51:34 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Column SET IsIdentifier='Y', SeqNo=3,Updated=TO_TIMESTAMP('2012-04-12 09:51:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=62512 +; + +update c_bankaccount set name=accountno,value=accountno; + + +-- 12/04/2012 11:46:17 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Column SET SeqNo=0,Updated=TO_TIMESTAMP('2012-04-12 11:46:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=3074 +; + +-- 12/04/2012 11:46:49 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Column SET IsIdentifier='N', SeqNo=0,Updated=TO_TIMESTAMP('2012-04-12 11:46:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=62512 +; + +-- 12/04/2012 11:47:00 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Column SET SeqNo=2, IsUpdateable='N',Updated=TO_TIMESTAMP('2012-04-12 11:47:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=3072 +; + +-- 12/04/2012 11:47:07 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Column SET SeqNo=1,Updated=TO_TIMESTAMP('2012-04-12 11:47:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=62513 +; + +-- 12/04/2012 11:50:38 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Column SET IsMandatory='Y',Updated=TO_TIMESTAMP('2012-04-12 11:50:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=62513 +; + +-- 12/04/2012 11:50:43 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO t_alter_column values('c_bankaccount','Name','VARCHAR(60)',null,null) +; + +-- 12/04/2012 11:50:43 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO t_alter_column values('c_bankaccount','Name',null,'NOT NULL',null) +; + +-- 12/04/2012 11:50:58 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Column SET IsMandatory='Y',Updated=TO_TIMESTAMP('2012-04-12 11:50:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=62512 +; + +-- 12/04/2012 11:51:01 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO t_alter_column values('c_bankaccount','Value','VARCHAR(40)',null,null) +; + +-- 12/04/2012 11:51:01 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO t_alter_column values('c_bankaccount','Value',null,'NOT NULL',null) +; + +-- 12/04/2012 11:51:29 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Column SET EntityType='D',Updated=TO_TIMESTAMP('2012-04-12 11:51:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=62512 +; + + + +-- 12/04/2012 11:51:46 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Column SET EntityType='D',Updated=TO_TIMESTAMP('2012-04-12 11:51:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=62513 +; + +-- 12/04/2012 11:53:28 AM COT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Ref_Table SET AD_Display=62513,Updated=TO_TIMESTAMP('2012-04-12 11:53:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Reference_ID=53283 +; + +UPDATE AD_System + SET LastMigrationScriptApplied='836_IDEMPIERE-156.sql' +WHERE LastMigrationScriptApplied<'836_IDEMPIERE-156.sql' + OR LastMigrationScriptApplied IS NULL +; From 98712527bd0c122cdc0eb67162736ce790f4eab5 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 18 Apr 2012 09:14:52 -0500 Subject: [PATCH 04/49] IDEMPIERE-233 Minitable implementation on zk doesn't manage editable timestamp properly --- .../src/org/adempiere/webui/component/WListItemRenderer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java index 7523572a40..95b83b4eff 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java @@ -593,7 +593,8 @@ public class WListItemRenderer implements ListitemRenderer, EventListener, Listi } else if (source instanceof Datebox) { - value = ((Datebox)source).getValue(); + if (((Datebox)source).getValue() != null) + value = new Timestamp(((Datebox)source).getValue().getTime()); } else if (source instanceof Textbox) { From a5fda838998909b01e1b9c2df14ee1b6196be517 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Wed, 18 Apr 2012 10:15:56 -0500 Subject: [PATCH 05/49] IDEMPIERE-236 Centralization of hardcoded IDs --- .../src/org/compiere/model/HardCodedIDs.java | 31 + .../src/org/compiere/acct/AcctViewerData.java | 931 +++++++++--------- .../src/org/compiere/apps/AMenu.java | 3 +- 3 files changed, 499 insertions(+), 466 deletions(-) create mode 100644 org.adempiere.base/src/org/compiere/model/HardCodedIDs.java diff --git a/org.adempiere.base/src/org/compiere/model/HardCodedIDs.java b/org.adempiere.base/src/org/compiere/model/HardCodedIDs.java new file mode 100644 index 0000000000..db1a37c846 --- /dev/null +++ b/org.adempiere.base/src/org/compiere/model/HardCodedIDs.java @@ -0,0 +1,31 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 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; + +/** + * List all hardcoded ID used in the code + * @author Carlos Ruiz, Nicolas Micoud, ... + */ + +public class HardCodedIDs { + + public static int referencePostingType = 125; + + + public static int windowMyRequests = 237; + +} diff --git a/org.adempiere.ui.swing/src/org/compiere/acct/AcctViewerData.java b/org.adempiere.ui.swing/src/org/compiere/acct/AcctViewerData.java index 79a9cba390..5b4b4fd56a 100644 --- a/org.adempiere.ui.swing/src/org/compiere/acct/AcctViewerData.java +++ b/org.adempiere.ui.swing/src/org/compiere/acct/AcctViewerData.java @@ -3,19 +3,19 @@ * Copyright (C) 1999-2006 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.acct; - + * 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.acct; + import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; @@ -29,6 +29,7 @@ import java.util.logging.Level; import javax.swing.JComboBox; +import org.compiere.model.HardCodedIDs; import org.compiere.model.MAcctSchema; import org.compiere.model.MAcctSchemaElement; import org.compiere.model.MFactAcct; @@ -44,439 +45,439 @@ import org.compiere.util.KeyNamePair; import org.compiere.util.Language; import org.compiere.util.Msg; import org.compiere.util.ValueNamePair; - - -/** - * Account Viewer State - maintains State information for the Account Viewer - * - * @author Jorg Janke + + +/** + * Account Viewer State - maintains State information for the Account Viewer + * + * @author Jorg Janke * @version $Id: AcctViewerData.java,v 1.3 2006/08/10 01:00:27 jjanke Exp $ * - * @author Teo Sarca, SC ARHIPAC SERVICE SRL + * @author Teo Sarca, SC ARHIPAC SERVICE SRL *
  • BF [ 1748449 ] Info Account - Posting Type is not translated *
  • BF [ 1778373 ] AcctViewer: data is not sorted proper - */ -class AcctViewerData -{ - /** - * Constructor - * @param ctx context - * @param windowNo window no - * @param ad_Client_ID client - * @param ad_Table_ID table - */ - public AcctViewerData (Properties ctx, int windowNo, int ad_Client_ID, int ad_Table_ID) - { - WindowNo = windowNo; - AD_Client_ID = ad_Client_ID; - if (AD_Client_ID == 0) - AD_Client_ID = Env.getContextAsInt(Env.getCtx(), WindowNo, "AD_Client_ID"); - if (AD_Client_ID == 0) - AD_Client_ID = Env.getContextAsInt(Env.getCtx(), "AD_Client_ID"); - AD_Table_ID = ad_Table_ID; - // - ASchemas = MAcctSchema.getClientAcctSchema(ctx, AD_Client_ID); - ASchema = ASchemas[0]; - } // AcctViewerData - - /** Window */ - public int WindowNo; - /** Client */ - public int AD_Client_ID; - /** All Acct Schema */ - public MAcctSchema[] ASchemas = null; - /** This Acct Schema */ - public MAcctSchema ASchema = null; - - // Selection Info - /** Document Query */ - public boolean documentQuery = false; - /** Acct Schema */ - public int C_AcctSchema_ID = 0; - /** Posting Type */ - public String PostingType = ""; - /** Organization */ - public int AD_Org_ID = 0; - /** Date From */ - public Timestamp DateFrom = null; - /** Date To */ - public Timestamp DateTo = null; - - // Document Table Selection Info - /** Table ID */ - public int AD_Table_ID; - /** Record */ - public int Record_ID; - - /** Containing Column and Query */ - public HashMap whereInfo = new HashMap(); - /** Containing TableName and AD_Table_ID */ - public HashMap tableInfo = new HashMap(); - - // Display Info - /** Display Qty */ - boolean displayQty = false; - /** Display Source Currency */ - boolean displaySourceAmt = false; - /** Display Document info */ - boolean displayDocumentInfo = false; - // - String sortBy1 = ""; - String sortBy2 = ""; - String sortBy3 = ""; - String sortBy4 = ""; - // - boolean group1 = false; - boolean group2 = false; - boolean group3 = false; - boolean group4 = false; - - /** Leasing Columns */ - private int m_leadingColumns = 0; - /** UserElement1 Reference */ - private String m_ref1 = null; - /** UserElement2 Reference */ - private String m_ref2 = null; - /** Logger */ - private static CLogger log = CLogger.getCLogger(AcctViewerData.class); - - /** - * Dispose - */ - public void dispose() - { - ASchemas = null; - ASchema = null; - // - whereInfo.clear(); - whereInfo = null; - // - Env.clearWinContext(WindowNo); - } // dispose - - - /************************************************************************** - * Fill Accounting Schema - * @param cb JComboBox to be filled - */ - protected void fillAcctSchema (JComboBox cb) - { - for (int i = 0; i < ASchemas.length; i++) - cb.addItem(new KeyNamePair(ASchemas[i].getC_AcctSchema_ID(), - ASchemas[i].getName())); - } // fillAcctSchema - - /** - * Fill Posting Type - * @param cb JComboBox to be filled - */ - protected void fillPostingType (JComboBox cb) - { - int AD_Reference_ID = 125; - ValueNamePair[] pt = MRefList.getList(Env.getCtx(), AD_Reference_ID, true); - for (int i = 0; i < pt.length; i++) - cb.addItem(pt[i]); - } // fillPostingType - - /** - * Fill Table with - * ValueNamePair (TableName, translatedKeyColumnName) - * and tableInfo with (TableName, AD_Table_ID) - * and select the entry for AD_Table_ID - * - * @param cb JComboBox to be filled - */ - protected void fillTable (JComboBox cb) - { - ValueNamePair select = null; - // - String sql = "SELECT AD_Table_ID, TableName FROM AD_Table t " - + "WHERE EXISTS (SELECT * FROM AD_Column c" - + " WHERE t.AD_Table_ID=c.AD_Table_ID AND c.ColumnName='Posted')" - + " AND IsView='N'"; - try - { - PreparedStatement pstmt = DB.prepareStatement(sql, null); - ResultSet rs = pstmt.executeQuery(); - while (rs.next()) - { - int id = rs.getInt(1); - String tableName = rs.getString(2); - String name = Msg.translate(Env.getCtx(), tableName+"_ID"); - // - ValueNamePair pp = new ValueNamePair(tableName, name); - cb.addItem(pp); - tableInfo.put (tableName, new Integer(id)); - if (id == AD_Table_ID) - select = pp; - } - rs.close(); - pstmt.close(); - } - catch (SQLException e) - { - log.log(Level.SEVERE, sql, e); - } - if (select != null) - cb.setSelectedItem(select); - } // fillTable - - /** - * Fill Org - * - * @param cb JComboBox to be filled - */ - protected void fillOrg (JComboBox cb) - { - KeyNamePair pp = new KeyNamePair(0, ""); - cb.addItem(pp); - String sql = "SELECT AD_Org_ID, Name FROM AD_Org WHERE AD_Client_ID=? ORDER BY Value"; - try - { - PreparedStatement pstmt = DB.prepareStatement(sql, null); - pstmt.setInt(1, AD_Client_ID); - ResultSet rs = pstmt.executeQuery(); - while (rs.next()) - cb.addItem(new KeyNamePair(rs.getInt(1), rs.getString(2))); - rs.close(); - pstmt.close(); - } - catch (SQLException e) - { - log.log(Level.SEVERE, sql, e); - } - } // fillOrg - - /** - * Get Button Text - * - * @param tableName table - * @param columnName column - * @param selectSQL sql - * @return Text on button - */ - protected String getButtonText (String tableName, String columnName, String selectSQL) - { - // SELECT () FROM tableName avd WHERE avd. - StringBuffer sql = new StringBuffer ("SELECT ("); - Language language = Env.getLanguage(Env.getCtx()); - sql.append(MLookupFactory.getLookup_TableDirEmbed(language, columnName, "avd")) - .append(") FROM ").append(tableName).append(" avd WHERE avd.").append(selectSQL); - String retValue = "<" + selectSQL + ">"; - try - { - Statement stmt = DB.createStatement(); - ResultSet rs = stmt.executeQuery(sql.toString()); - if (rs.next()) - retValue = rs.getString(1); - rs.close(); - stmt.close(); - } - catch (SQLException e) - { - log.log(Level.SEVERE, sql.toString(), e); - } - return retValue; - } // getButtonText - - /************************************************************************** - - /** - * Create Query and submit - * @return Report Model - */ - protected RModel query() - { - // Set Where Clause - StringBuffer whereClause = new StringBuffer(); - // Add Organization - if (C_AcctSchema_ID != 0) - whereClause.append(RModel.TABLE_ALIAS) - .append(".C_AcctSchema_ID=").append(C_AcctSchema_ID); - - // Posting Type Selected - if (PostingType != null && PostingType.length() > 0) - { - if (whereClause.length() > 0) - whereClause.append(" AND "); - whereClause.append(RModel.TABLE_ALIAS) - .append(".PostingType='").append(PostingType).append("'"); - } - - // - if (documentQuery) - { - if (whereClause.length() > 0) - whereClause.append(" AND "); - whereClause.append(RModel.TABLE_ALIAS).append(".AD_Table_ID=").append(AD_Table_ID) - .append(" AND ").append(RModel.TABLE_ALIAS).append(".Record_ID=").append(Record_ID); - } - else - { - // get values (Queries) - Iterator it = whereInfo.values().iterator(); - while (it.hasNext()) - { - String where = (String)it.next(); - if (where != null && where.length() > 0) // add only if not empty - { - if (whereClause.length() > 0) - whereClause.append(" AND "); - whereClause.append(RModel.TABLE_ALIAS).append(".").append(where); - } - } - if (DateFrom != null || DateTo != null) - { - if (whereClause.length() > 0) - whereClause.append(" AND "); - if (DateFrom != null && DateTo != null) - whereClause.append("TRUNC(").append(RModel.TABLE_ALIAS).append(".DateAcct) BETWEEN ") - .append(DB.TO_DATE(DateFrom)).append(" AND ").append(DB.TO_DATE(DateTo)); - else if (DateFrom != null) - whereClause.append("TRUNC(").append(RModel.TABLE_ALIAS).append(".DateAcct) >= ") - .append(DB.TO_DATE(DateFrom)); - else // DateTo != null - whereClause.append("TRUNC(").append(RModel.TABLE_ALIAS).append(".DateAcct) <= ") - .append(DB.TO_DATE(DateTo)); - } - // Add Organization - if (AD_Org_ID != 0) - { - if (whereClause.length() > 0) - whereClause.append(" AND "); - whereClause.append(RModel.TABLE_ALIAS).append(".AD_Org_ID=").append(AD_Org_ID); - } - } - + */ +class AcctViewerData +{ + /** + * Constructor + * @param ctx context + * @param windowNo window no + * @param ad_Client_ID client + * @param ad_Table_ID table + */ + public AcctViewerData (Properties ctx, int windowNo, int ad_Client_ID, int ad_Table_ID) + { + WindowNo = windowNo; + AD_Client_ID = ad_Client_ID; + if (AD_Client_ID == 0) + AD_Client_ID = Env.getContextAsInt(Env.getCtx(), WindowNo, "AD_Client_ID"); + if (AD_Client_ID == 0) + AD_Client_ID = Env.getContextAsInt(Env.getCtx(), "AD_Client_ID"); + AD_Table_ID = ad_Table_ID; + // + ASchemas = MAcctSchema.getClientAcctSchema(ctx, AD_Client_ID); + ASchema = ASchemas[0]; + } // AcctViewerData + + /** Window */ + public int WindowNo; + /** Client */ + public int AD_Client_ID; + /** All Acct Schema */ + public MAcctSchema[] ASchemas = null; + /** This Acct Schema */ + public MAcctSchema ASchema = null; + + // Selection Info + /** Document Query */ + public boolean documentQuery = false; + /** Acct Schema */ + public int C_AcctSchema_ID = 0; + /** Posting Type */ + public String PostingType = ""; + /** Organization */ + public int AD_Org_ID = 0; + /** Date From */ + public Timestamp DateFrom = null; + /** Date To */ + public Timestamp DateTo = null; + + // Document Table Selection Info + /** Table ID */ + public int AD_Table_ID; + /** Record */ + public int Record_ID; + + /** Containing Column and Query */ + public HashMap whereInfo = new HashMap(); + /** Containing TableName and AD_Table_ID */ + public HashMap tableInfo = new HashMap(); + + // Display Info + /** Display Qty */ + boolean displayQty = false; + /** Display Source Currency */ + boolean displaySourceAmt = false; + /** Display Document info */ + boolean displayDocumentInfo = false; + // + String sortBy1 = ""; + String sortBy2 = ""; + String sortBy3 = ""; + String sortBy4 = ""; + // + boolean group1 = false; + boolean group2 = false; + boolean group3 = false; + boolean group4 = false; + + /** Leasing Columns */ + private int m_leadingColumns = 0; + /** UserElement1 Reference */ + private String m_ref1 = null; + /** UserElement2 Reference */ + private String m_ref2 = null; + /** Logger */ + private static CLogger log = CLogger.getCLogger(AcctViewerData.class); + + /** + * Dispose + */ + public void dispose() + { + ASchemas = null; + ASchema = null; + // + whereInfo.clear(); + whereInfo = null; + // + Env.clearWinContext(WindowNo); + } // dispose + + + /************************************************************************** + * Fill Accounting Schema + * @param cb JComboBox to be filled + */ + protected void fillAcctSchema (JComboBox cb) + { + for (int i = 0; i < ASchemas.length; i++) + cb.addItem(new KeyNamePair(ASchemas[i].getC_AcctSchema_ID(), + ASchemas[i].getName())); + } // fillAcctSchema + + /** + * Fill Posting Type + * @param cb JComboBox to be filled + */ + protected void fillPostingType (JComboBox cb) + { + int AD_Reference_ID = HardCodedIDs.referencePostingType; + ValueNamePair[] pt = MRefList.getList(Env.getCtx(), AD_Reference_ID, true); + for (int i = 0; i < pt.length; i++) + cb.addItem(pt[i]); + } // fillPostingType + + /** + * Fill Table with + * ValueNamePair (TableName, translatedKeyColumnName) + * and tableInfo with (TableName, AD_Table_ID) + * and select the entry for AD_Table_ID + * + * @param cb JComboBox to be filled + */ + protected void fillTable (JComboBox cb) + { + ValueNamePair select = null; + // + String sql = "SELECT AD_Table_ID, TableName FROM AD_Table t " + + "WHERE EXISTS (SELECT * FROM AD_Column c" + + " WHERE t.AD_Table_ID=c.AD_Table_ID AND c.ColumnName='Posted')" + + " AND IsView='N'"; + try + { + PreparedStatement pstmt = DB.prepareStatement(sql, null); + ResultSet rs = pstmt.executeQuery(); + while (rs.next()) + { + int id = rs.getInt(1); + String tableName = rs.getString(2); + String name = Msg.translate(Env.getCtx(), tableName+"_ID"); + // + ValueNamePair pp = new ValueNamePair(tableName, name); + cb.addItem(pp); + tableInfo.put (tableName, new Integer(id)); + if (id == AD_Table_ID) + select = pp; + } + rs.close(); + pstmt.close(); + } + catch (SQLException e) + { + log.log(Level.SEVERE, sql, e); + } + if (select != null) + cb.setSelectedItem(select); + } // fillTable + + /** + * Fill Org + * + * @param cb JComboBox to be filled + */ + protected void fillOrg (JComboBox cb) + { + KeyNamePair pp = new KeyNamePair(0, ""); + cb.addItem(pp); + String sql = "SELECT AD_Org_ID, Name FROM AD_Org WHERE AD_Client_ID=? ORDER BY Value"; + try + { + PreparedStatement pstmt = DB.prepareStatement(sql, null); + pstmt.setInt(1, AD_Client_ID); + ResultSet rs = pstmt.executeQuery(); + while (rs.next()) + cb.addItem(new KeyNamePair(rs.getInt(1), rs.getString(2))); + rs.close(); + pstmt.close(); + } + catch (SQLException e) + { + log.log(Level.SEVERE, sql, e); + } + } // fillOrg + + /** + * Get Button Text + * + * @param tableName table + * @param columnName column + * @param selectSQL sql + * @return Text on button + */ + protected String getButtonText (String tableName, String columnName, String selectSQL) + { + // SELECT () FROM tableName avd WHERE avd. + StringBuffer sql = new StringBuffer ("SELECT ("); + Language language = Env.getLanguage(Env.getCtx()); + sql.append(MLookupFactory.getLookup_TableDirEmbed(language, columnName, "avd")) + .append(") FROM ").append(tableName).append(" avd WHERE avd.").append(selectSQL); + String retValue = "<" + selectSQL + ">"; + try + { + Statement stmt = DB.createStatement(); + ResultSet rs = stmt.executeQuery(sql.toString()); + if (rs.next()) + retValue = rs.getString(1); + rs.close(); + stmt.close(); + } + catch (SQLException e) + { + log.log(Level.SEVERE, sql.toString(), e); + } + return retValue; + } // getButtonText + + /************************************************************************** + + /** + * Create Query and submit + * @return Report Model + */ + protected RModel query() + { + // Set Where Clause + StringBuffer whereClause = new StringBuffer(); + // Add Organization + if (C_AcctSchema_ID != 0) + whereClause.append(RModel.TABLE_ALIAS) + .append(".C_AcctSchema_ID=").append(C_AcctSchema_ID); + + // Posting Type Selected + if (PostingType != null && PostingType.length() > 0) + { + if (whereClause.length() > 0) + whereClause.append(" AND "); + whereClause.append(RModel.TABLE_ALIAS) + .append(".PostingType='").append(PostingType).append("'"); + } + + // + if (documentQuery) + { + if (whereClause.length() > 0) + whereClause.append(" AND "); + whereClause.append(RModel.TABLE_ALIAS).append(".AD_Table_ID=").append(AD_Table_ID) + .append(" AND ").append(RModel.TABLE_ALIAS).append(".Record_ID=").append(Record_ID); + } + else + { + // get values (Queries) + Iterator it = whereInfo.values().iterator(); + while (it.hasNext()) + { + String where = (String)it.next(); + if (where != null && where.length() > 0) // add only if not empty + { + if (whereClause.length() > 0) + whereClause.append(" AND "); + whereClause.append(RModel.TABLE_ALIAS).append(".").append(where); + } + } + if (DateFrom != null || DateTo != null) + { + if (whereClause.length() > 0) + whereClause.append(" AND "); + if (DateFrom != null && DateTo != null) + whereClause.append("TRUNC(").append(RModel.TABLE_ALIAS).append(".DateAcct) BETWEEN ") + .append(DB.TO_DATE(DateFrom)).append(" AND ").append(DB.TO_DATE(DateTo)); + else if (DateFrom != null) + whereClause.append("TRUNC(").append(RModel.TABLE_ALIAS).append(".DateAcct) >= ") + .append(DB.TO_DATE(DateFrom)); + else // DateTo != null + whereClause.append("TRUNC(").append(RModel.TABLE_ALIAS).append(".DateAcct) <= ") + .append(DB.TO_DATE(DateTo)); + } + // Add Organization + if (AD_Org_ID != 0) + { + if (whereClause.length() > 0) + whereClause.append(" AND "); + whereClause.append(RModel.TABLE_ALIAS).append(".AD_Org_ID=").append(AD_Org_ID); + } + } + RModel rm = getRModel(); - // Set Order By Clause - StringBuffer orderClause = new StringBuffer(); - if (sortBy1.length() > 0) + // Set Order By Clause + StringBuffer orderClause = new StringBuffer(); + if (sortBy1.length() > 0) { RColumn col = rm.getRColumn(sortBy1); if (col != null) orderClause.append(col.getDisplaySQL()); else - orderClause.append(RModel.TABLE_ALIAS).append(".").append(sortBy1); + orderClause.append(RModel.TABLE_ALIAS).append(".").append(sortBy1); } - if (sortBy2.length() > 0) - { - if (orderClause.length() > 0) - orderClause.append(","); + if (sortBy2.length() > 0) + { + if (orderClause.length() > 0) + orderClause.append(","); RColumn col = rm.getRColumn(sortBy2); if (col != null) orderClause.append(col.getDisplaySQL()); else - orderClause.append(RModel.TABLE_ALIAS).append(".").append(sortBy2); - } - if (sortBy3.length() > 0) - { - if (orderClause.length() > 0) - orderClause.append(","); + orderClause.append(RModel.TABLE_ALIAS).append(".").append(sortBy2); + } + if (sortBy3.length() > 0) + { + if (orderClause.length() > 0) + orderClause.append(","); RColumn col = rm.getRColumn(sortBy3); if (col != null) orderClause.append(col.getDisplaySQL()); else - orderClause.append(RModel.TABLE_ALIAS).append(".").append(sortBy3); - } - if (sortBy4.length() > 0) - { - if (orderClause.length() > 0) - orderClause.append(","); + orderClause.append(RModel.TABLE_ALIAS).append(".").append(sortBy3); + } + if (sortBy4.length() > 0) + { + if (orderClause.length() > 0) + orderClause.append(","); RColumn col = rm.getRColumn(sortBy4); if (col != null) orderClause.append(col.getDisplaySQL()); else - orderClause.append(RModel.TABLE_ALIAS).append(".").append(sortBy4); - } - if (orderClause.length() == 0) - orderClause.append(RModel.TABLE_ALIAS).append(".Fact_Acct_ID"); - - // Groups - if (group1 && sortBy1.length() > 0) - rm.setGroup(sortBy1); - if (group2 && sortBy2.length() > 0) - rm.setGroup(sortBy2); - if (group3 && sortBy3.length() > 0) - rm.setGroup(sortBy3); - if (group4 && sortBy4.length() > 0) - rm.setGroup(sortBy4); - - // Totals - rm.setFunction("AmtAcctDr", RModel.FUNCTION_SUM); - rm.setFunction("AmtAcctCr", RModel.FUNCTION_SUM); - - rm.query (Env.getCtx(), whereClause.toString(), orderClause.toString()); - - return rm; - } // query - - /** - * Create Report Model (Columns) - * @return Report Model - */ - private RModel getRModel() - { - Properties ctx = Env.getCtx(); - RModel rm = new RModel("Fact_Acct"); - // Add Key (Lookups) - ArrayList keys = createKeyColumns(); - int max = m_leadingColumns; - if (max == 0) - max = keys.size(); - for (int i = 0; i < max; i++) - { - String column = (String)keys.get(i); - if (column != null && column.startsWith("Date")) - rm.addColumn(new RColumn(ctx, column, DisplayType.Date)); - else if (column != null && column.endsWith("_ID")) - rm.addColumn(new RColumn(ctx, column, DisplayType.TableDir)); - } - // Main Info - rm.addColumn(new RColumn(ctx, "AmtAcctDr", DisplayType.Amount)); - rm.addColumn(new RColumn(ctx, "AmtAcctCr", DisplayType.Amount)); - if (displaySourceAmt) - { - if (!keys.contains("DateTrx")) - rm.addColumn(new RColumn(ctx, "DateTrx", DisplayType.Date)); - rm.addColumn(new RColumn(ctx, "C_Currency_ID", DisplayType.TableDir)); - rm.addColumn(new RColumn(ctx, "AmtSourceDr", DisplayType.Amount)); - rm.addColumn(new RColumn(ctx, "AmtSourceCr", DisplayType.Amount)); - rm.addColumn(new RColumn(ctx, "Rate", DisplayType.Amount, - "CASE WHEN (AmtSourceDr + AmtSourceCr) = 0 THEN 0" - + " ELSE (AmtAcctDr + AmtAcctCr) / (AmtSourceDr + AmtSourceCr) END")); - } - // Remaining Keys - for (int i = max; i < keys.size(); i++) - { - String column = (String)keys.get(i); - if (column != null && column.startsWith("Date")) - rm.addColumn(new RColumn(ctx, column, DisplayType.Date)); - else if (column.startsWith("UserElement")) - { - if (column.indexOf('1') != -1) - rm.addColumn(new RColumn(ctx, column, DisplayType.TableDir, null, 0, m_ref1)); - else - rm.addColumn(new RColumn(ctx, column, DisplayType.TableDir, null, 0, m_ref2)); - } - else if (column != null && column.endsWith("_ID")) - rm.addColumn(new RColumn(ctx, column, DisplayType.TableDir)); - } - // Info - if (!keys.contains("DateAcct")) - rm.addColumn(new RColumn(ctx, "DateAcct", DisplayType.Date)); - if (!keys.contains("C_Period_ID")) - rm.addColumn(new RColumn(ctx, "C_Period_ID", DisplayType.TableDir)); - if (displayQty) - { - rm.addColumn(new RColumn(ctx, "C_UOM_ID", DisplayType.TableDir)); - rm.addColumn(new RColumn(ctx, "Qty", DisplayType.Quantity)); - } - if (displayDocumentInfo) - { - rm.addColumn(new RColumn(ctx, "AD_Table_ID", DisplayType.TableDir)); - rm.addColumn(new RColumn(ctx, "Record_ID", DisplayType.ID)); + orderClause.append(RModel.TABLE_ALIAS).append(".").append(sortBy4); + } + if (orderClause.length() == 0) + orderClause.append(RModel.TABLE_ALIAS).append(".Fact_Acct_ID"); + + // Groups + if (group1 && sortBy1.length() > 0) + rm.setGroup(sortBy1); + if (group2 && sortBy2.length() > 0) + rm.setGroup(sortBy2); + if (group3 && sortBy3.length() > 0) + rm.setGroup(sortBy3); + if (group4 && sortBy4.length() > 0) + rm.setGroup(sortBy4); + + // Totals + rm.setFunction("AmtAcctDr", RModel.FUNCTION_SUM); + rm.setFunction("AmtAcctCr", RModel.FUNCTION_SUM); + + rm.query (Env.getCtx(), whereClause.toString(), orderClause.toString()); + + return rm; + } // query + + /** + * Create Report Model (Columns) + * @return Report Model + */ + private RModel getRModel() + { + Properties ctx = Env.getCtx(); + RModel rm = new RModel("Fact_Acct"); + // Add Key (Lookups) + ArrayList keys = createKeyColumns(); + int max = m_leadingColumns; + if (max == 0) + max = keys.size(); + for (int i = 0; i < max; i++) + { + String column = (String)keys.get(i); + if (column != null && column.startsWith("Date")) + rm.addColumn(new RColumn(ctx, column, DisplayType.Date)); + else if (column != null && column.endsWith("_ID")) + rm.addColumn(new RColumn(ctx, column, DisplayType.TableDir)); + } + // Main Info + rm.addColumn(new RColumn(ctx, "AmtAcctDr", DisplayType.Amount)); + rm.addColumn(new RColumn(ctx, "AmtAcctCr", DisplayType.Amount)); + if (displaySourceAmt) + { + if (!keys.contains("DateTrx")) + rm.addColumn(new RColumn(ctx, "DateTrx", DisplayType.Date)); + rm.addColumn(new RColumn(ctx, "C_Currency_ID", DisplayType.TableDir)); + rm.addColumn(new RColumn(ctx, "AmtSourceDr", DisplayType.Amount)); + rm.addColumn(new RColumn(ctx, "AmtSourceCr", DisplayType.Amount)); + rm.addColumn(new RColumn(ctx, "Rate", DisplayType.Amount, + "CASE WHEN (AmtSourceDr + AmtSourceCr) = 0 THEN 0" + + " ELSE (AmtAcctDr + AmtAcctCr) / (AmtSourceDr + AmtSourceCr) END")); + } + // Remaining Keys + for (int i = max; i < keys.size(); i++) + { + String column = (String)keys.get(i); + if (column != null && column.startsWith("Date")) + rm.addColumn(new RColumn(ctx, column, DisplayType.Date)); + else if (column.startsWith("UserElement")) + { + if (column.indexOf('1') != -1) + rm.addColumn(new RColumn(ctx, column, DisplayType.TableDir, null, 0, m_ref1)); + else + rm.addColumn(new RColumn(ctx, column, DisplayType.TableDir, null, 0, m_ref2)); + } + else if (column != null && column.endsWith("_ID")) + rm.addColumn(new RColumn(ctx, column, DisplayType.TableDir)); + } + // Info + if (!keys.contains("DateAcct")) + rm.addColumn(new RColumn(ctx, "DateAcct", DisplayType.Date)); + if (!keys.contains("C_Period_ID")) + rm.addColumn(new RColumn(ctx, "C_Period_ID", DisplayType.TableDir)); + if (displayQty) + { + rm.addColumn(new RColumn(ctx, "C_UOM_ID", DisplayType.TableDir)); + rm.addColumn(new RColumn(ctx, "Qty", DisplayType.Quantity)); + } + if (displayDocumentInfo) + { + rm.addColumn(new RColumn(ctx, "AD_Table_ID", DisplayType.TableDir)); + rm.addColumn(new RColumn(ctx, "Record_ID", DisplayType.ID)); rm.addColumn(new RColumn(ctx, "Description", DisplayType.String)); } if (PostingType == null || PostingType.length() == 0) @@ -486,46 +487,46 @@ class AcctViewerData null)); return rm; } // createRModel - - /** - * Create the key columns in sequence - * @return List of Key Columns - */ - private ArrayList createKeyColumns() - { - ArrayList columns = new ArrayList(); - m_leadingColumns = 0; - // Sorting Fields - columns.add(sortBy1); // may add "" - if (!columns.contains(sortBy2)) - columns.add(sortBy2); - if (!columns.contains(sortBy3)) - columns.add(sortBy3); - if (!columns.contains(sortBy4)) - columns.add(sortBy4); - - // Add Account Segments - MAcctSchemaElement[] elements = ASchema.getAcctSchemaElements(); - for (int i = 0; i < elements.length; i++) - { - if (m_leadingColumns == 0 && columns.contains("AD_Org_ID") && columns.contains("Account_ID")) - m_leadingColumns = columns.size(); - // - MAcctSchemaElement ase = elements[i]; - String columnName = ase.getColumnName(); - if (columnName.startsWith("UserElement")) - { - if (columnName.indexOf('1') != -1) - m_ref1 = ase.getDisplayColumnName(); - else - m_ref2 = ase.getDisplayColumnName(); - } - if (!columns.contains(columnName)) - columns.add(columnName); - } - if (m_leadingColumns == 0 && columns.contains("AD_Org_ID") && columns.contains("Account_ID")) - m_leadingColumns = columns.size(); - return columns; - } // createKeyColumns - -} // AcctViewerData + + /** + * Create the key columns in sequence + * @return List of Key Columns + */ + private ArrayList createKeyColumns() + { + ArrayList columns = new ArrayList(); + m_leadingColumns = 0; + // Sorting Fields + columns.add(sortBy1); // may add "" + if (!columns.contains(sortBy2)) + columns.add(sortBy2); + if (!columns.contains(sortBy3)) + columns.add(sortBy3); + if (!columns.contains(sortBy4)) + columns.add(sortBy4); + + // Add Account Segments + MAcctSchemaElement[] elements = ASchema.getAcctSchemaElements(); + for (int i = 0; i < elements.length; i++) + { + if (m_leadingColumns == 0 && columns.contains("AD_Org_ID") && columns.contains("Account_ID")) + m_leadingColumns = columns.size(); + // + MAcctSchemaElement ase = elements[i]; + String columnName = ase.getColumnName(); + if (columnName.startsWith("UserElement")) + { + if (columnName.indexOf('1') != -1) + m_ref1 = ase.getDisplayColumnName(); + else + m_ref2 = ase.getDisplayColumnName(); + } + if (!columns.contains(columnName)) + columns.add(columnName); + } + if (m_leadingColumns == 0 && columns.contains("AD_Org_ID") && columns.contains("Account_ID")) + m_leadingColumns = columns.size(); + return columns; + } // createKeyColumns + +} // AcctViewerData diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java b/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java index 6e18b6e81e..545a1ff7d2 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java @@ -58,6 +58,7 @@ import org.compiere.apps.wf.WFActivity; import org.compiere.apps.wf.WFPanel; import org.compiere.db.CConnection; import org.compiere.grid.tree.VTreePanel; +import org.compiere.model.HardCodedIDs; import org.compiere.model.MRole; import org.compiere.model.MSession; import org.compiere.model.MSysConfig; @@ -687,7 +688,7 @@ public final class AMenu extends CFrame // + " INNER JOIN AD_TABLE t ON (t.AD_Window_ID=m.AD_Window_ID) " // + "WHERE t.AD_Table_ID=?", 417); if (m_request_Menu_ID == 0) - m_request_Menu_ID = 237; // My Requests + m_request_Menu_ID = HardCodedIDs.windowMyRequests; // My Requests (new AMenuStartItem (m_request_Menu_ID, true, Msg.translate(m_ctx, "R_Request_ID"), this)).start(); // async load } // gotoRequests From b0c67e88973755a61ed06a0e389c057d678b50ac Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Wed, 18 Apr 2012 15:52:06 +0200 Subject: [PATCH 06/49] IDEMPIERE-239 --- org.adempiere.base/src/org/compiere/acct/Doc.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/org.adempiere.base/src/org/compiere/acct/Doc.java b/org.adempiere.base/src/org/compiere/acct/Doc.java index 84387501f0..bd1a897ab3 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc.java @@ -457,6 +457,8 @@ public abstract class Doc + get_ID() + ", Force=" + force + ",RePost=" + repost); if (force) return "Cannot Lock - ReSubmit"; + if (DB.getSQLValueStringEx(trxName, "SELECT IsActive FROM " + get_TableName() + " WHERE " + get_TableName() + "_ID=" + get_ID()).equals("N")) + return "Impossible to post deactivated document"; return "Cannot Lock - ReSubmit or RePost with Force"; } From a53fd5c08fa6bf60046763b67714aa91f98d0827 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Wed, 18 Apr 2012 16:04:01 +0200 Subject: [PATCH 07/49] IDEMPIERE-236 Centralization of hardcoded IDs / using naming convention for constants --- .../src/org/compiere/model/HardCodedIDs.java | 7 +++---- .../src/org/compiere/acct/AcctViewerData.java | 2 +- org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/HardCodedIDs.java b/org.adempiere.base/src/org/compiere/model/HardCodedIDs.java index db1a37c846..7b5b18dc93 100644 --- a/org.adempiere.base/src/org/compiere/model/HardCodedIDs.java +++ b/org.adempiere.base/src/org/compiere/model/HardCodedIDs.java @@ -23,9 +23,8 @@ package org.compiere.model; public class HardCodedIDs { - public static int referencePostingType = 125; - - - public static int windowMyRequests = 237; + public final static int REFERENCE_POSTING_TYPE = 125; + + public final static int WINDOW_MY_REQUESTS = 237; } diff --git a/org.adempiere.ui.swing/src/org/compiere/acct/AcctViewerData.java b/org.adempiere.ui.swing/src/org/compiere/acct/AcctViewerData.java index 5b4b4fd56a..b6ac6c1716 100644 --- a/org.adempiere.ui.swing/src/org/compiere/acct/AcctViewerData.java +++ b/org.adempiere.ui.swing/src/org/compiere/acct/AcctViewerData.java @@ -173,7 +173,7 @@ class AcctViewerData */ protected void fillPostingType (JComboBox cb) { - int AD_Reference_ID = HardCodedIDs.referencePostingType; + int AD_Reference_ID = HardCodedIDs.REFERENCE_POSTING_TYPE; ValueNamePair[] pt = MRefList.getList(Env.getCtx(), AD_Reference_ID, true); for (int i = 0; i < pt.length; i++) cb.addItem(pt[i]); diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java b/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java index 545a1ff7d2..7492fd59ec 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java @@ -688,7 +688,7 @@ public final class AMenu extends CFrame // + " INNER JOIN AD_TABLE t ON (t.AD_Window_ID=m.AD_Window_ID) " // + "WHERE t.AD_Table_ID=?", 417); if (m_request_Menu_ID == 0) - m_request_Menu_ID = HardCodedIDs.windowMyRequests; // My Requests + m_request_Menu_ID = HardCodedIDs.WINDOW_MY_REQUESTS; // My Requests (new AMenuStartItem (m_request_Menu_ID, true, Msg.translate(m_ctx, "R_Request_ID"), this)).start(); // async load } // gotoRequests From 644207b9995cba8c3304361346c47e73b62d921b Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Wed, 18 Apr 2012 16:36:35 +0200 Subject: [PATCH 08/49] IDEMPIERE-239 - smart way ; using IsActive() instead of SQL --- org.adempiere.base/src/org/compiere/acct/Doc.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/acct/Doc.java b/org.adempiere.base/src/org/compiere/acct/Doc.java index bd1a897ab3..1f5aed2dcb 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc.java @@ -455,10 +455,10 @@ public abstract class Doc { log.log(Level.SEVERE, "Resubmit - Cannot lock " + get_TableName() + "_ID=" + get_ID() + ", Force=" + force + ",RePost=" + repost); + if (!p_po.isActive()) + return "Cannot post inactive document"; if (force) return "Cannot Lock - ReSubmit"; - if (DB.getSQLValueStringEx(trxName, "SELECT IsActive FROM " + get_TableName() + " WHERE " + get_TableName() + "_ID=" + get_ID()).equals("N")) - return "Impossible to post deactivated document"; return "Cannot Lock - ReSubmit or RePost with Force"; } From 37a4b33bf6bc357c6ba327b00415d3c6bb76a374 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 18 Apr 2012 10:31:32 -0500 Subject: [PATCH 09/49] IDEMPIERE-241 Unnecessary cost records added on product creation Code integrated from Compiere community 3.3.0 version --- .../src/org/compiere/model/MCost.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MCost.java b/org.adempiere.base/src/org/compiere/model/MCost.java index a68f3443b4..831ae108c9 100644 --- a/org.adempiere.base/src/org/compiere/model/MCost.java +++ b/org.adempiere.base/src/org/compiere/model/MCost.java @@ -708,7 +708,20 @@ public class MCost extends X_M_Cost s_log.config(product.getName()); // Cost Elements - List ces = MCostElement.getCostElementsWithCostingMethods(product); + MCostElement[] ces = MCostElement.getCostingMethods(product); + MCostElement ce = null; + for (MCostElement element : ces) { + if (X_M_CostElement.COSTINGMETHOD_StandardCosting.equals(element.getCostingMethod())) + { + ce = element; + break; + } + } + if (ce == null) + { + s_log.fine("No Standard Costing in System"); + return; + } MAcctSchema[] mass = MAcctSchema.getClientAcctSchema(product.getCtx(), product.getAD_Client_ID(), product.get_TrxName()); @@ -720,8 +733,6 @@ public class MCost extends X_M_Cost String cl = product.getCostingLevel(as); // Create Std Costing if (MAcctSchema.COSTINGLEVEL_Client.equals(cl)) - { - for(MCostElement ce : ces) { MCost cost = MCost.get (product, M_ASI_ID, as, 0, ce.getM_CostElement_ID(), product.get_TrxName()); @@ -735,15 +746,12 @@ public class MCost extends X_M_Cost + " - " + as.getName()); } } - } else if (MAcctSchema.COSTINGLEVEL_Organization.equals(cl)) { if (orgs == null) orgs = MOrg.getOfClient(product); for (MOrg o : orgs) { - for(MCostElement ce : ces) - { MCost cost = MCost.get (product, M_ASI_ID, as, o.getAD_Org_ID(), ce.getM_CostElement_ID(), product.get_TrxName()); if (cost.is_new()) @@ -756,7 +764,6 @@ public class MCost extends X_M_Cost s_log.warning("Not created: Std.Cost for " + product.getName() + " - " + o.getName() + " - " + as.getName()); - } } } // for all orgs } From 3a0f716618c99dce5ba143c85506afe605cc3dc9 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 18 Apr 2012 10:59:22 -0500 Subject: [PATCH 10/49] IDEMPIERE-195 Expand menu automatically / make user preference override the role configuration http://jira.idempiere.com/browse/IDEMPIERE-195 --- .../oracle/837_IDEMPIERE-195.sql | 22 ++++++++++++++++ .../postgresql/837_IDEMPIERE-195.sql | 22 ++++++++++++++++ .../src/org/compiere/model/I_AD_User.java | 5 ++-- .../src/org/compiere/model/MUser.java | 18 ++++++++++--- .../src/org/compiere/model/X_AD_User.java | 26 +++++++++---------- .../src/org/compiere/apps/AMenu.java | 2 +- .../org/adempiere/webui/panel/MenuPanel.java | 2 +- 7 files changed, 75 insertions(+), 22 deletions(-) create mode 100644 migration/360lts-release/oracle/837_IDEMPIERE-195.sql create mode 100644 migration/360lts-release/postgresql/837_IDEMPIERE-195.sql diff --git a/migration/360lts-release/oracle/837_IDEMPIERE-195.sql b/migration/360lts-release/oracle/837_IDEMPIERE-195.sql new file mode 100644 index 0000000000..9cf01d6e00 --- /dev/null +++ b/migration/360lts-release/oracle/837_IDEMPIERE-195.sql @@ -0,0 +1,22 @@ +-- Apr 18, 2012 10:41:39 AM COT +-- IDEMPIERE-195 Expand menu automatically +UPDATE AD_Column SET AD_Reference_ID=17, AD_Reference_Value_ID=319, DefaultValue=NULL, IsMandatory='N',Updated=TO_DATE('2012-04-18 10:41:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200113 +; + +-- Apr 18, 2012 10:41:41 AM COT +-- IDEMPIERE-195 Expand menu automatically +ALTER TABLE AD_User MODIFY IsMenuAutoExpand CHAR(1) DEFAULT NULL +; + +-- Apr 18, 2012 10:41:44 AM COT +-- IDEMPIERE-195 Expand menu automatically +ALTER TABLE AD_User MODIFY IsMenuAutoExpand NULL +; + +UPDATE AD_User SET IsMenuAutoExpand=NULL; + +UPDATE AD_System + SET LastMigrationScriptApplied='837_IDEMPIERE-195.sql' +WHERE LastMigrationScriptApplied<'837_IDEMPIERE-195.sql' + OR LastMigrationScriptApplied IS NULL +; diff --git a/migration/360lts-release/postgresql/837_IDEMPIERE-195.sql b/migration/360lts-release/postgresql/837_IDEMPIERE-195.sql new file mode 100644 index 0000000000..8dc78e9449 --- /dev/null +++ b/migration/360lts-release/postgresql/837_IDEMPIERE-195.sql @@ -0,0 +1,22 @@ +-- Apr 18, 2012 10:41:39 AM COT +-- IDEMPIERE-195 Expand menu automatically +UPDATE AD_Column SET AD_Reference_ID=17, AD_Reference_Value_ID=319, DefaultValue=NULL, IsMandatory='N',Updated=TO_TIMESTAMP('2012-04-18 10:41:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200113 +; + +-- Apr 18, 2012 10:41:41 AM COT +-- IDEMPIERE-195 Expand menu automatically +INSERT INTO t_alter_column values('ad_user','IsMenuAutoExpand','CHAR(1)',null,'NULL') +; + +-- Apr 18, 2012 10:41:44 AM COT +-- IDEMPIERE-195 Expand menu automatically +INSERT INTO t_alter_column values('ad_user','IsMenuAutoExpand',null,'NULL',null) +; + +UPDATE AD_User SET IsMenuAutoExpand=NULL; + +UPDATE AD_System + SET LastMigrationScriptApplied='837_IDEMPIERE-195.sql' +WHERE LastMigrationScriptApplied<'837_IDEMPIERE-195.sql' + OR LastMigrationScriptApplied IS NULL +; diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_User.java b/org.adempiere.base/src/org/compiere/model/I_AD_User.java index 58837e3e97..e2d9f4f216 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_User.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_User.java @@ -18,7 +18,6 @@ package org.compiere.model; import java.math.BigDecimal; import java.sql.Timestamp; -import org.compiere.model.*; import org.compiere.util.KeyNamePair; /** Generated Interface for AD_User @@ -340,12 +339,12 @@ public interface I_AD_User /** Set Auto expand menu. * If ticked, the menu is automatically expanded */ - public void setIsMenuAutoExpand (boolean IsMenuAutoExpand); + public void setIsMenuAutoExpand (String IsMenuAutoExpand); /** Get Auto expand menu. * If ticked, the menu is automatically expanded */ - public boolean isMenuAutoExpand(); + public String getIsMenuAutoExpand(); /** Column name LastContact */ public static final String COLUMNNAME_LastContact = "LastContact"; diff --git a/org.adempiere.base/src/org/compiere/model/MUser.java b/org.adempiere.base/src/org/compiere/model/MUser.java index e7a5de22e0..522befcfcd 100644 --- a/org.adempiere.base/src/org/compiere/model/MUser.java +++ b/org.adempiere.base/src/org/compiere/model/MUser.java @@ -50,8 +50,7 @@ public class MUser extends X_AD_User /** * */ - private static final long serialVersionUID = 1399447378628744412L; - + private static final long serialVersionUID = -5845477151929518375L; /** * Get active Users of BPartner @@ -804,7 +803,20 @@ public class MUser extends X_AD_User setValue(super.getValue()); return true; } // beforeSave - + + /** + * Is Menu Auto Expand - user preference + * Check if the user has a preference, otherwise use the value from current role + * @return boolean + */ + public boolean isMenuAutoExpand() { + boolean isMenuAutoExpand = false; + if (getIsMenuAutoExpand() != null) + isMenuAutoExpand = ISMENUAUTOEXPAND_Yes.equals(getIsMenuAutoExpand()); + else + isMenuAutoExpand = MRole.getDefault().isMenuAutoExpand(); + return isMenuAutoExpand; + } /** * Test diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_User.java b/org.adempiere.base/src/org/compiere/model/X_AD_User.java index c2457d4ed3..8b61c745d2 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_User.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_User.java @@ -31,7 +31,7 @@ public class X_AD_User extends PO implements I_AD_User, I_Persistent /** * */ - private static final long serialVersionUID = 20120412L; + private static final long serialVersionUID = 20120418L; /** Standard Constructor */ public X_AD_User (Properties ctx, int AD_User_ID, String trxName) @@ -43,8 +43,6 @@ public class X_AD_User extends PO implements I_AD_User, I_Persistent setIsFullBPAccess (true); // Y setIsInPayroll (false); -// N - setIsMenuAutoExpand (false); // N setName (null); setNotificationType (null); @@ -467,28 +465,28 @@ public class X_AD_User extends PO implements I_AD_User, I_Persistent return false; } + /** IsMenuAutoExpand AD_Reference_ID=319 */ + public static final int ISMENUAUTOEXPAND_AD_Reference_ID=319; + /** Yes = Y */ + public static final String ISMENUAUTOEXPAND_Yes = "Y"; + /** No = N */ + public static final String ISMENUAUTOEXPAND_No = "N"; /** Set Auto expand menu. @param IsMenuAutoExpand If ticked, the menu is automatically expanded */ - public void setIsMenuAutoExpand (boolean IsMenuAutoExpand) + public void setIsMenuAutoExpand (String IsMenuAutoExpand) { - set_Value (COLUMNNAME_IsMenuAutoExpand, Boolean.valueOf(IsMenuAutoExpand)); + + set_Value (COLUMNNAME_IsMenuAutoExpand, IsMenuAutoExpand); } /** Get Auto expand menu. @return If ticked, the menu is automatically expanded */ - public boolean isMenuAutoExpand () + public String getIsMenuAutoExpand () { - Object oo = get_Value(COLUMNNAME_IsMenuAutoExpand); - if (oo != null) - { - if (oo instanceof Boolean) - return ((Boolean)oo).booleanValue(); - return "Y".equals(oo); - } - return false; + return (String)get_Value(COLUMNNAME_IsMenuAutoExpand); } /** Set Last Contact. diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java b/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java index 7492fd59ec..7abd543ed0 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java @@ -198,7 +198,7 @@ public final class AMenu extends CFrame infoUpdaterThread.start(); // Auto Expand Tree - nmicoud IDEMPIERE 195 - if (MRole.getDefault().isMenuAutoExpand() || MUser.get(m_ctx).isMenuAutoExpand()) + if (MUser.get(m_ctx).isMenuAutoExpand()) treePanel.expandTree(true); // Auto Expand Tree - nmicoud IDEMPIERE 195 diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java index a5602c0c22..f761c4c665 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java @@ -84,7 +84,7 @@ public class MenuPanel extends Panel implements EventListener pnlSearch.initialise(); // Auto Expand Tree - nmicoud IDEMPIERE 195 - if (MRole.getDefault().isMenuAutoExpand() || MUser.get(ctx).isMenuAutoExpand()) + if (MUser.get(ctx).isMenuAutoExpand()) expandAll(); // Auto Expand Tree - nmicoud IDEMPIERE 195 } From 5457709c6aae7b81fd25719225f80170a27eb87d Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Fri, 20 Apr 2012 11:52:52 -0500 Subject: [PATCH 11/49] IDEMPIERE-236 Centralization of hardcoded IDs / using interface / rename class > SystemIDs --- .../{HardCodedIDs.java => SystemIDs.java} | 61 ++++++++++--------- .../src/org/compiere/acct/AcctViewerData.java | 6 +- .../src/org/compiere/apps/AMenu.java | 6 +- 3 files changed, 37 insertions(+), 36 deletions(-) rename org.adempiere.base/src/org/compiere/model/{HardCodedIDs.java => SystemIDs.java} (96%) diff --git a/org.adempiere.base/src/org/compiere/model/HardCodedIDs.java b/org.adempiere.base/src/org/compiere/model/SystemIDs.java similarity index 96% rename from org.adempiere.base/src/org/compiere/model/HardCodedIDs.java rename to org.adempiere.base/src/org/compiere/model/SystemIDs.java index 7b5b18dc93..5a63bb14e8 100644 --- a/org.adempiere.base/src/org/compiere/model/HardCodedIDs.java +++ b/org.adempiere.base/src/org/compiere/model/SystemIDs.java @@ -1,30 +1,31 @@ -/****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * - * Copyright (C) 1999-2006 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; - -/** - * List all hardcoded ID used in the code - * @author Carlos Ruiz, Nicolas Micoud, ... - */ - -public class HardCodedIDs { - - public final static int REFERENCE_POSTING_TYPE = 125; - - public final static int WINDOW_MY_REQUESTS = 237; - -} +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 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; + +/** + * List all hardcoded ID used in the code + * @author Carlos Ruiz, Nicolas Micoud, ... + */ + +public interface SystemIDs +{ + + public final static int REFERENCE_POSTING_TYPE = 125; + + public final static int WINDOW_MY_REQUESTS = 237; + +} diff --git a/org.adempiere.ui.swing/src/org/compiere/acct/AcctViewerData.java b/org.adempiere.ui.swing/src/org/compiere/acct/AcctViewerData.java index b6ac6c1716..ea36cb03b5 100644 --- a/org.adempiere.ui.swing/src/org/compiere/acct/AcctViewerData.java +++ b/org.adempiere.ui.swing/src/org/compiere/acct/AcctViewerData.java @@ -29,7 +29,7 @@ import java.util.logging.Level; import javax.swing.JComboBox; -import org.compiere.model.HardCodedIDs; +import org.compiere.model.SystemIDs; import org.compiere.model.MAcctSchema; import org.compiere.model.MAcctSchemaElement; import org.compiere.model.MFactAcct; @@ -57,7 +57,7 @@ import org.compiere.util.ValueNamePair; *
  • BF [ 1748449 ] Info Account - Posting Type is not translated *
  • BF [ 1778373 ] AcctViewer: data is not sorted proper */ -class AcctViewerData +class AcctViewerData implements SystemIDs { /** * Constructor @@ -173,7 +173,7 @@ class AcctViewerData */ protected void fillPostingType (JComboBox cb) { - int AD_Reference_ID = HardCodedIDs.REFERENCE_POSTING_TYPE; + int AD_Reference_ID = REFERENCE_POSTING_TYPE; ValueNamePair[] pt = MRefList.getList(Env.getCtx(), AD_Reference_ID, true); for (int i = 0; i < pt.length; i++) cb.addItem(pt[i]); diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java b/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java index 7abd543ed0..a080d00ded 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java @@ -58,13 +58,13 @@ import org.compiere.apps.wf.WFActivity; import org.compiere.apps.wf.WFPanel; import org.compiere.db.CConnection; import org.compiere.grid.tree.VTreePanel; -import org.compiere.model.HardCodedIDs; import org.compiere.model.MRole; import org.compiere.model.MSession; import org.compiere.model.MSysConfig; import org.compiere.model.MSystem; import org.compiere.model.MTreeNode; import org.compiere.model.MUser; +import org.compiere.model.SystemIDs; import org.compiere.swing.CButton; import org.compiere.swing.CFrame; import org.compiere.swing.CPanel; @@ -93,7 +93,7 @@ import org.compiere.util.Splash; * */ public final class AMenu extends CFrame - implements ActionListener, PropertyChangeListener, ChangeListener, IEnvEventListener + implements ActionListener, PropertyChangeListener, ChangeListener, IEnvEventListener, SystemIDs { /** * generated serialVersionUID @@ -688,7 +688,7 @@ public final class AMenu extends CFrame // + " INNER JOIN AD_TABLE t ON (t.AD_Window_ID=m.AD_Window_ID) " // + "WHERE t.AD_Table_ID=?", 417); if (m_request_Menu_ID == 0) - m_request_Menu_ID = HardCodedIDs.WINDOW_MY_REQUESTS; // My Requests + m_request_Menu_ID = WINDOW_MY_REQUESTS; // My Requests (new AMenuStartItem (m_request_Menu_ID, true, Msg.translate(m_ctx, "R_Request_ID"), this)).start(); // async load } // gotoRequests From 2feccac9e5c9472f0a0e5ee1fbfbf25eaec107dc Mon Sep 17 00:00:00 2001 From: Dirk Niemeyer Date: Thu, 19 Apr 2012 12:25:22 +0200 Subject: [PATCH 12/49] IDEMPIERE-242 ImageField not working in non form based print format Use correct ImageElement.get --- .../src/org/compiere/print/layout/LayoutEngine.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java b/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java index 54924afd5a..d27c43a252 100644 --- a/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java +++ b/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java @@ -1697,7 +1697,7 @@ public class LayoutEngine implements Pageable, Printable, Doc else value = o.toString(); - data[row][col] = ImageElement.get (value); + data[row][col] = ImageElement.get (pde, value); } } else if (item.isImageIsAttached()) From 78c3175f317019f67a081f867c622527f4ddcd29 Mon Sep 17 00:00:00 2001 From: Edwin Ang Date: Mon, 9 Apr 2012 15:01:30 +0700 Subject: [PATCH 13/49] exception handling processIt on BankTransfer.java --- .../src/org/eevolution/process/BankTransfer.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/eevolution/process/BankTransfer.java b/org.adempiere.base/src/org/eevolution/process/BankTransfer.java index a5e30b02fa..cec01302b0 100644 --- a/org.adempiere.base/src/org/eevolution/process/BankTransfer.java +++ b/org.adempiere.base/src/org/eevolution/process/BankTransfer.java @@ -159,7 +159,10 @@ public class BankTransfer extends SvrProcess paymentBankFrom.setC_DocType_ID(false); paymentBankFrom.setC_Charge_ID(p_C_Charge_ID); paymentBankFrom.saveEx(); - paymentBankFrom.processIt(MPayment.DOCACTION_Complete); + if(!paymentBankFrom.processIt(MPayment.DOCACTION_Complete)) { + log.warning("Payment Process Failed: " + paymentBankFrom + " - " + paymentBankFrom.getProcessMsg()); + throw new IllegalStateException("Payment Process Failed: " + paymentBankFrom + " - " + paymentBankFrom.getProcessMsg()); + } paymentBankFrom.saveEx(); MPayment paymentBankTo = new MPayment(getCtx(), 0 , get_TrxName()); @@ -178,7 +181,10 @@ public class BankTransfer extends SvrProcess paymentBankTo.setC_DocType_ID(true); paymentBankTo.setC_Charge_ID(p_C_Charge_ID); paymentBankTo.saveEx(); - paymentBankTo.processIt(MPayment.DOCACTION_Complete); + if (!paymentBankTo.processIt(MPayment.DOCACTION_Complete)) { + log.warning("Payment Process Failed: " + paymentBankTo + " - " + paymentBankTo.getProcessMsg()); + throw new IllegalStateException("Payment Process Failed: " + paymentBankTo + " - " + paymentBankTo.getProcessMsg()); + } paymentBankTo.saveEx(); m_created++; return; From b26a378b85a78569cb70dee32e68a7073691b9f7 Mon Sep 17 00:00:00 2001 From: Edwin Ang Date: Mon, 9 Apr 2012 15:01:56 +0700 Subject: [PATCH 14/49] exception handling processIt on StorageCleanup.java --- .../src/org/compiere/process/StorageCleanup.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/org.adempiere.base.process/src/org/compiere/process/StorageCleanup.java b/org.adempiere.base.process/src/org/compiere/process/StorageCleanup.java index 3a09cb1067..5fcc1bc8ef 100644 --- a/org.adempiere.base.process/src/org/compiere/process/StorageCleanup.java +++ b/org.adempiere.base.process/src/org/compiere/process/StorageCleanup.java @@ -170,7 +170,11 @@ public class StorageCleanup extends SvrProcess } // for all movements // Process - mh.processIt(MMovement.ACTION_Complete); + if (!mh.processIt(MMovement.ACTION_Complete)) { + log.warning("Movement Process Failed: " + mh + " - " + mh.getProcessMsg()); + throw new IllegalStateException("Movement Process Failed: " + mh + " - " + mh.getProcessMsg()); + + } mh.saveEx(); addLog(0, null, new BigDecimal(lines), "@M_Movement_ID@ " + mh.getDocumentNo() + " (" From bb9e72c47ae6be49ddce826901ad922e25ffc0a5 Mon Sep 17 00:00:00 2001 From: Edwin Ang Date: Mon, 9 Apr 2012 15:02:17 +0700 Subject: [PATCH 15/49] exception handline on RequestInvoice.java --- .../src/org/compiere/process/RequestInvoice.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/org.adempiere.base.process/src/org/compiere/process/RequestInvoice.java b/org.adempiere.base.process/src/org/compiere/process/RequestInvoice.java index 0bb6e63765..845333d2f3 100644 --- a/org.adempiere.base.process/src/org/compiere/process/RequestInvoice.java +++ b/org.adempiere.base.process/src/org/compiere/process/RequestInvoice.java @@ -178,7 +178,11 @@ public class RequestInvoice extends SvrProcess m_invoice.delete(false); else { - m_invoice.processIt(MInvoice.ACTION_Prepare); + if(!m_invoice.processIt(MInvoice.ACTION_Prepare)) { + log.warning("Invoice Process Failed: " + m_invoice + " - " + m_invoice.getProcessMsg()); + throw new IllegalStateException("Invoice Process Failed: " + m_invoice + " - " + m_invoice.getProcessMsg()); + + } m_invoice.saveEx(); addLog(0, null, m_invoice.getGrandTotal(), m_invoice.getDocumentNo()); } From 9aa25ae51d43eae5db136a02ada7efe734929449 Mon Sep 17 00:00:00 2001 From: Edwin Ang Date: Mon, 9 Apr 2012 15:02:34 +0700 Subject: [PATCH 16/49] exception handling processIt on OrderBatchProcess.java --- .../src/org/compiere/process/OrderBatchProcess.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/org.adempiere.base.process/src/org/compiere/process/OrderBatchProcess.java b/org.adempiere.base.process/src/org/compiere/process/OrderBatchProcess.java index cda54a9546..8e8980a890 100644 --- a/org.adempiere.base.process/src/org/compiere/process/OrderBatchProcess.java +++ b/org.adempiere.base.process/src/org/compiere/process/OrderBatchProcess.java @@ -177,6 +177,10 @@ public class OrderBatchProcess extends SvrProcess order.saveEx(); addLog(0, null, null, order.getDocumentNo() + ": OK"); return true; + } else { + log.warning("Order Process Failed: " + order + " - " + order.getProcessMsg()); + throw new IllegalStateException("Order Process Failed: " + order + " - " + order.getProcessMsg()); + } addLog (0, null, null, order.getDocumentNo() + ": Error " + order.getProcessMsg()); return false; From 8d88f65b66b5dbfabb12c216223bf4a3f6878ce8 Mon Sep 17 00:00:00 2001 From: Edwin Ang Date: Mon, 9 Apr 2012 15:02:55 +0700 Subject: [PATCH 17/49] exception handling on InvoiceWriteOff.java --- .../org/compiere/process/InvoiceWriteOff.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/org.adempiere.base.process/src/org/compiere/process/InvoiceWriteOff.java b/org.adempiere.base.process/src/org/compiere/process/InvoiceWriteOff.java index d8cde01540..55d04169be 100644 --- a/org.adempiere.base.process/src/org/compiere/process/InvoiceWriteOff.java +++ b/org.adempiere.base.process/src/org/compiere/process/InvoiceWriteOff.java @@ -304,8 +304,12 @@ public class InvoiceWriteOff extends SvrProcess return true; processPayment(); // Process It - if (m_alloc.processIt(DocAction.ACTION_Complete) && m_alloc.save()) - { + if (!m_alloc.processIt(DocAction.ACTION_Complete)) { + log.warning("Allocation Process Failed: " + m_alloc + " - " + m_alloc.getProcessMsg()); + throw new IllegalStateException("Allocation Process Failed: " + m_alloc + " - " + m_alloc.getProcessMsg()); + + } + if (m_alloc.save()) { m_alloc = null; return true; } @@ -323,8 +327,12 @@ public class InvoiceWriteOff extends SvrProcess if (m_payment == null) return true; // Process It - if (m_payment.processIt(DocAction.ACTION_Complete) && m_payment.save()) - { + if (!m_payment.processIt(DocAction.ACTION_Complete)) { + log.warning("Payment Process Failed: " + m_payment + " - " + m_payment.getProcessMsg()); + throw new IllegalStateException("Payment Process Failed: " + m_payment + " - " + m_payment.getProcessMsg()); + } + + if (m_payment.save()) { m_payment = null; return true; } From b8e800f1c0569681cc49d012698e59f42e7fb210 Mon Sep 17 00:00:00 2001 From: Edwin Ang Date: Mon, 9 Apr 2012 15:03:07 +0700 Subject: [PATCH 18/49] exception handling processIt on InvoiceGenerate.java --- .../src/org/compiere/process/InvoiceGenerate.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/org.adempiere.base.process/src/org/compiere/process/InvoiceGenerate.java b/org.adempiere.base.process/src/org/compiere/process/InvoiceGenerate.java index 0577c6f696..3d4827c7fa 100644 --- a/org.adempiere.base.process/src/org/compiere/process/InvoiceGenerate.java +++ b/org.adempiere.base.process/src/org/compiere/process/InvoiceGenerate.java @@ -492,6 +492,8 @@ public class InvoiceGenerate extends SvrProcess { log.warning("completeInvoice - failed: " + m_invoice); addLog("completeInvoice - failed: " + m_invoice); // Elaine 2008/11/25 + throw new IllegalStateException("Invoice Process Failed: " + m_invoice + " - " + m_invoice.getProcessMsg()); + } m_invoice.saveEx(); From 31bce580a036f67af01d32ecb0aca056a2faea6e Mon Sep 17 00:00:00 2001 From: Edwin Ang Date: Mon, 9 Apr 2012 15:03:27 +0700 Subject: [PATCH 19/49] exception handling processIt on InvoiceBatchProcess.java --- .../src/org/compiere/process/InvoiceBatchProcess.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/org.adempiere.base.process/src/org/compiere/process/InvoiceBatchProcess.java b/org.adempiere.base.process/src/org/compiere/process/InvoiceBatchProcess.java index 35f4685014..4b74b5dfeb 100644 --- a/org.adempiere.base.process/src/org/compiere/process/InvoiceBatchProcess.java +++ b/org.adempiere.base.process/src/org/compiere/process/InvoiceBatchProcess.java @@ -155,7 +155,11 @@ public class InvoiceBatchProcess extends SvrProcess return; m_invoice.setDocAction(p_DocAction); - m_invoice.processIt(p_DocAction); + if(!m_invoice.processIt(p_DocAction)) { + log.warning("Invoice Process Failed: " + m_invoice + " - " + m_invoice.getProcessMsg()); + throw new IllegalStateException("Invoice Process Failed: " + m_invoice + " - " + m_invoice.getProcessMsg()); + + } m_invoice.saveEx(); addLog(0, m_invoice.getDateInvoiced(), m_invoice.getGrandTotal(), m_invoice.getDocumentNo()); From bba776aff758129648f91f86a14831c8fa77d77d Mon Sep 17 00:00:00 2001 From: Edwin Ang Date: Mon, 9 Apr 2012 15:03:43 +0700 Subject: [PATCH 20/49] exception handling processIt on InOutGenerate.java --- .../src/org/compiere/process/InOutGenerate.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java b/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java index 24bf010747..a0ec5a61fe 100644 --- a/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java +++ b/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java @@ -578,8 +578,12 @@ public class InOutGenerate extends SvrProcess if (m_shipment != null) { // Fails if there is a confirmation - if (!m_shipment.processIt(p_docAction)) + if (!m_shipment.processIt(p_docAction)) { log.warning("Failed: " + m_shipment); + throw new IllegalStateException("Shipment Process Failed: " + m_shipment + " - " + m_shipment.getProcessMsg()); + + } + } m_shipment.saveEx(); // addLog(m_shipment.getM_InOut_ID(), m_shipment.getMovementDate(), null, m_shipment.getDocumentNo()); From c71bd4d95cdac49a220394c204d632cc415610af Mon Sep 17 00:00:00 2001 From: Edwin Ang Date: Mon, 9 Apr 2012 15:03:59 +0700 Subject: [PATCH 21/49] exception handling processIt on ImportPayment.java --- .../src/org/compiere/process/ImportPayment.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/org.adempiere.base.process/src/org/compiere/process/ImportPayment.java b/org.adempiere.base.process/src/org/compiere/process/ImportPayment.java index 59518b9c44..59ca16b95d 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ImportPayment.java +++ b/org.adempiere.base.process/src/org/compiere/process/ImportPayment.java @@ -502,7 +502,11 @@ public class ImportPayment extends SvrProcess if (payment != null && m_docAction != null && m_docAction.length() > 0) { payment.setDocAction(m_docAction); - payment.processIt (m_docAction); + if(!payment.processIt (m_docAction)) { + log.warning("Payment Process Failed: " + payment + " - " + payment.getProcessMsg()); + throw new IllegalStateException("Payment Process Failed: " + payment + " - " + payment.getProcessMsg()); + + } payment.saveEx(); } } From 1bcf538411602430d67b2f51096f06b190510cd3 Mon Sep 17 00:00:00 2001 From: Edwin Ang Date: Mon, 9 Apr 2012 15:04:14 +0700 Subject: [PATCH 22/49] exception handling processIt on ImportOrder.java --- .../src/org/compiere/process/ImportOrder.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base.process/src/org/compiere/process/ImportOrder.java b/org.adempiere.base.process/src/org/compiere/process/ImportOrder.java index 372ace49bc..187243b998 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ImportOrder.java +++ b/org.adempiere.base.process/src/org/compiere/process/ImportOrder.java @@ -666,7 +666,11 @@ public class ImportOrder extends SvrProcess if (m_docAction != null && m_docAction.length() > 0) { order.setDocAction(m_docAction); - order.processIt (m_docAction); + if(!order.processIt (m_docAction)) { + log.warning("Order Process Failed: " + order + " - " + order.getProcessMsg()); + throw new IllegalStateException("Order Process Failed: " + order + " - " + order.getProcessMsg()); + + } } order.saveEx(); } @@ -767,7 +771,11 @@ public class ImportOrder extends SvrProcess if (m_docAction != null && m_docAction.length() > 0) { order.setDocAction(m_docAction); - order.processIt (m_docAction); + if(!order.processIt (m_docAction)) { + log.warning("Order Process Failed: " + order + " - " + order.getProcessMsg()); + throw new IllegalStateException("Order Process Failed: " + order + " - " + order.getProcessMsg()); + + } } order.saveEx(); } From f0b5dc0592dad3663c827684fdf788c09b8b1224 Mon Sep 17 00:00:00 2001 From: Edwin Ang Date: Mon, 9 Apr 2012 15:04:25 +0700 Subject: [PATCH 23/49] exception handling processIt on ImportInvoice.java --- .../src/org/compiere/process/ImportInvoice.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base.process/src/org/compiere/process/ImportInvoice.java b/org.adempiere.base.process/src/org/compiere/process/ImportInvoice.java index 617baad323..bf05db3b21 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ImportInvoice.java +++ b/org.adempiere.base.process/src/org/compiere/process/ImportInvoice.java @@ -644,7 +644,11 @@ public class ImportInvoice extends SvrProcess { if (invoice != null) { - invoice.processIt(m_docAction); + if (!invoice.processIt(m_docAction)) { + log.warning("Invoice Process Failed: " + invoice + " - " + invoice.getProcessMsg()); + throw new IllegalStateException("Invoice Process Failed: " + invoice + " - " + invoice.getProcessMsg()); + + } invoice.saveEx(); } // Group Change @@ -740,7 +744,11 @@ public class ImportInvoice extends SvrProcess } if (invoice != null) { - invoice.processIt (m_docAction); + if(!invoice.processIt (m_docAction)) { + log.warning("Invoice Process Failed: " + invoice + " - " + invoice.getProcessMsg()); + throw new IllegalStateException("Invoice Process Failed: " + invoice + " - " + invoice.getProcessMsg()); + + } invoice.saveEx(); } rs.close(); From bf4464cb9e19f561b80aaef3826d6d8822d78e53 Mon Sep 17 00:00:00 2001 From: Edwin Ang Date: Mon, 9 Apr 2012 15:04:35 +0700 Subject: [PATCH 24/49] exception handling processIt on ExpenseSOrder.java --- .../src/org/compiere/process/ExpenseSOrder.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/org.adempiere.base.process/src/org/compiere/process/ExpenseSOrder.java b/org.adempiere.base.process/src/org/compiere/process/ExpenseSOrder.java index 55b339ab55..a60b9852d6 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ExpenseSOrder.java +++ b/org.adempiere.base.process/src/org/compiere/process/ExpenseSOrder.java @@ -270,7 +270,10 @@ public class ExpenseSOrder extends SvrProcess if (m_order == null) return; m_order.setDocAction(DocAction.ACTION_Prepare); - m_order.processIt(DocAction.ACTION_Prepare); + if (!m_order.processIt(DocAction.ACTION_Prepare)) { + log.warning("Order Process Failed: " + m_order + " - " + m_order.getProcessMsg()); + throw new IllegalStateException("Order Process Failed: " + m_order + " - " + m_order.getProcessMsg()); + } if (!m_order.save()) throw new IllegalStateException("Cannot save Order"); m_noOrders++; From 4f5cefbff2466e1c2ddc5352e1b1de32cde4aa7f Mon Sep 17 00:00:00 2001 From: Edwin Ang Date: Mon, 9 Apr 2012 15:04:46 +0700 Subject: [PATCH 25/49] exception handling processIt on ExpenseAPInvoice.java --- .../src/org/compiere/process/ExpenseAPInvoice.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/org.adempiere.base.process/src/org/compiere/process/ExpenseAPInvoice.java b/org.adempiere.base.process/src/org/compiere/process/ExpenseAPInvoice.java index 536baaf001..5a1d206a39 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ExpenseAPInvoice.java +++ b/org.adempiere.base.process/src/org/compiere/process/ExpenseAPInvoice.java @@ -212,7 +212,11 @@ public class ExpenseAPInvoice extends SvrProcess if (invoice == null) return; invoice.setDocAction(DocAction.ACTION_Prepare); - invoice.processIt(DocAction.ACTION_Prepare); + if (!invoice.processIt(DocAction.ACTION_Prepare)) { + log.warning("Invoice Process Failed: " + invoice + " - " + invoice.getProcessMsg()); + throw new IllegalStateException("Invoice Process Failed: " + invoice + " - " + invoice.getProcessMsg()); + + } if (!invoice.save()) new IllegalStateException("Cannot save Invoice"); // From d14c3fd4c257fd32141d446fac691e268f1e2603 Mon Sep 17 00:00:00 2001 From: Edwin Ang Date: Mon, 9 Apr 2012 15:04:56 +0700 Subject: [PATCH 26/49] exception handling processIt on CopyOrder.java --- .../src/org/compiere/process/CopyOrder.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base.process/src/org/compiere/process/CopyOrder.java b/org.adempiere.base.process/src/org/compiere/process/CopyOrder.java index aac140b7ab..e9f8bdf5b9 100644 --- a/org.adempiere.base.process/src/org/compiere/process/CopyOrder.java +++ b/org.adempiere.base.process/src/org/compiere/process/CopyOrder.java @@ -94,10 +94,19 @@ public class CopyOrder extends SvrProcess { MOrder original = new MOrder (getCtx(), p_C_Order_ID, get_TrxName()); original.setDocAction(MOrder.DOCACTION_Complete); - original.processIt(MOrder.DOCACTION_Complete); + if (!original.processIt(MOrder.DOCACTION_Complete)) { + log.warning("Order Process Failed: " + original.getDocumentNo() + " " + original.getProcessMsg()); + throw new IllegalStateException("Order Process Failed: " + original.getDocumentNo() + " " + original.getProcessMsg()); + + } original.saveEx(); original.setDocAction(MOrder.DOCACTION_Close); - original.processIt(MOrder.DOCACTION_Close); + if (!original.processIt(MOrder.DOCACTION_Close)) { + log.warning("Order Process Failed: " + original.getDocumentNo() + " " + original.getProcessMsg()); + throw new IllegalStateException("Order Process Failed: " + original.getDocumentNo() + " " + original.getProcessMsg()); + + } + original.saveEx(); } // From 4621e9809b17aa25a33f31dd87b1d70e48a1ee1f Mon Sep 17 00:00:00 2001 From: Edwin Ang Date: Mon, 9 Apr 2012 15:05:08 +0700 Subject: [PATCH 27/49] exception handling processIt on BankStatementPayment.java --- .../src/org/compiere/process/BankStatementPayment.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/org.adempiere.base.process/src/org/compiere/process/BankStatementPayment.java b/org.adempiere.base.process/src/org/compiere/process/BankStatementPayment.java index 1c3107ae2e..dec65b121a 100644 --- a/org.adempiere.base.process/src/org/compiere/process/BankStatementPayment.java +++ b/org.adempiere.base.process/src/org/compiere/process/BankStatementPayment.java @@ -223,7 +223,11 @@ public class BankStatementPayment extends SvrProcess return null; payment.saveEx(); // - payment.processIt(MPayment.DOCACTION_Complete); + if (!payment.processIt(MPayment.DOCACTION_Complete)) { + log.warning("Payment Process Failed: " + payment.getDocumentNo() + " " + payment.getProcessMsg()); + throw new IllegalStateException("Payment Process Failed: " + payment.getDocumentNo() + " " + payment.getProcessMsg()); + + } payment.saveEx(); return payment; } // createPayment From ef82f295c35c03517ee36ab06f9bc78eb54721f9 Mon Sep 17 00:00:00 2001 From: Edwin Ang Date: Mon, 9 Apr 2012 15:05:18 +0700 Subject: [PATCH 28/49] exception handling processIt on AllocationAuto.java --- .../src/org/compiere/process/AllocationAuto.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base.process/src/org/compiere/process/AllocationAuto.java b/org.adempiere.base.process/src/org/compiere/process/AllocationAuto.java index 638eb8cb07..4a50bd4924 100644 --- a/org.adempiere.base.process/src/org/compiere/process/AllocationAuto.java +++ b/org.adempiere.base.process/src/org/compiere/process/AllocationAuto.java @@ -828,8 +828,9 @@ public class AllocationAuto extends SvrProcess if (m_allocation == null) return true; boolean success = m_allocation.processIt(MAllocationHdr.DOCACTION_Complete); - if (success) - success = m_allocation.save(); + if (!success) + throw new IllegalStateException("Allocation Process Failed "+ m_allocation.getDocumentNo() + + " " + m_allocation.getProcessMsg()); else m_allocation.saveEx(); addLog(0, m_allocation.getDateAcct(), null, m_allocation.getDescription()); From a98e5bcaeb65c77bc10bdd03ad5aece4ea10c544 Mon Sep 17 00:00:00 2001 From: Edwin Ang Date: Mon, 9 Apr 2012 15:05:29 +0700 Subject: [PATCH 29/49] exception handling processIt on InvoiceGenerateRMA.java --- .../src/org/adempiere/process/InvoiceGenerateRMA.java | 1 + 1 file changed, 1 insertion(+) diff --git a/org.adempiere.base.process/src/org/adempiere/process/InvoiceGenerateRMA.java b/org.adempiere.base.process/src/org/adempiere/process/InvoiceGenerateRMA.java index bc805b4447..5b341e45f1 100644 --- a/org.adempiere.base.process/src/org/adempiere/process/InvoiceGenerateRMA.java +++ b/org.adempiere.base.process/src/org/adempiere/process/InvoiceGenerateRMA.java @@ -207,6 +207,7 @@ public class InvoiceGenerateRMA extends SvrProcess { processMsg.append(" (NOT Processed)"); log.warning("Invoice Processing failed: " + invoice + " - " + invoice.getProcessMsg()); + throw new IllegalStateException("Invoice Processing failed: " + invoice + " - " + invoice.getProcessMsg()); } if (!invoice.save()) From b091184eef21de88c5946afce63067bed70607ab Mon Sep 17 00:00:00 2001 From: Edwin Ang Date: Mon, 9 Apr 2012 15:05:43 +0700 Subject: [PATCH 30/49] exception handling processIt on InOutGenerateRMA.java --- .../src/org/adempiere/process/InOutGenerateRMA.java | 1 + 1 file changed, 1 insertion(+) diff --git a/org.adempiere.base.process/src/org/adempiere/process/InOutGenerateRMA.java b/org.adempiere.base.process/src/org/adempiere/process/InOutGenerateRMA.java index 1ef4438ed7..6b51dcc3ef 100644 --- a/org.adempiere.base.process/src/org/adempiere/process/InOutGenerateRMA.java +++ b/org.adempiere.base.process/src/org/adempiere/process/InOutGenerateRMA.java @@ -246,6 +246,7 @@ public class InOutGenerateRMA extends SvrProcess { processMsg.append(" (NOT Processed)"); log.warning("Shipment Processing failed: " + shipment + " - " + shipment.getProcessMsg()); + throw new IllegalStateException("Shipment Processing failed: " + shipment + " - " + shipment.getProcessMsg()); } if (!shipment.save()) From 734515d90e4bd91f89f0d24918513a88c5ce08a0 Mon Sep 17 00:00:00 2001 From: Edwin Ang Date: Mon, 9 Apr 2012 15:07:03 +0700 Subject: [PATCH 31/49] exception handling processIt on ImmediateBankTransfer.java --- .../src/org/adempiere/process/ImmediateBankTransfer.java | 1 + 1 file changed, 1 insertion(+) diff --git a/org.adempiere.base.process/src/org/adempiere/process/ImmediateBankTransfer.java b/org.adempiere.base.process/src/org/adempiere/process/ImmediateBankTransfer.java index 26d51141fd..52ef194a4a 100644 --- a/org.adempiere.base.process/src/org/adempiere/process/ImmediateBankTransfer.java +++ b/org.adempiere.base.process/src/org/adempiere/process/ImmediateBankTransfer.java @@ -259,6 +259,7 @@ public class ImmediateBankTransfer extends SvrProcess "Cash Processing failed: " + cash + " - " + cash.getProcessMsg() + " / please complete it manually"); + throw new IllegalStateException("Cash Processing failed: " + cash + " - " + cash.getProcessMsg()); } if (!cash.save()) { From 900a01ab7ca8077fac8847c24517f3e0e99b5cd5 Mon Sep 17 00:00:00 2001 From: uthadehikaru Date: Sat, 21 Apr 2012 15:31:02 -0500 Subject: [PATCH 32/49] Fixed minor error by zuhri --- .../src/org/compiere/process/InOutGenerate.java | 1 - .../src/org/compiere/process/OrderBatchProcess.java | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java b/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java index a0ec5a61fe..27a33f5dfe 100644 --- a/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java +++ b/org.adempiere.base.process/src/org/compiere/process/InOutGenerate.java @@ -582,7 +582,6 @@ public class InOutGenerate extends SvrProcess log.warning("Failed: " + m_shipment); throw new IllegalStateException("Shipment Process Failed: " + m_shipment + " - " + m_shipment.getProcessMsg()); - } } m_shipment.saveEx(); // diff --git a/org.adempiere.base.process/src/org/compiere/process/OrderBatchProcess.java b/org.adempiere.base.process/src/org/compiere/process/OrderBatchProcess.java index 8e8980a890..5bd041f9d4 100644 --- a/org.adempiere.base.process/src/org/compiere/process/OrderBatchProcess.java +++ b/org.adempiere.base.process/src/org/compiere/process/OrderBatchProcess.java @@ -182,8 +182,10 @@ public class OrderBatchProcess extends SvrProcess throw new IllegalStateException("Order Process Failed: " + order + " - " + order.getProcessMsg()); } - addLog (0, null, null, order.getDocumentNo() + ": Error " + order.getProcessMsg()); - return false; + // commented by zuhri - unreachable code + //addLog (0, null, null, order.getDocumentNo() + ": Error " + order.getProcessMsg()); + //return false; + // end commented out by zuhri } // process } // OrderBatchProcess From 1fe7383c4768891d6fbb54e106d238292bf09c5c Mon Sep 17 00:00:00 2001 From: uthadehikaru Date: Wed, 11 Apr 2012 08:26:21 +0700 Subject: [PATCH 33/49] exception handling processIt on MCashLine --- org.adempiere.base/src/org/compiere/model/MCashLine.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/model/MCashLine.java b/org.adempiere.base/src/org/compiere/model/MCashLine.java index 5202795a8a..ccb3247515 100644 --- a/org.adempiere.base/src/org/compiere/model/MCashLine.java +++ b/org.adempiere.base/src/org/compiere/model/MCashLine.java @@ -21,6 +21,7 @@ import java.sql.ResultSet; import java.sql.Timestamp; import java.util.Properties; +import org.adempiere.exceptions.AdempiereException; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; @@ -154,7 +155,10 @@ public class MCashLine extends X_C_CashLine { saveEx(trxName); order.setC_CashLine_ID(getC_CashLine_ID()); - order.processIt(MOrder.ACTION_WaitComplete); + // added AdempiereException by Amir Sehan + if (!order.processIt(MOrder.ACTION_WaitComplete)) + throw new AdempiereException("Failed processing Document - " + order); + // end added order.saveEx(trxName); // Set Invoice MInvoice[] invoices = order.getInvoices(); From a6a11d65f79ae977a149459be75f1d504e76258f Mon Sep 17 00:00:00 2001 From: uthadehikaru Date: Sat, 21 Apr 2012 15:39:45 -0500 Subject: [PATCH 34/49] exception handling processIt on MInOut --- org.adempiere.base/src/org/compiere/model/MInOut.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MInOut.java b/org.adempiere.base/src/org/compiere/model/MInOut.java index 73a4c62fad..3692c07ac6 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOut.java +++ b/org.adempiere.base/src/org/compiere/model/MInOut.java @@ -1684,7 +1684,10 @@ public class MInOut extends X_M_InOut implements DocAction log.fine(dropShipment.toString()); dropShipment.setDocAction(DocAction.ACTION_Complete); - dropShipment.processIt(DocAction.ACTION_Complete); + // added AdempiereException by Amir Sehan + if (!dropShipment.processIt(DocAction.ACTION_Complete)) + throw new AdempiereException("Failed Processing Document - " + dropShipment); + // end added dropShipment.saveEx(); return dropShipment; @@ -1903,7 +1906,10 @@ public class MInOut extends X_M_InOut implements DocAction if (counterDT.getDocAction() != null) { counter.setDocAction(counterDT.getDocAction()); - counter.processIt(counterDT.getDocAction()); + // added AdempiereException by Amir Sehan + if (!counter.processIt(counterDT.getDocAction())) + throw new AdempiereException("Failed Processing Document - " + counter); + // end added counter.saveEx(get_TrxName()); } } From 9ff7002ff8738a3926214a51f2963230a133ddee Mon Sep 17 00:00:00 2001 From: uthadehikaru Date: Sat, 21 Apr 2012 15:42:24 -0500 Subject: [PATCH 35/49] exception handling processIt on MInvoice --- .../src/org/compiere/model/MInvoice.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MInvoice.java b/org.adempiere.base/src/org/compiere/model/MInvoice.java index 0f14feaeeb..60db8b2ee4 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoice.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoice.java @@ -2027,7 +2027,10 @@ public class MInvoice extends X_C_Invoice implements DocAction if (counterDT.getDocAction() != null) { counter.setDocAction(counterDT.getDocAction()); - counter.processIt(counterDT.getDocAction()); + // added AdempiereException by Amir Sehan + if (!counter.processIt(counterDT.getDocAction())) + throw new AdempiereException("Failed Processing Document - " + counter); + // end added counter.saveEx(get_TrxName()); } } @@ -2268,8 +2271,10 @@ public class MInvoice extends X_C_Invoice implements DocAction Env.ZERO, Env.ZERO, Env.ZERO); rLine.setC_Invoice_ID(reversal.getC_Invoice_ID()); rLine.saveEx(); - // Process It - if (alloc.processIt(DocAction.ACTION_Complete)) + // added AdempiereException by Amir Sehan + if (!alloc.processIt(DocAction.ACTION_Complete)) + throw new AdempiereException("Failed Processing Document - " + alloc); + // end added alloc.saveEx(); } From 6e1c0ba0278b4379045470baf7bc3584b73ddc9b Mon Sep 17 00:00:00 2001 From: uthadehikaru Date: Wed, 11 Apr 2012 08:26:47 +0700 Subject: [PATCH 36/49] exception handling processIt on MJournalBatch --- org.adempiere.base/src/org/compiere/model/MJournalBatch.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/model/MJournalBatch.java b/org.adempiere.base/src/org/compiere/model/MJournalBatch.java index 9c9a4dba9f..40d749b885 100644 --- a/org.adempiere.base/src/org/compiere/model/MJournalBatch.java +++ b/org.adempiere.base/src/org/compiere/model/MJournalBatch.java @@ -474,7 +474,10 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction ; else { - journal.processIt(DocAction.ACTION_Complete); + // added AdempiereException by Amir Sehan + if (!journal.processIt(DocAction.ACTION_Complete)) + throw new AdempiereException("Failed Processing Document - " + journal); + // end added journal.saveEx(); if (!DocAction.STATUS_Completed.equals(journal.getDocStatus())) { From 797af7b6b888c58f76df925fd5b958339878b800 Mon Sep 17 00:00:00 2001 From: uthadehikaru Date: Sat, 21 Apr 2012 15:44:59 -0500 Subject: [PATCH 37/49] exception handling processIt on MOrder --- .../src/org/compiere/model/MOrder.java | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MOrder.java b/org.adempiere.base/src/org/compiere/model/MOrder.java index bb7026b5f1..2c60b41a20 100644 --- a/org.adempiere.base/src/org/compiere/model/MOrder.java +++ b/org.adempiere.base/src/org/compiere/model/MOrder.java @@ -30,6 +30,9 @@ import java.util.Vector; import java.util.logging.Level; import java.util.regex.Pattern; +import javax.mail.internet.AddressException; + +import org.adempiere.exceptions.AdempiereException; import org.adempiere.exceptions.BPartnerNoBillToAddressException; import org.adempiere.exceptions.BPartnerNoShipToAddressException; import org.adempiere.exceptions.FillMandatoryException; @@ -1895,8 +1898,10 @@ public class MOrder extends X_C_Order implements DocAction return null; } } - // Manually Process Shipment - shipment.processIt(DocAction.ACTION_Complete); + // added AdempiereException by Amir Sehan + if (!shipment.processIt(DocAction.ACTION_Complete)) + throw new AdempiereException("Failed Processing Document - " + shipment); + // end added shipment.saveEx(get_TrxName()); if (!DOCSTATUS_Completed.equals(shipment.getDocStatus())) { @@ -1996,8 +2001,10 @@ public class MOrder extends X_C_Order implements DocAction } } - // Manually Process Invoice - invoice.processIt(DocAction.ACTION_Complete); + // added AdempiereException by Amir Sehan + if (!invoice.processIt(DocAction.ACTION_Complete)) + throw new AdempiereException("Failed Processing Document - " + invoice); + // end added invoice.saveEx(get_TrxName()); setC_CashLine_ID(invoice.getC_CashLine_ID()); if (!DOCSTATUS_Completed.equals(invoice.getDocStatus())) @@ -2081,7 +2088,10 @@ public class MOrder extends X_C_Order implements DocAction if (counterDT.getDocAction() != null) { counter.setDocAction(counterDT.getDocAction()); - counter.processIt(counterDT.getDocAction()); + // added AdempiereException by Amir Sehan + if (!counter.processIt(counterDT.getDocAction())) + throw new AdempiereException("Failed Processing Document - " + counter); + // end added counter.saveEx(get_TrxName()); } } From 332afbcb038d680f35f28cfab0c05db4428b62a3 Mon Sep 17 00:00:00 2001 From: uthadehikaru Date: Sat, 21 Apr 2012 15:46:58 -0500 Subject: [PATCH 38/49] exception handling processIt on MPayment --- .../src/org/compiere/model/MPayment.java | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MPayment.java b/org.adempiere.base/src/org/compiere/model/MPayment.java index 1a81d59235..8d1c01f583 100644 --- a/org.adempiere.base/src/org/compiere/model/MPayment.java +++ b/org.adempiere.base/src/org/compiere/model/MPayment.java @@ -1659,8 +1659,10 @@ public final class MPayment extends X_C_Payment order.setC_Payment_ID(getC_Payment_ID()); order.setDocAction(X_C_Order.DOCACTION_WaitComplete); order.set_TrxName(get_TrxName()); - // boolean ok = - order.processIt (X_C_Order.DOCACTION_WaitComplete); + // added AdempiereException by Amir Sehan + if (!order.processIt (X_C_Order.DOCACTION_WaitComplete)) + throw new AdempiereException("Failed Processing Document - " + order); + // end added m_processMsg = order.getProcessMsg(); order.saveEx(get_TrxName()); // Set Invoice @@ -1991,7 +1993,10 @@ public final class MPayment extends X_C_Payment if (counterDT.getDocAction() != null) { counter.setDocAction(counterDT.getDocAction()); - counter.processIt(counterDT.getDocAction()); + // added AdempiereException by Amir Sehan + if (!counter.processIt(counterDT.getDocAction())) + throw new AdempiereException("Failed Processing DOcument - " + counter); + // end added counter.saveEx(get_TrxName()); } } @@ -2055,8 +2060,10 @@ public final class MPayment extends X_C_Payment pa.saveEx(); } } - // Should start WF - alloc.processIt(DocAction.ACTION_Complete); + // added AdempiereException by Amir Sehan + if (!alloc.processIt(DocAction.ACTION_Complete)) + throw new AdempiereException("Failed Processing Document - " + alloc); + // end added m_processMsg = "@C_AllocationHdr_ID@: " + alloc.getDocumentNo(); return alloc.save(get_TrxName()); } // allocateIt @@ -2088,8 +2095,10 @@ public final class MPayment extends X_C_Payment aLine.setDocInfo(getC_BPartner_ID(), 0, getC_Invoice_ID()); aLine.setC_Payment_ID(getC_Payment_ID()); aLine.saveEx(get_TrxName()); - // Should start WF - alloc.processIt(DocAction.ACTION_Complete); + // added AdempiereException by Amir Sehan + if (!alloc.processIt(DocAction.ACTION_Complete)) + throw new AdempiereException("Failed Processing Document - " + alloc); + // end added alloc.saveEx(get_TrxName()); m_processMsg = "@C_AllocationHdr_ID@: " + alloc.getDocumentNo(); @@ -2417,7 +2426,10 @@ public final class MPayment extends X_C_Payment if (!aLine.save(get_TrxName())) log.warning("Automatic allocation - reversal line not saved"); } - alloc.processIt(DocAction.ACTION_Complete); + // added AdempiereException by Amir Sehan + if (!alloc.processIt(DocAction.ACTION_Complete)) + throw new AdempiereException("Failed Processing Document - " + alloc); + // end added alloc.saveEx(get_TrxName()); // StringBuffer info = new StringBuffer (reversal.getDocumentNo()); From ecd176e1ba22bb7e2af97825a5d43e4c96c52073 Mon Sep 17 00:00:00 2001 From: uthadehikaru Date: Wed, 11 Apr 2012 08:27:08 +0700 Subject: [PATCH 39/49] exception handling processIt on MPaySelectionCheck --- .../src/org/compiere/model/MPaySelectionCheck.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MPaySelectionCheck.java b/org.adempiere.base/src/org/compiere/model/MPaySelectionCheck.java index 03d4e1a606..8b1bf6ee5f 100644 --- a/org.adempiere.base/src/org/compiere/model/MPaySelectionCheck.java +++ b/org.adempiere.base/src/org/compiere/model/MPaySelectionCheck.java @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.Properties; import java.util.logging.Level; +import org.adempiere.exceptions.AdempiereException; import org.compiere.process.DocAction; import org.compiere.util.CLogger; import org.compiere.util.DB; @@ -326,8 +327,10 @@ public final class MPaySelectionCheck extends X_C_PaySelectionCheck { check.setC_Payment_ID (C_Payment_ID); check.saveEx(); // Payment process needs it - // Should start WF - payment.processIt(DocAction.ACTION_Complete); + // added AdempiereException by Amir Sehan + if (!payment.processIt(DocAction.ACTION_Complete)) + throw new AdempiereException("FAiled Processing Document - " + payment); + // end added if (!payment.save()) s_log.log(Level.SEVERE, "Payment not saved: " + payment); } From bdc3e826c7ed1da9e62031536bf6264c806890f1 Mon Sep 17 00:00:00 2001 From: uthadehikaru Date: Wed, 11 Apr 2012 08:27:16 +0700 Subject: [PATCH 40/49] exception handling processIt on MRMA --- org.adempiere.base/src/org/compiere/model/MRMA.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/model/MRMA.java b/org.adempiere.base/src/org/compiere/model/MRMA.java index c93e992ce8..2c008b7273 100644 --- a/org.adempiere.base/src/org/compiere/model/MRMA.java +++ b/org.adempiere.base/src/org/compiere/model/MRMA.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.Properties; import java.util.logging.Level; +import org.adempiere.exceptions.AdempiereException; import org.compiere.process.DocAction; import org.compiere.process.DocumentEngine; import org.compiere.util.DB; @@ -497,7 +498,10 @@ public class MRMA extends X_M_RMA implements DocAction if (counterDT.getDocAction() != null) { counter.setDocAction(counterDT.getDocAction()); - counter.processIt(counterDT.getDocAction()); + // added AdempiereException by Amir Sehan + if (!counter.processIt(counterDT.getDocAction())) + throw new AdempiereException("Failed Processing Document - " + counter); + // end added counter.saveEx(get_TrxName()); } } From 575dbf64cd3d44d09d29bd1987fd1ad7b55dc484 Mon Sep 17 00:00:00 2001 From: uthadehikaru Date: Sat, 21 Apr 2012 15:52:36 -0500 Subject: [PATCH 41/49] Completing return message when raise AdempiereException --- .../src/org/compiere/model/MCashLine.java | 4 +-- .../src/org/compiere/model/MInOut.java | 8 +++--- .../src/org/compiere/model/MInvoice.java | 8 +++--- .../src/org/compiere/model/MJournalBatch.java | 4 +-- .../src/org/compiere/model/MOrder.java | 12 ++++---- .../compiere/model/MPaySelectionCheck.java | 4 +-- .../src/org/compiere/model/MPayment.java | 28 +++++++++++-------- .../src/org/compiere/model/MRMA.java | 4 +-- 8 files changed, 38 insertions(+), 34 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MCashLine.java b/org.adempiere.base/src/org/compiere/model/MCashLine.java index ccb3247515..089492f502 100644 --- a/org.adempiere.base/src/org/compiere/model/MCashLine.java +++ b/org.adempiere.base/src/org/compiere/model/MCashLine.java @@ -155,9 +155,9 @@ public class MCashLine extends X_C_CashLine { saveEx(trxName); order.setC_CashLine_ID(getC_CashLine_ID()); - // added AdempiereException by Amir Sehan + // added AdempiereException by Zuhri if (!order.processIt(MOrder.ACTION_WaitComplete)) - throw new AdempiereException("Failed processing Document - " + order); + throw new AdempiereException("Failed when processing document - " + order.getProcessMsg()); // end added order.saveEx(trxName); // Set Invoice diff --git a/org.adempiere.base/src/org/compiere/model/MInOut.java b/org.adempiere.base/src/org/compiere/model/MInOut.java index 3692c07ac6..691a22ff85 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOut.java +++ b/org.adempiere.base/src/org/compiere/model/MInOut.java @@ -1684,9 +1684,9 @@ public class MInOut extends X_M_InOut implements DocAction log.fine(dropShipment.toString()); dropShipment.setDocAction(DocAction.ACTION_Complete); - // added AdempiereException by Amir Sehan + // added AdempiereException by Zuhri if (!dropShipment.processIt(DocAction.ACTION_Complete)) - throw new AdempiereException("Failed Processing Document - " + dropShipment); + throw new AdempiereException("Failed when processing document - " + dropShipment.getProcessMsg()); // end added dropShipment.saveEx(); @@ -1906,9 +1906,9 @@ public class MInOut extends X_M_InOut implements DocAction if (counterDT.getDocAction() != null) { counter.setDocAction(counterDT.getDocAction()); - // added AdempiereException by Amir Sehan + // added AdempiereException by zuhri if (!counter.processIt(counterDT.getDocAction())) - throw new AdempiereException("Failed Processing Document - " + counter); + throw new AdempiereException("Failed when processing document - " + counter.getProcessMsg()); // end added counter.saveEx(get_TrxName()); } diff --git a/org.adempiere.base/src/org/compiere/model/MInvoice.java b/org.adempiere.base/src/org/compiere/model/MInvoice.java index 60db8b2ee4..2efa911cdb 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoice.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoice.java @@ -2027,9 +2027,9 @@ public class MInvoice extends X_C_Invoice implements DocAction if (counterDT.getDocAction() != null) { counter.setDocAction(counterDT.getDocAction()); - // added AdempiereException by Amir Sehan + // added AdempiereException by zuhri if (!counter.processIt(counterDT.getDocAction())) - throw new AdempiereException("Failed Processing Document - " + counter); + throw new AdempiereException("Failed when processing document - " + counter.getProcessMsg()); // end added counter.saveEx(get_TrxName()); } @@ -2271,9 +2271,9 @@ public class MInvoice extends X_C_Invoice implements DocAction Env.ZERO, Env.ZERO, Env.ZERO); rLine.setC_Invoice_ID(reversal.getC_Invoice_ID()); rLine.saveEx(); - // added AdempiereException by Amir Sehan + // added AdempiereException by zuhri if (!alloc.processIt(DocAction.ACTION_Complete)) - throw new AdempiereException("Failed Processing Document - " + alloc); + throw new AdempiereException("Failed when processing document - " + alloc.getProcessMsg()); // end added alloc.saveEx(); } diff --git a/org.adempiere.base/src/org/compiere/model/MJournalBatch.java b/org.adempiere.base/src/org/compiere/model/MJournalBatch.java index 40d749b885..f9085c4a67 100644 --- a/org.adempiere.base/src/org/compiere/model/MJournalBatch.java +++ b/org.adempiere.base/src/org/compiere/model/MJournalBatch.java @@ -474,9 +474,9 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction ; else { - // added AdempiereException by Amir Sehan + // added AdempiereException by zuhri if (!journal.processIt(DocAction.ACTION_Complete)) - throw new AdempiereException("Failed Processing Document - " + journal); + throw new AdempiereException("Failed when processing document - " + journal.getProcessMsg()); // end added journal.saveEx(); if (!DocAction.STATUS_Completed.equals(journal.getDocStatus())) diff --git a/org.adempiere.base/src/org/compiere/model/MOrder.java b/org.adempiere.base/src/org/compiere/model/MOrder.java index 2c60b41a20..bac0dab99e 100644 --- a/org.adempiere.base/src/org/compiere/model/MOrder.java +++ b/org.adempiere.base/src/org/compiere/model/MOrder.java @@ -1898,9 +1898,9 @@ public class MOrder extends X_C_Order implements DocAction return null; } } - // added AdempiereException by Amir Sehan + // added AdempiereException by zuhri if (!shipment.processIt(DocAction.ACTION_Complete)) - throw new AdempiereException("Failed Processing Document - " + shipment); + throw new AdempiereException("Failed when processing document - " + shipment.getProcessMsg()); // end added shipment.saveEx(get_TrxName()); if (!DOCSTATUS_Completed.equals(shipment.getDocStatus())) @@ -2001,9 +2001,9 @@ public class MOrder extends X_C_Order implements DocAction } } - // added AdempiereException by Amir Sehan + // added AdempiereException by zuhri if (!invoice.processIt(DocAction.ACTION_Complete)) - throw new AdempiereException("Failed Processing Document - " + invoice); + throw new AdempiereException("Failed when processing document - " + invoice.getProcessMsg()); // end added invoice.saveEx(get_TrxName()); setC_CashLine_ID(invoice.getC_CashLine_ID()); @@ -2088,9 +2088,9 @@ public class MOrder extends X_C_Order implements DocAction if (counterDT.getDocAction() != null) { counter.setDocAction(counterDT.getDocAction()); - // added AdempiereException by Amir Sehan + // added AdempiereException by zuhri if (!counter.processIt(counterDT.getDocAction())) - throw new AdempiereException("Failed Processing Document - " + counter); + throw new AdempiereException("Failed when processing document - " + counter.getProcessMsg()); // end added counter.saveEx(get_TrxName()); } diff --git a/org.adempiere.base/src/org/compiere/model/MPaySelectionCheck.java b/org.adempiere.base/src/org/compiere/model/MPaySelectionCheck.java index 8b1bf6ee5f..cd4427dd57 100644 --- a/org.adempiere.base/src/org/compiere/model/MPaySelectionCheck.java +++ b/org.adempiere.base/src/org/compiere/model/MPaySelectionCheck.java @@ -327,9 +327,9 @@ public final class MPaySelectionCheck extends X_C_PaySelectionCheck { check.setC_Payment_ID (C_Payment_ID); check.saveEx(); // Payment process needs it - // added AdempiereException by Amir Sehan + // added AdempiereException by zuhri if (!payment.processIt(DocAction.ACTION_Complete)) - throw new AdempiereException("FAiled Processing Document - " + payment); + throw new AdempiereException("Failed when processing document - " + payment.getProcessMsg()); // end added if (!payment.save()) s_log.log(Level.SEVERE, "Payment not saved: " + payment); diff --git a/org.adempiere.base/src/org/compiere/model/MPayment.java b/org.adempiere.base/src/org/compiere/model/MPayment.java index 8d1c01f583..9fb2561f90 100644 --- a/org.adempiere.base/src/org/compiere/model/MPayment.java +++ b/org.adempiere.base/src/org/compiere/model/MPayment.java @@ -1659,9 +1659,9 @@ public final class MPayment extends X_C_Payment order.setC_Payment_ID(getC_Payment_ID()); order.setDocAction(X_C_Order.DOCACTION_WaitComplete); order.set_TrxName(get_TrxName()); - // added AdempiereException by Amir Sehan + // added AdempiereException by zuhri if (!order.processIt (X_C_Order.DOCACTION_WaitComplete)) - throw new AdempiereException("Failed Processing Document - " + order); + throw new AdempiereException("Failed when processing document - " + order.getProcessMsg()); // end added m_processMsg = order.getProcessMsg(); order.saveEx(get_TrxName()); @@ -1993,9 +1993,9 @@ public final class MPayment extends X_C_Payment if (counterDT.getDocAction() != null) { counter.setDocAction(counterDT.getDocAction()); - // added AdempiereException by Amir Sehan + // added AdempiereException by zuhri if (!counter.processIt(counterDT.getDocAction())) - throw new AdempiereException("Failed Processing DOcument - " + counter); + throw new AdempiereException("Failed when rocessing document - " + counter.getProcessMsg()); // end added counter.saveEx(get_TrxName()); } @@ -2060,9 +2060,9 @@ public final class MPayment extends X_C_Payment pa.saveEx(); } } - // added AdempiereException by Amir Sehan + // added AdempiereException by zuhri if (!alloc.processIt(DocAction.ACTION_Complete)) - throw new AdempiereException("Failed Processing Document - " + alloc); + throw new AdempiereException("Failed when processing document - " + alloc.getProcessMsg()); // end added m_processMsg = "@C_AllocationHdr_ID@: " + alloc.getDocumentNo(); return alloc.save(get_TrxName()); @@ -2095,9 +2095,9 @@ public final class MPayment extends X_C_Payment aLine.setDocInfo(getC_BPartner_ID(), 0, getC_Invoice_ID()); aLine.setC_Payment_ID(getC_Payment_ID()); aLine.saveEx(get_TrxName()); - // added AdempiereException by Amir Sehan + // added AdempiereException by zuhri if (!alloc.processIt(DocAction.ACTION_Complete)) - throw new AdempiereException("Failed Processing Document - " + alloc); + throw new AdempiereException("Failed when processing document - " + alloc.getProcessMsg()); // end added alloc.saveEx(get_TrxName()); m_processMsg = "@C_AllocationHdr_ID@: " + alloc.getDocumentNo(); @@ -2192,8 +2192,12 @@ public final class MPayment extends X_C_Payment } else { - alloc.processIt(DocAction.ACTION_Complete); - ok = alloc.save(get_TrxName()); + // added Adempiere Exception by zuhri + if(alloc.processIt(DocAction.ACTION_Complete)) + ok = alloc.save(get_TrxName()); + else + throw new AdempiereException("Failed when processing document - " + alloc.getProcessMsg()); + // end added by zuhri m_processMsg = "@C_AllocationHdr_ID@: " + alloc.getDocumentNo(); } return ok; @@ -2426,9 +2430,9 @@ public final class MPayment extends X_C_Payment if (!aLine.save(get_TrxName())) log.warning("Automatic allocation - reversal line not saved"); } - // added AdempiereException by Amir Sehan + // added AdempiereException by zuhri if (!alloc.processIt(DocAction.ACTION_Complete)) - throw new AdempiereException("Failed Processing Document - " + alloc); + throw new AdempiereException("Failed when processing document - " + alloc.getProcessMsg()); // end added alloc.saveEx(get_TrxName()); // diff --git a/org.adempiere.base/src/org/compiere/model/MRMA.java b/org.adempiere.base/src/org/compiere/model/MRMA.java index 2c008b7273..448ed3d2ff 100644 --- a/org.adempiere.base/src/org/compiere/model/MRMA.java +++ b/org.adempiere.base/src/org/compiere/model/MRMA.java @@ -498,9 +498,9 @@ public class MRMA extends X_M_RMA implements DocAction if (counterDT.getDocAction() != null) { counter.setDocAction(counterDT.getDocAction()); - // added AdempiereException by Amir Sehan + // added AdempiereException by zuhri if (!counter.processIt(counterDT.getDocAction())) - throw new AdempiereException("Failed Processing Document - " + counter); + throw new AdempiereException("Failed when processing document - " + counter.getProcessMsg()); // end added counter.saveEx(get_TrxName()); } From 4173cb21a926ba1ae2224f16da0241ac32435cf0 Mon Sep 17 00:00:00 2001 From: uthadehikaru Date: Mon, 16 Apr 2012 12:57:31 +0700 Subject: [PATCH 42/49] Added AdempiereException for method processIt in package servlet --- .../src/org/compiere/wstore/PaymentServlet.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/org.adempiere.webstore.servlet/src/org/compiere/wstore/PaymentServlet.java b/org.adempiere.webstore.servlet/src/org/compiere/wstore/PaymentServlet.java index d32ced7017..989e12f90c 100644 --- a/org.adempiere.webstore.servlet/src/org/compiere/wstore/PaymentServlet.java +++ b/org.adempiere.webstore.servlet/src/org/compiere/wstore/PaymentServlet.java @@ -28,6 +28,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import org.adempiere.exceptions.AdempiereException; import org.compiere.model.MClient; import org.compiere.model.MMailMsg; import org.compiere.model.MPayment; @@ -276,7 +277,10 @@ public class PaymentServlet extends HttpServlet else log.warning("No Order"); // - payment.processIt(DocAction.ACTION_Complete); + // Added adempiereException by zuhri + if(!payment.processIt(DocAction.ACTION_Complete)) + throw new AdempiereException("Failed when processing document - " + payment.getProcessMsg()); + // end added by zuhri payment.saveEx(); sendThanksEMail (request, ctx, payment, wu, wo); } From 57bc9b5d0b42e2e72033a7f2692af1aecee55236 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Mon, 23 Apr 2012 22:31:14 -0500 Subject: [PATCH 43/49] IDEMPIERE-236 Centralization of hardcoded IDs / massive upload (integrated into iDempiere by CarlosRuiz - globalqss) --- org.adempiere.base/src/org/compiere/Base.java | 5 +- .../src/org/compiere/impexp/ImpFormat.java | 11 +- .../src/org/compiere/model/GridFieldVO.java | 4 +- .../src/org/compiere/model/GridTable.java | 4 +- .../src/org/compiere/model/MCountry.java | 4 +- .../src/org/compiere/model/MEntityType.java | 4 +- .../src/org/compiere/model/MRegion.java | 4 +- .../src/org/compiere/model/MRequest.java | 4 +- .../src/org/compiere/model/MRole.java | 8 +- .../src/org/compiere/model/MSetup.java | 4 +- .../src/org/compiere/model/SystemIDs.java | 110 +++++++++++++++++- .../src/org/compiere/print/ReportEngine.java | 7 +- .../src/org/compiere/process/DocAction.java | 3 +- .../src/org/compiere/report/FinReport.java | 5 +- .../src/org/compiere/report/FinStatement.java | 5 +- .../org/compiere/wf/DocWorkflowManager.java | 5 +- .../src/org/compiere/wf/MWFActivity.java | 5 +- .../process/EnableNativeSequence.java | 5 +- .../pipo/AbstractElementHandler.java | 7 +- .../src/org/adempiere/pipo/PackRoll.java | 45 +++---- .../pipo/handler/MenuElementHandler.java | 5 +- .../src/org/compiere/apps/AArchive.java | 5 +- .../src/org/compiere/apps/AEnv.java | 7 +- .../src/org/compiere/apps/AMenu.java | 4 +- .../src/org/compiere/apps/APanel.java | 5 +- .../src/org/compiere/apps/ARequest.java | 5 +- .../src/org/compiere/apps/ProcessDialog.java | 11 +- .../org/compiere/apps/form/VAllocation.java | 9 +- .../src/org/compiere/apps/form/VPayPrint.java | 5 +- .../org/compiere/apps/form/VPaySelect.java | 7 +- .../src/org/compiere/apps/search/Find.java | 5 +- .../compiere/apps/search/InfoAssignment.java | 7 +- .../compiere/grid/VCreateFromInvoiceUI.java | 5 +- .../org/compiere/grid/VCreateFromRMAUI.java | 5 +- .../compiere/grid/VCreateFromShipmentUI.java | 10 +- .../compiere/grid/VCreateFromStatementUI.java | 5 +- .../org/compiere/grid/ed/VAccountDialog.java | 5 +- .../src/org/compiere/grid/ed/VLocator.java | 5 +- .../src/org/compiere/grid/ed/VLookup.java | 9 +- .../src/org/compiere/grid/ed/VPAttribute.java | 5 +- .../compiere/grid/ed/VPAttributeDialog.java | 7 +- .../src/org/compiere/pos/PosPayment.java | 5 +- .../src/org/compiere/print/Viewer.java | 5 +- .../org/eevolution/form/VInOutInvoiceGen.java | 15 +-- .../src/org/adempiere/webui/WArchive.java | 5 +- .../src/org/adempiere/webui/WRequest.java | 5 +- .../adempiere/webui/acct/WAcctViewerData.java | 5 +- .../adempiere/webui/apps/ProcessDialog.java | 9 +- .../webui/apps/form/WAllocation.java | 9 +- .../webui/apps/form/WCreateFromInvoiceUI.java | 5 +- .../webui/apps/form/WCreateFromRMAUI.java | 5 +- .../apps/form/WCreateFromShipmentUI.java | 8 +- .../apps/form/WCreateFromStatementUI.java | 5 +- .../adempiere/webui/apps/form/WPayPrint.java | 5 +- .../adempiere/webui/apps/form/WPaySelect.java | 8 +- .../webui/dashboard/DPFavourites.java | 5 +- .../webui/editor/WLocatorEditor.java | 5 +- .../webui/editor/WPAttributeEditor.java | 5 +- .../adempiere/webui/editor/WSearchEditor.java | 7 +- .../webui/panel/AbstractADWindowPanel.java | 5 +- .../webui/panel/InfoAssignmentPanel.java | 7 +- .../org/adempiere/webui/panel/MenuPanel.java | 5 +- .../adempiere/webui/window/FindWindow.java | 5 +- .../webui/window/WAccountDialog.java | 5 +- .../webui/window/WPAttributeDialog.java | 5 +- .../webui/window/ZkReportViewer.java | 5 +- .../org/compiere/apps/form/FactReconcile.java | 11 +- .../src/org/compiere/apps/form/InOutGen.java | 7 +- .../org/compiere/apps/form/InvoiceGen.java | 7 +- .../src/org/compiere/apps/form/PayPrint.java | 5 +- .../src/org/compiere/apps/form/PaySelect.java | 5 +- .../org/compiere/apps/form/TrxMaterial.java | 19 +-- .../src/org/compiere/print/ReportCtl.java | 21 ++-- 73 files changed, 385 insertions(+), 223 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/Base.java b/org.adempiere.base/src/org/compiere/Base.java index a6ccb430e0..3876ea85d5 100644 --- a/org.adempiere.base/src/org/compiere/Base.java +++ b/org.adempiere.base/src/org/compiere/Base.java @@ -23,6 +23,7 @@ import org.compiere.model.GridWindow; import org.compiere.model.GridWindowVO; import org.compiere.model.MConversionRate; import org.compiere.model.MUOMConversion; +import org.compiere.model.SystemIDs; import org.compiere.util.Env; import org.compiere.util.Login; @@ -32,7 +33,7 @@ import org.compiere.util.Login; * @author Jorg Janke * @version $Id: Base.java,v 1.5 2006/09/21 20:44:54 jjanke Exp $ */ -class Base +class Base implements SystemIDs { /** * Base Test @@ -52,7 +53,7 @@ class Base // ******************************************************************* // Table=100, Shipper=142, Window=102, Reference=101 - int AD_Window_ID = 102; + int AD_Window_ID = WINDOW_WINDOW_TAB_FIELD; long startTime = System.currentTimeMillis(); GridWindowVO vo = GridWindowVO.create(Env.getCtx(), 1, AD_Window_ID); GridWindow w = new GridWindow(vo); diff --git a/org.adempiere.base/src/org/compiere/impexp/ImpFormat.java b/org.adempiere.base/src/org/compiere/impexp/ImpFormat.java index 26d475b107..10aeb1a43c 100644 --- a/org.adempiere.base/src/org/compiere/impexp/ImpFormat.java +++ b/org.adempiere.base/src/org/compiere/impexp/ImpFormat.java @@ -24,6 +24,7 @@ import java.util.Properties; import java.util.logging.Level; import org.compiere.model.I_AD_ImpFormat; +import org.compiere.model.SystemIDs; import org.compiere.model.X_AD_ImpFormat; import org.compiere.model.X_I_GLJournal; import org.compiere.util.CLogger; @@ -39,7 +40,7 @@ import org.compiere.util.Env; * @version $Id: ImpFormat.java,v 1.3 2006/07/30 00:51:05 jjanke Exp $ */ -public final class ImpFormat +public final class ImpFormat implements SystemIDs { /** * Format @@ -150,24 +151,24 @@ public final class ImpFormat m_tableUniqueChild = "H_Commodity1"; // Vendor No may not be unique ! m_tableUniqueParent = "H_PartnrID"; // Makes it unique } - else if (m_AD_Table_ID == 532) // I_Product + else if (m_AD_Table_ID == TABLE_I_PRODUCT) // I_Product { m_tableUnique1 = "UPC"; // UPC = unique m_tableUnique2 = "Value"; m_tableUniqueChild = "VendorProductNo"; // Vendor No may not be unique ! m_tableUniqueParent = "BPartner_Value"; // Makes it unique } - else if (m_AD_Table_ID == 533) // I_BPartner + else if (m_AD_Table_ID == TABLE_I_BPARTNER) // I_BPartner { // gody: 20070113 to allow multiple contacts per BP // m_tableUnique1 = "Value"; // the key } - else if (m_AD_Table_ID == 534) // I_ElementValue + else if (m_AD_Table_ID == TABLE_I_ELEMENTVALUE) // I_ElementValue { m_tableUniqueParent = "ElementName"; // the parent key m_tableUniqueChild = "Value"; // the key } - else if (m_AD_Table_ID == 535) // I_ReportLine + else if (m_AD_Table_ID == TABLE_I_REPORTLINE) // I_ReportLine { m_tableUniqueParent = "ReportLineSetName"; // the parent key m_tableUniqueChild = "Name"; // the key diff --git a/org.adempiere.base/src/org/compiere/model/GridFieldVO.java b/org.adempiere.base/src/org/compiere/model/GridFieldVO.java index d322b88c47..b9594a16fd 100644 --- a/org.adempiere.base/src/org/compiere/model/GridFieldVO.java +++ b/org.adempiere.base/src/org/compiere/model/GridFieldVO.java @@ -39,7 +39,7 @@ import org.compiere.util.Env; * @see http://sourceforge.net/tracker/?func=detail&atid=879335&aid=1877902&group_id=176962 to FR [1877902] * @version $Id: GridFieldVO.java,v 1.3 2006/07/30 00:58:04 jjanke Exp $ */ -public class GridFieldVO implements Serializable +public class GridFieldVO implements Serializable, SystemIDs { /** * @@ -351,7 +351,7 @@ public class GridFieldVO implements Serializable vo.ColumnName += "By"; vo.displayType = isTimestamp ? DisplayType.DateTime : DisplayType.Table; if (!isTimestamp) - vo.AD_Reference_Value_ID = 110; // AD_User Table Reference + vo.AD_Reference_Value_ID = REFERENCE_AD_USER; // AD_User Table Reference vo.IsDisplayed = false; vo.IsMandatory = false; vo.IsReadOnly = false; diff --git a/org.adempiere.base/src/org/compiere/model/GridTable.java b/org.adempiere.base/src/org/compiere/model/GridTable.java index 874d145aba..cda332be52 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTable.java +++ b/org.adempiere.base/src/org/compiere/model/GridTable.java @@ -85,7 +85,7 @@ import org.compiere.util.ValueNamePair; * https://sourceforge.net/tracker/?func=detail&aid=2910368&group_id=176962&atid=879332 */ public class GridTable extends AbstractTableModel - implements Serializable + implements Serializable, SystemIDs { /** * generated @@ -1434,7 +1434,7 @@ public class GridTable extends AbstractTableModel boolean specialZeroUpdate = false; if (!m_inserting // not inserting, updating a record && manualCmd // in a manual way (pushing the save button) - && (Env.getAD_User_ID(m_ctx) == 0 || Env.getAD_User_ID(m_ctx) == 100) // user must know what is doing -> just allowed to System or SuperUser (Hardcoded) + && (Env.getAD_User_ID(m_ctx) == USER_SYSTEM || Env.getAD_User_ID(m_ctx) == USER_SUPERUSER) // user must know what is doing -> just allowed to System or SuperUser (Hardcoded) && getKeyID(m_rowChanged) == 0) { // the record being changed has ID = 0 String tablename = getTableName(); // just the allowed tables (HardCoded) if (tablename.equals("AD_Org") || diff --git a/org.adempiere.base/src/org/compiere/model/MCountry.java b/org.adempiere.base/src/org/compiere/model/MCountry.java index f207650968..5c383f1c78 100644 --- a/org.adempiere.base/src/org/compiere/model/MCountry.java +++ b/org.adempiere.base/src/org/compiere/model/MCountry.java @@ -41,7 +41,7 @@ import org.compiere.util.Language; *
  • BF [ 2695078 ] Country is not translated on invoice */ public final class MCountry extends X_C_Country - implements Comparator, Serializable + implements Comparator, Serializable, SystemIDs { /** * @@ -124,7 +124,7 @@ public final class MCountry extends X_C_Country // Country code of Client Language if (lang != null && lang.getCountryCode().equals(c.getCountryCode())) s_default = c; - if (c.getC_Country_ID() == 100) // USA + if (c.getC_Country_ID() == COUNTRY_US) // USA usa = c; } rs.close(); diff --git a/org.adempiere.base/src/org/compiere/model/MEntityType.java b/org.adempiere.base/src/org/compiere/model/MEntityType.java index 261edcf8b2..30c23e9128 100644 --- a/org.adempiere.base/src/org/compiere/model/MEntityType.java +++ b/org.adempiere.base/src/org/compiere/model/MEntityType.java @@ -38,7 +38,7 @@ import org.compiere.util.CLogger; *
  • BF [ 2861194 ] EntityType is not using normal PO framework for getting IDs * https://sourceforge.net/tracker/?func=detail&aid=2861194&group_id=176962&atid=879332 */ -public class MEntityType extends X_AD_EntityType +public class MEntityType extends X_AD_EntityType implements SystemIDs { /** * @@ -219,7 +219,7 @@ public class MEntityType extends X_AD_EntityType if (!newRecord) { int id = getAD_EntityType_ID(); - boolean systemMaintained = (id == 10 || id == 20); // C/D + boolean systemMaintained = (id == ENTITYTYPE_DICTIONARY || id == ENTITYTYPE_ADEMPIERE); // C/D if (systemMaintained) { log.saveError("Error", "You cannot modify a System maintained entity"); diff --git a/org.adempiere.base/src/org/compiere/model/MRegion.java b/org.adempiere.base/src/org/compiere/model/MRegion.java index d8769182ef..68010e94dc 100644 --- a/org.adempiere.base/src/org/compiere/model/MRegion.java +++ b/org.adempiere.base/src/org/compiere/model/MRegion.java @@ -40,7 +40,7 @@ import org.compiere.util.Env; * @version $Id: MRegion.java,v 1.3 2006/07/30 00:58:36 jjanke Exp $ */ public final class MRegion extends X_C_Region - implements Comparator, Serializable + implements Comparator, Serializable, SystemIDs { /** * @@ -236,7 +236,7 @@ public final class MRegion extends X_C_Region * Please make sure that the file is converted via the Java utility * native2ascii - i.e. all seven bit code with /u0000 unicode stuff */ - int C_Country_ID = 216; // Japan + int C_Country_ID = COUNTRY_JAPAN; // Japan MCountry country = new MCountry(Env.getCtx(), C_Country_ID, null); // Hokkaido MRegion temp = new MRegion (country, "\u5317\u6d77\u9053"); diff --git a/org.adempiere.base/src/org/compiere/model/MRequest.java b/org.adempiere.base/src/org/compiere/model/MRequest.java index 8b2d5858de..9f81f17f75 100644 --- a/org.adempiere.base/src/org/compiere/model/MRequest.java +++ b/org.adempiere.base/src/org/compiere/model/MRequest.java @@ -38,7 +38,7 @@ import org.compiere.util.TimeUtil; * @author Jorg Janke * @version $Id: MRequest.java,v 1.2 2006/07/30 00:51:03 jjanke Exp $ */ -public class MRequest extends X_R_Request +public class MRequest extends X_R_Request implements SystemIDs { /** * @@ -1212,7 +1212,7 @@ public class MRequest extends X_R_Request if (X_AD_User.NOTIFICATIONTYPE_Notice.equals(NotificationType) || X_AD_User.NOTIFICATIONTYPE_EMailPlusNotice.equals(NotificationType)) { - int AD_Message_ID = 834; + int AD_Message_ID = MESSAGE_REQUESTUPDATE; MNote note = new MNote(getCtx(), AD_Message_ID, AD_User_ID, X_R_Request.Table_ID, getR_Request_ID(), subject, message.toString(), get_TrxName()); diff --git a/org.adempiere.base/src/org/compiere/model/MRole.java b/org.adempiere.base/src/org/compiere/model/MRole.java index 48bc0a4392..1f3ad18009 100644 --- a/org.adempiere.base/src/org/compiere/model/MRole.java +++ b/org.adempiere.base/src/org/compiere/model/MRole.java @@ -54,7 +54,7 @@ import org.compiere.util.Trace; * @contributor KittiU - FR [ 3062553 ] - Duplicated action in DocAction list for Multiple Role Users * @version $Id: MRole.java,v 1.5 2006/08/09 16:38:47 jjanke Exp $ */ -public final class MRole extends X_AD_Role +public final class MRole extends X_AD_Role implements SystemIDs { /** * @@ -246,10 +246,10 @@ public final class MRole extends X_AD_Role public static final boolean SQL_NOTQUALIFIED = false; /** The AD_User_ID of the SuperUser */ - public static final int SUPERUSER_USER_ID = 100; + public static final int SUPERUSER_USER_ID = USER_SUPERUSER; /** The AD_User_ID of the System Administrator */ - public static final int SYSTEM_USER_ID = 0; - + public static final int SYSTEM_USER_ID = USER_SYSTEM; + private static final String ROLE_KEY = "org.compiere.model.DefaultRole"; diff --git a/org.adempiere.base/src/org/compiere/model/MSetup.java b/org.adempiere.base/src/org/compiere/model/MSetup.java index 3af577ef4f..79ac48dc21 100644 --- a/org.adempiere.base/src/org/compiere/model/MSetup.java +++ b/org.adempiere.base/src/org/compiere/model/MSetup.java @@ -46,7 +46,7 @@ import org.compiere.util.Trx; * @author Carlos Ruiz - globalqss *
  • Setup correctly IsSOTrx for return documents */ -public final class MSetup +public final class MSetup implements SystemIDs { /** * Constructor @@ -1058,7 +1058,7 @@ public final class MSetup sqlCmd.append("(C_TaxCategory_ID,").append(m_stdColumns).append(","); sqlCmd.append(" Name,IsDefault) VALUES ("); sqlCmd.append(C_TaxCategory_ID).append(",").append(m_stdValues).append(", "); - if (C_Country_ID == 100) // US + if (C_Country_ID == COUNTRY_US) // US sqlCmd.append("'Sales Tax','Y')"); else sqlCmd.append(defaultEntry).append("'Y')"); diff --git a/org.adempiere.base/src/org/compiere/model/SystemIDs.java b/org.adempiere.base/src/org/compiere/model/SystemIDs.java index 5a63bb14e8..fa091d7cc4 100644 --- a/org.adempiere.base/src/org/compiere/model/SystemIDs.java +++ b/org.adempiere.base/src/org/compiere/model/SystemIDs.java @@ -16,6 +16,8 @@ *****************************************************************************/ package org.compiere.model; +import org.compiere.util.DisplayType; + /** * List all hardcoded ID used in the code * @author Carlos Ruiz, Nicolas Micoud, ... @@ -23,9 +25,113 @@ package org.compiere.model; public interface SystemIDs { + public final static int COLUMN_AD_WF_ACTIVITY_AD_USER_ID = 10443; + public final static int COLUMN_C_BANKSTATEMENT_C_BANKACCOUNT_ID = 4917; + public final static int COLUMN_C_PERIOD_AD_ORG_ID = 839; + public final static int COLUMN_C_INVOICE_C_BPARTNER_ID = 3499; + public final static int COLUMN_C_INVOICE_C_CURRENCY_ID = 3505; + public final static int COLUMN_C_INVOICELINE_M_PRODUCT_ID = 3840; + public final static int COLUMN_C_PAYMENT_V_TENDERTYPE = 8416; + public final static int COLUMN_C_PAYSELECTIONCHECK_C_PAYSELECTION_ID = 7670; + public final static int COLUMN_FACT_ACCT_C_ACCTSCHEMA_ID = 2513; + public final static int COLUMN_FACT_ACCT_M_PRODUCT_ID = 2527; + public final static int COLUMN_M_MOVEMENTLINE_M_ATTRIBUTESETINSTANCE_ID = 8851; + public final static int COLUMN_M_PRODUCT_M_ATTRIBUTESETINSTANCE_ID = 8418; + public final static int COLUMN_S_RESOURCE_S_RESOURCETYPE_ID = 6851; + public final static int COLUMN_S_RESOURCEASSIGNMENT_S_RESOURCE_ID = 6826; + public final static int COUNTRY_US = 100; + public final static int COUNTRY_JAPAN = 216; + + public final static int ENTITYTYPE_ADEMPIERE = 20; + public final static int ENTITYTYPE_DICTIONARY = 10; + + public final static int FORM_PAYMENT_PRINT_EXPORT = 106; + public final static int FORM_ARCHIVEVIEWER = 118; + + public final static int MENU_NOTICE = 233; + + public final static int MESSAGE_REQUESTUPDATE = 834; + public final static int MESSAGE_WORKFLOWRESULT = 753; + + public final static int PRINTFORMAT_STATEMENTOFACCOUNT = 134; + + public final static int PROCESS_AD_WORKFLOW_DOCVALUE = 305; + public final static int PROCESS_AD_CHANGELOG_UNDO = 306; + public final static int PROCESS_AD_CHANGELOG_REDO = 307; + public final static int PROCESS_AD_NATIVE_SEQUENCE_ENABLE = 53156; + public final static int PROCESS_C_INVOICE_GENERATE = 119; + public final static int PROCESS_C_INVOICE_GENERATE_MANUAL = 134; + public final static int PROCESS_C_INVOICE_GENERATERMA_MANUAL = 52002; + public final static int PROCESS_C_PAYSELECTION_CREATEPAYMENT = 155; + public final static int PROCESS_M_INOUT_GENERATE = 118; + public final static int PROCESS_M_INOUT_GENERATE_MANUAL = 199; + public final static int PROCESS_M_INOUT_GENERATERMA_MANUAL = 52001; + public final static int PROCESS_RPT_C_ORDER = 110; + public final static int PROCESS_RPT_C_PAYMENT = 313; + public final static int PROCESS_RPT_M_INOUT = 117; + public final static int PROCESS_RPT_C_INVOICE = 116; + public final static int PROCESS_RPT_C_PROJECT = 217; + public final static int PROCESS_RPT_C_RFQRESPONSE = 276; + public final static int PROCESS_RPT_C_DUNNING = 159; + public final static int PROCESS_RPT_FINREPORT = 202; + public final static int PROCESS_RPT_FINSTATEMENT = 204; + + public final static int REFERENCE_DATATYPE_ACCOUNT = DisplayType.Account; //25 + public final static int REFERENCE_DATATYPE_INTEGER = 11; + public final static int REFERENCE_DATATYPE_LIST = 17; + public final static int REFERENCE_DATATYPE_TEXT = 14; + public final static int REFERENCE_DATATYPE_MEMO = 34; + public final static int REFERENCE_DATATYPE_AMOUNT = 12; + public final static int REFERENCE_DATATYPE_DATE = 15; + public final static int REFERENCE_DATATYPE_DATETIME = 16; + public final static int REFERENCE_DATATYPE_ID = 13; + public final static int REFERENCE_DATATYPE_STRING = 10; + public final static int REFERENCE_DATATYPE_NUMBER = 22; + public final static int REFERENCE_DATATYPE_YES_NO = 20; + public final static int REFERENCE_DATATYPE_BUTTON = 28; + public final static int REFERENCE_DATATYPE_TABLE = 18; + public final static int REFERENCE_DATATYPE_TABLEDIR = 19; + public final static int REFERENCE_DATATYPE_SEARCH = 30; + public final static int REFERENCE_DATATYPE_QUANTITY = 29; + public final static int REFERENCE_DATATYPE_PRODUCTATTRIBUTE = 35; + public final static int REFERENCE_DATATYPE_LOCATOR = 31; + public final static int REFERENCE_DATATYPE_LOCATION = 21; + public final static int REFERENCE_DATATYPE_COLOR = 27; + + public static final int REFERENCE_AD_USER = 110; + public final static int REFERENCE_DOCUMENTACTION = 135; + public final static int REFERENCE_PAYMENTRULE = 195; public final static int REFERENCE_POSTING_TYPE = 125; - + public final static int REFERENCE_YESNO = 319; + + public final static int TABLE_AD_TABLE = 100; + public final static int TABLE_AD_WF_PROCESS = 645; + public final static int TABLE_AD_WF_ACTIVITY = 644; + public final static int TABLE_I_PRODUCT = 532; + public final static int TABLE_I_BPARTNER = 533; + public final static int TABLE_I_ELEMENTVALUE = 534; + public final static int TABLE_I_REPORTLINE = 535; + public final static int TABLE_T_REPORT = 544; + + public final static int TREE_MENUPRIMARY = 10; + + public final static int USER_SUPERUSER = 100; + public final static int USER_SYSTEM = 0; + + public final static int WINDOW_ACCOUNTCOMBINATION = 153; + public static final int WINDOW_CUSTOMERRETURN = 53097; + public final static int WINDOW_INVENTORYMOVE = 170; + public final static int WINDOW_LOT = 257; + public final static int WINDOW_MATERIALRECEIPT = 184; + public final static int WINDOW_MATERIALTRANSACTIONS_INDIRECTUSER = 223; public final static int WINDOW_MY_REQUESTS = 237; - + public final static int WINDOW_PHYSICALINVENTORY = 168; + public final static int WINDOW_PRINTFORMAT = 240; + public final static int WINDOW_PRODUCTION = 191; + public final static int WINDOW_REQUESTS_ALL = 232; + public static final int WINDOW_RETURNTOVENDOR = 53098; + public final static int WINDOW_SHIPMENT_CUSTOMER = 169; + public final static int WINDOW_WAREHOUSE_LOCATOR = 139; + public final static int WINDOW_WINDOW_TAB_FIELD = 102; } diff --git a/org.adempiere.base/src/org/compiere/print/ReportEngine.java b/org.adempiere.base/src/org/compiere/print/ReportEngine.java index 001cd13fbf..740491e981 100644 --- a/org.adempiere.base/src/org/compiere/print/ReportEngine.java +++ b/org.adempiere.base/src/org/compiere/print/ReportEngine.java @@ -68,6 +68,7 @@ import org.compiere.model.MProject; import org.compiere.model.MQuery; import org.compiere.model.MRfQResponse; import org.compiere.model.PrintInfo; +import org.compiere.model.SystemIDs; import org.compiere.print.layout.LayoutEngine; import org.compiere.process.ProcessInfo; import org.compiere.util.CLogger; @@ -78,7 +79,7 @@ import org.compiere.util.Ini; import org.compiere.util.Language; import org.compiere.util.Util; import org.eevolution.model.MDDOrder; -import org.eevolution.model.X_PP_Order; // to be changed by MPPOrder +import org.eevolution.model.X_PP_Order; /** * Report Engine. @@ -104,7 +105,7 @@ import org.eevolution.model.X_PP_Order; // to be changed by MPPOrder * * FR 2872010 - Dunning Run for a complete Dunning (not just level) - Developer: Carlos Ruiz - globalqss - Sponsor: Metas */ -public class ReportEngine implements PrintServiceAttributeListener +public class ReportEngine implements PrintServiceAttributeListener, SystemIDs { /** * Constructor @@ -1567,7 +1568,7 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) { org.compiere.Adempiere.startupEnvironment(true); // - int AD_Table_ID = 100; + int AD_Table_ID = TABLE_AD_TABLE; MQuery q = new MQuery("AD_Table"); q.addRestriction("AD_Table_ID", "<", 108); // diff --git a/org.adempiere.base/src/org/compiere/process/DocAction.java b/org.adempiere.base/src/org/compiere/process/DocAction.java index 679d9578fa..5b0a238be3 100644 --- a/org.adempiere.base/src/org/compiere/process/DocAction.java +++ b/org.adempiere.base/src/org/compiere/process/DocAction.java @@ -21,6 +21,7 @@ import java.math.BigDecimal; import java.util.Properties; import org.adempiere.exceptions.AdempiereException; +import org.compiere.model.SystemIDs; import org.compiere.util.CLogger; /** @@ -88,7 +89,7 @@ public interface DocAction public static final String STATUS_WaitingConfirmation = "WC"; /** DocAction Ref_List values **/ - public static final int AD_REFERENCE_ID = 135; + public static final int AD_REFERENCE_ID = SystemIDs.REFERENCE_DOCUMENTACTION; /** * Set Doc Status diff --git a/org.adempiere.base/src/org/compiere/report/FinReport.java b/org.adempiere.base/src/org/compiere/report/FinReport.java index 5fb5a9d2c8..3971d1ed1d 100644 --- a/org.adempiere.base/src/org/compiere/report/FinReport.java +++ b/org.adempiere.base/src/org/compiere/report/FinReport.java @@ -25,6 +25,7 @@ import java.util.logging.Level; import org.compiere.model.MAcctSchemaElement; import org.compiere.model.MReportCube; +import org.compiere.model.SystemIDs; import org.compiere.print.MPrintFormat; import org.compiere.print.MPrintFormatItem; import org.compiere.process.ProcessInfoParameter; @@ -45,7 +46,7 @@ import org.compiere.util.TimeUtil; * * @version $Id: FinReport.java,v 1.2 2006/07/30 00:51:05 jjanke Exp $ */ -public class FinReport extends SvrProcess +public class FinReport extends SvrProcess implements SystemIDs { /** Period Parameter */ private int p_C_Period_ID = 0; @@ -1177,7 +1178,7 @@ public class FinReport extends SvrProcess // Create New if (createNew) { - int AD_Table_ID = 544; // T_Report + int AD_Table_ID = TABLE_T_REPORT; // T_Report pf = MPrintFormat.createFromTable(Env.getCtx(), AD_Table_ID); AD_PrintFormat_ID = pf.getAD_PrintFormat_ID(); m_report.setAD_PrintFormat_ID(AD_PrintFormat_ID); diff --git a/org.adempiere.base/src/org/compiere/report/FinStatement.java b/org.adempiere.base/src/org/compiere/report/FinStatement.java index c7f98ca8fa..48a1c93958 100644 --- a/org.adempiere.base/src/org/compiere/report/FinStatement.java +++ b/org.adempiere.base/src/org/compiere/report/FinStatement.java @@ -27,6 +27,7 @@ import java.util.logging.Level; import org.compiere.model.MAcctSchemaElement; import org.compiere.model.MElementValue; import org.compiere.model.MPeriod; +import org.compiere.model.SystemIDs; import org.compiere.print.MPrintFormat; import org.compiere.process.ProcessInfoParameter; import org.compiere.process.SvrProcess; @@ -52,7 +53,7 @@ import org.compiere.util.Msg; *
  • FR [2857076] User Element 1 and 2 completion - https://sourceforge.net/tracker/?func=detail&aid=2857076&group_id=176962&atid=879335 * */ -public class FinStatement extends SvrProcess +public class FinStatement extends SvrProcess implements SystemIDs { /** AcctSchame Parameter */ private int p_C_AcctSchema_ID = 0; @@ -273,7 +274,7 @@ public class FinStatement extends SvrProcess createBalanceLine(); createDetailLines(); - int AD_PrintFormat_ID = 134; + int AD_PrintFormat_ID = PRINTFORMAT_STATEMENTOFACCOUNT; if (Ini.isClient()) getProcessInfo().setTransientObject (MPrintFormat.get (getCtx(), AD_PrintFormat_ID, false)); else diff --git a/org.adempiere.base/src/org/compiere/wf/DocWorkflowManager.java b/org.adempiere.base/src/org/compiere/wf/DocWorkflowManager.java index 96c3ea3379..32cef60564 100644 --- a/org.adempiere.base/src/org/compiere/wf/DocWorkflowManager.java +++ b/org.adempiere.base/src/org/compiere/wf/DocWorkflowManager.java @@ -22,6 +22,7 @@ import java.util.logging.Level; import org.compiere.model.DocWorkflowMgr; import org.compiere.model.PO; +import org.compiere.model.SystemIDs; import org.compiere.process.ProcessInfo; import org.compiere.util.CLogger; import org.compiere.util.DB; @@ -35,7 +36,7 @@ import org.compiere.util.Evaluator; * @author Jorg Janke * @version $Id: DocWorkflowManager.java,v 1.2 2006/07/30 00:51:05 jjanke Exp $ */ -public class DocWorkflowManager implements DocWorkflowMgr +public class DocWorkflowManager implements DocWorkflowMgr, SystemIDs { /** * Get Document Workflow Manager @@ -119,7 +120,7 @@ public class DocWorkflowManager implements DocWorkflowMgr // Start Workflow log.fine(logic); - int AD_Process_ID = 305; // HARDCODED + int AD_Process_ID = PROCESS_AD_WORKFLOW_DOCVALUE; // HARDCODED ProcessInfo pi = new ProcessInfo (wf.getName(), AD_Process_ID, AD_Table_ID, document.get_ID()); pi.setAD_User_ID (Env.getAD_User_ID(document.getCtx())); diff --git a/org.adempiere.base/src/org/compiere/wf/MWFActivity.java b/org.adempiere.base/src/org/compiere/wf/MWFActivity.java index ecb04c4660..ea4c2e01ac 100644 --- a/org.adempiere.base/src/org/compiere/wf/MWFActivity.java +++ b/org.adempiere.base/src/org/compiere/wf/MWFActivity.java @@ -51,6 +51,7 @@ import org.compiere.model.MUser; import org.compiere.model.MUserRoles; import org.compiere.model.PO; import org.compiere.model.Query; +import org.compiere.model.SystemIDs; import org.compiere.model.X_AD_WF_Activity; import org.compiere.print.ReportEngine; import org.compiere.process.DocAction; @@ -72,7 +73,7 @@ import org.compiere.util.Util; * @author Jorg Janke * @version $Id: MWFActivity.java,v 1.4 2006/07/30 00:51:05 jjanke Exp $ */ -public class MWFActivity extends X_AD_WF_Activity implements Runnable +public class MWFActivity extends X_AD_WF_Activity implements Runnable, SystemIDs { /** * @@ -1048,7 +1049,7 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable throw new IllegalStateException("Cannot create Report AD_Process_ID=" + m_node.getAD_Process_ID()); File report = re.getPDF(); // Notice - int AD_Message_ID = 753; // HARDCODED WorkflowResult + int AD_Message_ID = MESSAGE_WORKFLOWRESULT; // HARDCODED WorkflowResult MNote note = new MNote(getCtx(), AD_Message_ID, getAD_User_ID(), trx.getTrxName()); note.setTextMsg(m_node.getName(true)); note.setDescription(m_node.getDescription(true)); diff --git a/org.adempiere.base/src/org/eevolution/process/EnableNativeSequence.java b/org.adempiere.base/src/org/eevolution/process/EnableNativeSequence.java index 2eee1ce512..c79c2a7b00 100644 --- a/org.adempiere.base/src/org/eevolution/process/EnableNativeSequence.java +++ b/org.adempiere.base/src/org/eevolution/process/EnableNativeSequence.java @@ -29,6 +29,7 @@ import org.compiere.model.MSequence; import org.compiere.model.MSysConfig; import org.compiere.model.MTable; import org.compiere.model.Query; +import org.compiere.model.SystemIDs; import org.compiere.model.X_AD_Table; import org.compiere.process.ProcessInfo; import org.compiere.process.SvrProcess; @@ -42,7 +43,7 @@ import org.compiere.util.Env; * @author Victor Perez, e-Evolution, S.C. * @author Teo Sarca, teo.sarca@gmail.com */ -public class EnableNativeSequence extends SvrProcess +public class EnableNativeSequence extends SvrProcess implements SystemIDs { /** @@ -128,7 +129,7 @@ public class EnableNativeSequence extends SvrProcess CLogMgt.setLevel(Level.INFO); Properties ctx = Env.getCtx(); - int AD_Process_ID = 53156; // HARDCODED + int AD_Process_ID = PROCESS_AD_NATIVE_SEQUENCE_ENABLE; // HARDCODED MPInstance pinstance = new MPInstance(ctx, AD_Process_ID, -1); pinstance.saveEx(); diff --git a/org.adempiere.pipo.legacy/src/org/adempiere/pipo/AbstractElementHandler.java b/org.adempiere.pipo.legacy/src/org/adempiere/pipo/AbstractElementHandler.java index fe8a9d0645..9c70c00f3e 100644 --- a/org.adempiere.pipo.legacy/src/org/adempiere/pipo/AbstractElementHandler.java +++ b/org.adempiere.pipo.legacy/src/org/adempiere/pipo/AbstractElementHandler.java @@ -28,6 +28,7 @@ import javax.xml.transform.sax.TransformerHandler; import org.compiere.model.PO; import org.compiere.model.POInfo; +import org.compiere.model.SystemIDs; import org.compiere.model.X_AD_Package_Imp_Detail; import org.compiere.util.CLogger; import org.compiere.util.DB; @@ -36,7 +37,7 @@ import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; -public abstract class AbstractElementHandler implements ElementHandler { +public abstract class AbstractElementHandler implements ElementHandler, SystemIDs { protected CLogger log = CLogger.getCLogger("PackIn"); @@ -203,10 +204,10 @@ public abstract class AbstractElementHandler implements ElementHandler { sqlD = new StringBuffer("SELECT MAX(AD_PACKAGE_IMP_DETAIL_ID) FROM AD_PACKAGE_IMP_DETAIL"); int idDetail = DB.getSQLValue(getTrxName(ctx),sqlD.toString())+1; - if (referenceID == 10 || referenceID == 14 || referenceID == 34 || referenceID == 17) + if (referenceID == REFERENCE_DATATYPE_STRING || referenceID == REFERENCE_DATATYPE_TEXT || referenceID == REFERENCE_DATATYPE_MEMO || referenceID == REFERENCE_DATATYPE_LIST) if (from != null && from.get_Value(i)!= null) colValue = from.get_Value(i).toString().replaceAll("'","''"); - else if (referenceID == 20|| referenceID == 28) + else if (referenceID == REFERENCE_DATATYPE_YES_NO|| referenceID == REFERENCE_DATATYPE_BUTTON) if (from != null && from.get_Value(i)!= null) colValue = from.get_Value(i).toString().replaceAll("'","''"); else diff --git a/org.adempiere.pipo.legacy/src/org/adempiere/pipo/PackRoll.java b/org.adempiere.pipo.legacy/src/org/adempiere/pipo/PackRoll.java index 23deb1dc57..8216e5de83 100644 --- a/org.adempiere.pipo.legacy/src/org/adempiere/pipo/PackRoll.java +++ b/org.adempiere.pipo.legacy/src/org/adempiere/pipo/PackRoll.java @@ -25,6 +25,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.logging.Level; +import org.compiere.model.SystemIDs; import org.compiere.process.ProcessInfoParameter; import org.compiere.process.SvrProcess; import org.compiere.util.DB; @@ -36,7 +37,7 @@ import org.compiere.util.Env; * @author Robert Klein * */ -public class PackRoll extends SvrProcess { +public class PackRoll extends SvrProcess implements SystemIDs { /** Package from Record */ private int m_AD_Package_Imp_ID = 0; private String m_Processing = null; @@ -258,14 +259,14 @@ public class PackRoll extends SvrProcess { // Update columns that are Strings adjusting // for single quotes if (v_AD_Reference_ID == 10 - || v_AD_Reference_ID == 14 - || v_AD_Reference_ID == 34 - || v_AD_Reference_ID == 17 + || v_AD_Reference_ID == REFERENCE_DATATYPE_TEXT + || v_AD_Reference_ID == REFERENCE_DATATYPE_MEMO + || v_AD_Reference_ID == REFERENCE_DATATYPE_LIST // Carlos Ruiz globalqss, special // treatment for EntityType // it's a Table reference but must // be treated as String - || (v_AD_Reference_ID == 18 && columnName + || (v_AD_Reference_ID == REFERENCE_DATATYPE_TABLE && columnName .equalsIgnoreCase("EntityType"))) if (rs2.getObject("ColValue") .toString().equals("null")) { @@ -285,8 +286,8 @@ public class PackRoll extends SvrProcess { + " = " + recordID); } // Update true/false columns - else if (v_AD_Reference_ID == 20 - || v_AD_Reference_ID == 28) { + else if (v_AD_Reference_ID == REFERENCE_DATATYPE_YES_NO + || v_AD_Reference_ID == REFERENCE_DATATYPE_BUTTON) { sqlC = new StringBuffer("UPDATE " + tableName + " SET " @@ -301,15 +302,15 @@ public class PackRoll extends SvrProcess { } // Update columns that are Strings adjusting // for single quotes - else if (v_AD_Reference_ID == 13 - || v_AD_Reference_ID == 18 - || v_AD_Reference_ID == 19 - || v_AD_Reference_ID == 21 - || v_AD_Reference_ID == 25 - || v_AD_Reference_ID == 27 - || v_AD_Reference_ID == 30 - || v_AD_Reference_ID == 31 - || v_AD_Reference_ID == 35) + else if (v_AD_Reference_ID == REFERENCE_DATATYPE_ID + || v_AD_Reference_ID == REFERENCE_DATATYPE_TABLE + || v_AD_Reference_ID == REFERENCE_DATATYPE_TABLEDIR + || v_AD_Reference_ID == REFERENCE_DATATYPE_LOCATION + || v_AD_Reference_ID == REFERENCE_DATATYPE_ACCOUNT + || v_AD_Reference_ID == REFERENCE_DATATYPE_COLOR + || v_AD_Reference_ID == REFERENCE_DATATYPE_SEARCH + || v_AD_Reference_ID == REFERENCE_DATATYPE_LOCATOR + || v_AD_Reference_ID == REFERENCE_DATATYPE_PRODUCTATTRIBUTE) sqlC = new StringBuffer("UPDATE " + tableName + " SET " @@ -321,10 +322,10 @@ public class PackRoll extends SvrProcess { + " WHERE " + columnIDName + " = " + recordID); // Update columns that are numbers - else if (v_AD_Reference_ID == 11 - || v_AD_Reference_ID == 12 - || v_AD_Reference_ID == 22 - || v_AD_Reference_ID == 29) + else if (v_AD_Reference_ID == REFERENCE_DATATYPE_INTEGER + || v_AD_Reference_ID == REFERENCE_DATATYPE_AMOUNT + || v_AD_Reference_ID == REFERENCE_DATATYPE_NUMBER + || v_AD_Reference_ID == REFERENCE_DATATYPE_QUANTITY) sqlC = new StringBuffer("UPDATE " + tableName + " SET " @@ -336,8 +337,8 @@ public class PackRoll extends SvrProcess { + " WHERE " + columnIDName + " = " + recordID); // Update columns that are dates - else if (v_AD_Reference_ID == 15 - || v_AD_Reference_ID == 16) + else if (v_AD_Reference_ID == REFERENCE_DATATYPE_DATE + || v_AD_Reference_ID == REFERENCE_DATATYPE_DATETIME) // TODO Develop portable code to update // date columns ;// ignore diff --git a/org.adempiere.pipo.legacy/src/org/adempiere/pipo/handler/MenuElementHandler.java b/org.adempiere.pipo.legacy/src/org/adempiere/pipo/handler/MenuElementHandler.java index 7ad51d0f18..2dd5174b12 100644 --- a/org.adempiere.pipo.legacy/src/org/adempiere/pipo/handler/MenuElementHandler.java +++ b/org.adempiere.pipo.legacy/src/org/adempiere/pipo/handler/MenuElementHandler.java @@ -27,6 +27,7 @@ import javax.xml.transform.sax.TransformerHandler; import org.adempiere.pipo.AbstractElementHandler; import org.adempiere.pipo.Element; import org.adempiere.pipo.PackOut; +import org.compiere.model.SystemIDs; import org.compiere.model.X_AD_Menu; import org.compiere.util.DB; import org.compiere.util.Env; @@ -34,7 +35,7 @@ import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; -public class MenuElementHandler extends AbstractElementHandler { +public class MenuElementHandler extends AbstractElementHandler implements SystemIDs { public void startElement(Properties ctx, Element element) throws SAXException { @@ -197,7 +198,7 @@ public class MenuElementHandler extends AbstractElementHandler { int idBackup = DB.getNextID(Env .getAD_Client_ID(ctx), "AD_Package_Imp_Backup", getTrxName(ctx)); - if (referenceID == 20 || referenceID == 28) + if (referenceID == REFERENCE_DATATYPE_YES_NO || referenceID == REFERENCE_DATATYPE_BUTTON) if (rs1.getObject(q).equals("Y")) colValue = "true"; else diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/AArchive.java b/org.adempiere.ui.swing/src/org/compiere/apps/AArchive.java index 2c14f69bf0..7e02acff5d 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/AArchive.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/AArchive.java @@ -29,6 +29,7 @@ import javax.swing.JPopupMenu; import org.compiere.apps.form.ArchiveViewer; import org.compiere.apps.form.FormFrame; import org.compiere.model.MBPartner; +import org.compiere.model.SystemIDs; import org.compiere.swing.CMenuItem; import org.compiere.util.CLogger; import org.compiere.util.DB; @@ -43,7 +44,7 @@ import org.compiere.util.Msg; * @author Jorg Janke * @version $Id: AArchive.java,v 1.2 2006/07/30 00:51:27 jjanke Exp $ */ -public class AArchive implements ActionListener +public class AArchive implements ActionListener, SystemIDs { /** * Constructor @@ -165,7 +166,7 @@ public class AArchive implements ActionListener */ public void actionPerformed (ActionEvent e) { - int AD_Form_ID = 118; // ArchiveViewer + int AD_Form_ID = FORM_ARCHIVEVIEWER; // ArchiveViewer FormFrame ff = new FormFrame(m_graphicsconfig); ff.openForm(AD_Form_ID); ArchiveViewer av = (ArchiveViewer)ff.getFormPanel(); diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/AEnv.java b/org.adempiere.ui.swing/src/org/compiere/apps/AEnv.java index 1ddec839d5..f7dd8ee3f2 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/AEnv.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/AEnv.java @@ -51,6 +51,7 @@ import org.compiere.interfaces.Server; import org.compiere.model.MMenu; import org.compiere.model.MQuery; import org.compiere.model.MRole; +import org.compiere.model.SystemIDs; import org.compiere.process.DocumentEngine; import org.compiere.swing.CButton; import org.compiere.swing.CFrame; @@ -74,7 +75,7 @@ import org.compiere.util.Splash; * @see FR [ 1966328 ] New Window Info to MRP and CRP into View http://sourceforge.net/tracker/index.php?func=detail&aid=1966328&group_id=176962&atid=879335 * */ -public final class AEnv +public final class AEnv implements SystemIDs { // Array of active Windows private static ArrayList s_windows = new ArrayList(20); @@ -795,12 +796,12 @@ public final class AEnv if (s_workflow == null) { s_workflow = Boolean.FALSE; - int AD_Table_ID = 645; // AD_WF_Process + int AD_Table_ID = TABLE_AD_WF_PROCESS; // AD_WF_Process if (MRole.getDefault().isTableAccess (AD_Table_ID, true)) // RO s_workflow = Boolean.TRUE; else { - AD_Table_ID = 644; // AD_WF_Activity + AD_Table_ID = TABLE_AD_WF_ACTIVITY; // AD_WF_Activity if (MRole.getDefault().isTableAccess (AD_Table_ID, true)) // RO s_workflow = Boolean.TRUE; else diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java b/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java index a080d00ded..3cce7f4d50 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java @@ -168,7 +168,7 @@ public final class AMenu extends CFrame + " INNER JOIN AD_Role r ON (ci.AD_Client_ID=r.AD_Client_ID) " + "WHERE AD_Role_ID=?", AD_Role_ID); if (AD_Tree_ID <= 0) - AD_Tree_ID = 10; // Menu + AD_Tree_ID = TREE_MENUPRIMARY; // Menu treePanel.initTree(AD_Tree_ID); // Translate @@ -656,7 +656,7 @@ public final class AMenu extends CFrame + " INNER JOIN AD_TABLE t ON (t.AD_Window_ID=m.AD_Window_ID) " + "WHERE t.AD_Table_ID=?", 389); if (m_note_Menu_ID == 0) - m_note_Menu_ID = 233; // fallback HARDCODED + m_note_Menu_ID = MENU_NOTICE; // fallback HARDCODED (new AMenuStartItem (m_note_Menu_ID, true, Msg.translate(m_ctx, "AD_Note_ID"), this)).start(); // async load } // gotoMessage diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/APanel.java b/org.adempiere.ui.swing/src/org/compiere/apps/APanel.java index 2dec7cb525..01ff68580e 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/APanel.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/APanel.java @@ -90,6 +90,7 @@ import org.compiere.model.MRole; import org.compiere.model.MToolBarButtonRestrict; import org.compiere.model.MUser; import org.compiere.model.MWindow; +import org.compiere.model.SystemIDs; import org.compiere.model.X_AD_ToolBarButton; import org.compiere.plaf.CompiereColor; import org.compiere.print.AReport; @@ -143,7 +144,7 @@ import org.compiere.util.Util; * @sponsor www.metas.de */ public final class APanel extends CPanel - implements DataStatusListener, ChangeListener, ActionListener, IProcessMonitor + implements DataStatusListener, ChangeListener, ActionListener, IProcessMonitor, SystemIDs { /** * @@ -2509,7 +2510,7 @@ public final class APanel extends CPanel record_ID = Env.getContextAsInt (m_ctx, m_curWindowNo, "AD_Language_ID"); // Record_ID - Change Log ID if (record_ID == -1 - && (vButton.getProcess_ID() == 306 || vButton.getProcess_ID() == 307)) + && (vButton.getProcess_ID() == PROCESS_AD_CHANGELOG_UNDO || vButton.getProcess_ID() == PROCESS_AD_CHANGELOG_REDO)) { Integer id = (Integer)m_curTab.getValue("AD_ChangeLog_ID"); record_ID = id.intValue(); diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/ARequest.java b/org.adempiere.ui.swing/src/org/compiere/apps/ARequest.java index 11ba1644fc..db3ca66d50 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/ARequest.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/ARequest.java @@ -41,6 +41,7 @@ import org.compiere.model.MQuery; import org.compiere.model.MRMA; import org.compiere.model.MRequest; import org.compiere.model.MUser; +import org.compiere.model.SystemIDs; import org.compiere.swing.CMenuItem; import org.compiere.util.CLogger; import org.compiere.util.DB; @@ -58,7 +59,7 @@ import org.compiere.util.Msg; * @author Teo Sarca, SC ARHIPAC SERVICE SRL *
  • BF [ 1904928 ] Request: Related Request field not filled */ -public class ARequest implements ActionListener +public class ARequest implements ActionListener, SystemIDs { /** * Constructor @@ -209,7 +210,7 @@ public class ARequest implements ActionListener query.setRecordCount(0); } // - int AD_Window_ID = 232; // 232=all - 201=my + int AD_Window_ID = WINDOW_REQUESTS_ALL; // 232=all - 201=my AWindow frame = new AWindow(m_graphicsconfig); if (!frame.initWindow(AD_Window_ID, query)) return; diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/ProcessDialog.java b/org.adempiere.ui.swing/src/org/compiere/apps/ProcessDialog.java index db0aec7bd5..d012dc951b 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/ProcessDialog.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/ProcessDialog.java @@ -37,6 +37,7 @@ import javax.swing.JSeparator; import org.adempiere.exceptions.AdempiereException; import org.adempiere.exceptions.DBException; import org.adempiere.util.IProcessMonitor; +import org.compiere.model.SystemIDs; import org.compiere.print.ReportCtl; import org.compiere.print.ReportEngine; import org.compiere.process.ProcessInfo; @@ -64,10 +65,10 @@ import org.compiere.util.Msg; * - Implement ShowHelp option on processes and reports * @author Teo Sarca, SC ARHIPAC SERVICE SRL *
  • BF [ 1893525 ] ProcessDialog: Cannot select the text from text field - *
  • BF [ 1963128 ] Running a process w/o trl should display an error - */ + *
  • BF [ 1963128 ] Running a process w/o trl should display an error + */ public class ProcessDialog extends CFrame - implements ActionListener, IProcessMonitor + implements ActionListener, IProcessMonitor, SystemIDs { /** * @@ -441,9 +442,9 @@ public class ProcessDialog extends CFrame { log.config(""); // Print invoices - if (m_AD_Process_ID == 119) + if (m_AD_Process_ID == PROCESS_C_INVOICE_GENERATE) printInvoices(); - else if (m_AD_Process_ID == 118) + else if (m_AD_Process_ID == PROCESS_M_INOUT_GENERATE) printShipments(); } diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/form/VAllocation.java b/org.adempiere.ui.swing/src/org/compiere/apps/form/VAllocation.java index 78a758bcfb..16501dcaec 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/form/VAllocation.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/form/VAllocation.java @@ -45,6 +45,7 @@ import org.compiere.grid.ed.VLookup; import org.compiere.minigrid.MiniTable; import org.compiere.model.MLookup; import org.compiere.model.MLookupFactory; +import org.compiere.model.SystemIDs; import org.compiere.plaf.CompiereColor; import org.compiere.swing.CPanel; import org.compiere.swing.CTextField; @@ -55,7 +56,7 @@ import org.compiere.util.Trx; import org.compiere.util.TrxRunnable; public class VAllocation extends Allocation - implements FormPanel, ActionListener, TableModelListener, VetoableChangeListener + implements FormPanel, ActionListener, TableModelListener, VetoableChangeListener, SystemIDs { private CPanel panel = new CPanel(); @@ -240,21 +241,21 @@ public class VAllocation extends Allocation public void dynInit() throws Exception { // Currency - int AD_Column_ID = 3505; // C_Invoice.C_Currency_ID + int AD_Column_ID = COLUMN_C_INVOICE_C_CURRENCY_ID; // C_Invoice.C_Currency_ID MLookup lookupCur = MLookupFactory.get (Env.getCtx(), m_WindowNo, 0, AD_Column_ID, DisplayType.TableDir); currencyPick = new VLookup("C_Currency_ID", true, false, true, lookupCur); currencyPick.setValue(new Integer(m_C_Currency_ID)); currencyPick.addVetoableChangeListener(this); // Organization filter selection - AD_Column_ID = 839; //C_Period.AD_Org_ID (needed to allow org 0) + AD_Column_ID = COLUMN_C_PERIOD_AD_ORG_ID; //C_Period.AD_Org_ID (needed to allow org 0) MLookup lookupOrg = MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, AD_Column_ID, DisplayType.TableDir); organizationPick = new VLookup("AD_Org_ID", true, false, true, lookupOrg); organizationPick.setValue(Env.getAD_Org_ID(Env.getCtx())); organizationPick.addVetoableChangeListener(this); // BPartner - AD_Column_ID = 3499; // C_Invoice.C_BPartner_ID + AD_Column_ID = COLUMN_C_INVOICE_C_BPARTNER_ID; // C_Invoice.C_BPartner_ID MLookup lookupBP = MLookupFactory.get (Env.getCtx(), m_WindowNo, 0, AD_Column_ID, DisplayType.Search); bpartnerSearch = new VLookup("C_BPartner_ID", true, false, true, lookupBP); bpartnerSearch.addVetoableChangeListener(this); diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/form/VPayPrint.java b/org.adempiere.ui.swing/src/org/compiere/apps/form/VPayPrint.java index 511be670fc..b508b9c5fd 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/form/VPayPrint.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/form/VPayPrint.java @@ -42,6 +42,7 @@ import org.compiere.model.MLookup; import org.compiere.model.MLookupFactory; import org.compiere.model.MPaySelectionCheck; import org.compiere.model.MPaymentBatch; +import org.compiere.model.SystemIDs; import org.compiere.plaf.CompiereColor; import org.compiere.print.ReportCtl; import org.compiere.print.ReportEngine; @@ -65,7 +66,7 @@ import org.compiere.util.ValueNamePair; * Contributors: * Carlos Ruiz - GlobalQSS - FR 3132033 - Make payment export class configurable per bank */ -public class VPayPrint extends PayPrint implements FormPanel, ActionListener, VetoableChangeListener +public class VPayPrint extends PayPrint implements FormPanel, ActionListener, VetoableChangeListener, SystemIDs { private CPanel panel = new CPanel(); @@ -198,7 +199,7 @@ public class VPayPrint extends PayPrint implements FormPanel, ActionListener, Ve { // C_PaySelection_ID - int AD_Column_ID = 7670; // C_PaySelectionCheck.C_PaySelection_ID + int AD_Column_ID = COLUMN_C_PAYSELECTIONCHECK_C_PAYSELECTION_ID; // C_PaySelectionCheck.C_PaySelection_ID MLookup lookupPS = MLookupFactory.get (Env.getCtx(), m_WindowNo, 0, AD_Column_ID, DisplayType.Search); paySelectSearch = new VLookup("C_PaySelection_ID", true, false, true, lookupPS); paySelectSearch.addVetoableChangeListener(this); diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/form/VPaySelect.java b/org.adempiere.ui.swing/src/org/compiere/apps/form/VPaySelect.java index f687b86725..6fc4b847d9 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/form/VPaySelect.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/form/VPaySelect.java @@ -46,6 +46,7 @@ import org.compiere.grid.ed.VCheckBox; import org.compiere.grid.ed.VComboBox; import org.compiere.grid.ed.VDate; import org.compiere.minigrid.MiniTable; +import org.compiere.model.SystemIDs; import org.compiere.model.X_C_PaySelection; import org.compiere.plaf.CompiereColor; import org.compiere.process.ProcessInfo; @@ -65,7 +66,7 @@ import org.compiere.util.ValueNamePair; * @author Jorg Janke * @version $Id: VPaySelect.java,v 1.2 2008/07/11 08:20:12 cruiz Exp $ */ -public class VPaySelect extends PaySelect implements FormPanel, ActionListener, TableModelListener, IProcessMonitor +public class VPaySelect extends PaySelect implements FormPanel, ActionListener, TableModelListener, IProcessMonitor, SystemIDs { /** @todo withholding */ private CPanel panel = new CPanel(); @@ -365,7 +366,7 @@ public class VPaySelect extends PaySelect implements FormPanel, ActionListener, return; // Prepare Process - int AD_Proces_ID = 155; // C_PaySelection_CreatePayment + int AD_Proces_ID = PROCESS_C_PAYSELECTION_CREATEPAYMENT; // C_PaySelection_CreatePayment ProcessInfo pi = new ProcessInfo (m_frame.getTitle(), AD_Proces_ID, X_C_PaySelection.Table_ID, m_ps.getC_PaySelection_ID()); pi.setAD_User_ID (Env.getAD_User_ID(Env.getCtx())); @@ -403,7 +404,7 @@ public class VPaySelect extends PaySelect implements FormPanel, ActionListener, return; // Start PayPrint - int AD_Form_ID = 106; // Payment Print/Export + int AD_Form_ID = FORM_PAYMENT_PRINT_EXPORT; // Payment Print/Export FormFrame ff = new FormFrame(); ff.openForm (AD_Form_ID); // Set Parameter diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/search/Find.java b/org.adempiere.ui.swing/src/org/compiere/apps/search/Find.java index b8b21f0363..5b05e62e46 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/search/Find.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/search/Find.java @@ -82,6 +82,7 @@ import org.compiere.model.MProduct; import org.compiere.model.MQuery; import org.compiere.model.MRole; import org.compiere.model.MUserQuery; +import org.compiere.model.SystemIDs; import org.compiere.model.X_AD_Column; import org.compiere.swing.CButton; import org.compiere.swing.CComboBox; @@ -112,7 +113,7 @@ import org.compiere.util.ValueNamePair; *
  • BF [ 2564070 ] Saving user queries can produce unnecessary db errors */ public final class Find extends CDialog - implements ActionListener, ChangeListener, DataStatusListener + implements ActionListener, ChangeListener, DataStatusListener, SystemIDs { /** * @@ -209,7 +210,7 @@ public final class Find extends CDialog /** Length of Fields on first tab */ public static final int FIELDLENGTH = 20; /** Reference ID for Yes/No */ - public static final int AD_REFERENCE_ID_YESNO = 319; + public static final int AD_REFERENCE_ID_YESNO = REFERENCE_YESNO; // diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/search/InfoAssignment.java b/org.adempiere.ui.swing/src/org/compiere/apps/search/InfoAssignment.java index 2982c6de20..e402caffda 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/search/InfoAssignment.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/search/InfoAssignment.java @@ -31,6 +31,7 @@ import org.compiere.grid.ed.VLookup; import org.compiere.minigrid.IDColumn; import org.compiere.model.Lookup; import org.compiere.model.MLookupFactory; +import org.compiere.model.SystemIDs; import org.compiere.swing.CButton; import org.compiere.swing.CLabel; import org.compiere.util.DB; @@ -45,7 +46,7 @@ import org.compiere.util.Msg; * @author Jorg Janke * @version $Id: InfoAssignment.java,v 1.2 2006/07/30 00:51:27 jjanke Exp $ */ -public class InfoAssignment extends Info +public class InfoAssignment extends Info implements SystemIDs { /** * @@ -120,10 +121,10 @@ public class InfoAssignment extends Info { try { - int AD_Column_ID = 6851; // S_Resource.S_ResourceType_ID + int AD_Column_ID = COLUMN_S_RESOURCE_S_RESOURCETYPE_ID; // S_Resource.S_ResourceType_ID Lookup lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.TableDir); fieldResourceType = new VLookup ("S_ResourceType_ID", false, false, true, lookup); - AD_Column_ID = 6826; // S_ResourceAssignment.S_Resource_ID + AD_Column_ID = COLUMN_S_RESOURCEASSIGNMENT_S_RESOURCE_ID; // S_ResourceAssignment.S_Resource_ID lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.TableDir); fieldResource = new VLookup ("S_Resource_ID", false, false, true, lookup); } diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromInvoiceUI.java b/org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromInvoiceUI.java index 70c6665551..d8bec61b55 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromInvoiceUI.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromInvoiceUI.java @@ -35,6 +35,7 @@ import org.compiere.model.GridTab; import org.compiere.model.MDocType; import org.compiere.model.MLookup; import org.compiere.model.MLookupFactory; +import org.compiere.model.SystemIDs; import org.compiere.swing.CPanel; import org.compiere.util.CLogger; import org.compiere.util.DisplayType; @@ -42,7 +43,7 @@ import org.compiere.util.Env; import org.compiere.util.KeyNamePair; import org.compiere.util.Msg; -public class VCreateFromInvoiceUI extends CreateFromInvoice implements ActionListener, VetoableChangeListener +public class VCreateFromInvoiceUI extends CreateFromInvoice implements ActionListener, VetoableChangeListener, SystemIDs { private static final long serialVersionUID = 1L; @@ -251,7 +252,7 @@ public class VCreateFromInvoiceUI extends CreateFromInvoice implements ActionLis protected void initBPartner (boolean forInvoice) throws Exception { // load BPartner - int AD_Column_ID = 3499; // C_Invoice.C_BPartner_ID + int AD_Column_ID = COLUMN_C_INVOICE_C_BPARTNER_ID; // C_Invoice.C_BPartner_ID MLookup lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.Search); bPartnerField = new VLookup ("C_BPartner_ID", true, false, true, lookup); // diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromRMAUI.java b/org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromRMAUI.java index f5b6e41f8f..1a7c7739ef 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromRMAUI.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromRMAUI.java @@ -30,13 +30,14 @@ import org.compiere.grid.ed.VLookup; import org.compiere.model.GridTab; import org.compiere.model.MLookup; import org.compiere.model.MLookupFactory; +import org.compiere.model.SystemIDs; import org.compiere.swing.CPanel; import org.compiere.util.CLogger; import org.compiere.util.DisplayType; import org.compiere.util.Env; import org.compiere.util.Msg; -public class VCreateFromRMAUI extends CreateFromRMA implements VetoableChangeListener +public class VCreateFromRMAUI extends CreateFromRMA implements VetoableChangeListener, SystemIDs { private static final long serialVersionUID = 1L; @@ -155,7 +156,7 @@ public class VCreateFromRMAUI extends CreateFromRMA implements VetoableChangeLis protected void initBPartner (boolean forInvoice) throws Exception { // load BPartner - int AD_Column_ID = 3499; // C_Invoice.C_BPartner_ID + int AD_Column_ID = COLUMN_C_INVOICE_C_BPARTNER_ID; // C_Invoice.C_BPartner_ID MLookup lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.Search); bPartnerField = new VLookup ("C_BPartner_ID", true, false, true, lookup); // diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromShipmentUI.java b/org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromShipmentUI.java index 33f67cfbe2..7d7704268f 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromShipmentUI.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromShipmentUI.java @@ -52,6 +52,7 @@ import org.compiere.model.MLookup; import org.compiere.model.MLookupFactory; import org.compiere.model.MProduct; import org.compiere.model.Query; +import org.compiere.model.SystemIDs; import org.compiere.swing.CPanel; import org.compiere.util.CLogger; import org.compiere.util.DisplayType; @@ -59,11 +60,8 @@ import org.compiere.util.Env; import org.compiere.util.KeyNamePair; import org.compiere.util.Msg; -public class VCreateFromShipmentUI extends CreateFromShipment implements ActionListener, VetoableChangeListener +public class VCreateFromShipmentUI extends CreateFromShipment implements ActionListener, VetoableChangeListener, SystemIDs { - private static final int WINDOW_CUSTOMER_RETURN = 53097; - - private static final int WINDOW_RETURN_TO_VENDOR = 53098; private VCreateFromDialog dialog; @@ -161,7 +159,7 @@ public class VCreateFromShipmentUI extends CreateFromShipment implements ActionL */ private void jbInit() throws Exception { - boolean isRMAWindow = ((getGridTab().getAD_Window_ID() == WINDOW_RETURN_TO_VENDOR) || (getGridTab().getAD_Window_ID() == WINDOW_CUSTOMER_RETURN)); + boolean isRMAWindow = ((getGridTab().getAD_Window_ID() == WINDOW_RETURNTOVENDOR) || (getGridTab().getAD_Window_ID() == WINDOW_CUSTOMERRETURN)); bPartnerLabel.setText(Msg.getElement(Env.getCtx(), "C_BPartner_ID")); orderLabel.setText(Msg.getElement(Env.getCtx(), "C_Order_ID", false)); @@ -304,7 +302,7 @@ public class VCreateFromShipmentUI extends CreateFromShipment implements ActionL protected void initBPartner (boolean forInvoice) throws Exception { // load BPartner - int AD_Column_ID = 3499; // C_Invoice.C_BPartner_ID + int AD_Column_ID = COLUMN_C_INVOICE_C_BPARTNER_ID; // C_Invoice.C_BPartner_ID MLookup lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.Search); bPartnerField = new VLookup ("C_BPartner_ID", true, false, true, lookup); // diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromStatementUI.java b/org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromStatementUI.java index ea9dc18a4f..eedd27ef7d 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromStatementUI.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromStatementUI.java @@ -43,6 +43,7 @@ import org.compiere.model.MColumn; import org.compiere.model.MLookup; import org.compiere.model.MLookupFactory; import org.compiere.model.MPayment; +import org.compiere.model.SystemIDs; import org.compiere.swing.CButton; import org.compiere.swing.CLabel; import org.compiere.swing.CPanel; @@ -52,7 +53,7 @@ import org.compiere.util.DisplayType; import org.compiere.util.Env; import org.compiere.util.Msg; -public class VCreateFromStatementUI extends CreateFromStatement implements ActionListener +public class VCreateFromStatementUI extends CreateFromStatement implements ActionListener, SystemIDs { private static final long serialVersionUID = 1L; @@ -145,7 +146,7 @@ public class VCreateFromStatementUI extends CreateFromStatement implements Actio dialog.setTitle(getTitle()); - int AD_Column_ID = 4917; // C_BankStatement.C_BankAccount_ID + int AD_Column_ID = COLUMN_C_BANKSTATEMENT_C_BANKACCOUNT_ID; // C_BankStatement.C_BankAccount_ID MLookup lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.TableDir); bankAccountField = new VLookup ("C_BankAccount_ID", true, true, true, lookup); // Set Default diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VAccountDialog.java b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VAccountDialog.java index 946ed7f3ee..0e35ed2235 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VAccountDialog.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VAccountDialog.java @@ -61,6 +61,7 @@ import org.compiere.model.MAccountLookup; import org.compiere.model.MAcctSchema; import org.compiere.model.MAcctSchemaElement; import org.compiere.model.MQuery; +import org.compiere.model.SystemIDs; import org.compiere.swing.CButton; import org.compiere.swing.CDialog; import org.compiere.swing.CPanel; @@ -76,7 +77,7 @@ import org.compiere.util.Msg; * @version $Id: VAccountDialog.java,v 1.3 2006/07/30 00:51:28 jjanke Exp $ */ public final class VAccountDialog extends CDialog - implements ActionListener, DataStatusListener, VetoableChangeListener + implements ActionListener, DataStatusListener, VetoableChangeListener, SystemIDs { /** * @@ -272,7 +273,7 @@ public final class VAccountDialog extends CDialog Env.setContext(Env.getCtx(), m_WindowNo, "C_AcctSchema_ID", m_C_AcctSchema_ID); // Model - int AD_Window_ID = 153; // Maintain Account Combinations + int AD_Window_ID = WINDOW_ACCOUNTCOMBINATION; // Maintain Account Combinations GridWindowVO wVO = Env.getMWindowVO (m_WindowNo, AD_Window_ID, 0); if (wVO == null) return false; diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VLocator.java b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VLocator.java index f2363711d5..977d30c0b4 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VLocator.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VLocator.java @@ -50,6 +50,7 @@ import org.compiere.model.MQuery; import org.compiere.model.MRole; import org.compiere.model.MTable; import org.compiere.model.MWarehouse; +import org.compiere.model.SystemIDs; import org.compiere.swing.CButton; import org.compiere.swing.CMenuItem; import org.compiere.util.CLogger; @@ -64,7 +65,7 @@ import org.compiere.util.Msg; * @version $Id: VLocator.java,v 1.5 2006/07/30 00:51:27 jjanke Exp $ */ public class VLocator extends JComponent - implements VEditor, ActionListener + implements VEditor, ActionListener, SystemIDs { /** * @@ -521,7 +522,7 @@ public class VLocator extends JComponent { int AD_Window_ID = MTable.get(Env.getCtx(), MLocator.Table_ID).getAD_Window_ID(); if (AD_Window_ID <= 0) - AD_Window_ID = 139; // hardcoded window Warehouse & Locators + AD_Window_ID = WINDOW_WAREHOUSE_LOCATOR; // hardcoded window Warehouse & Locators log.info(""); // setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VLookup.java b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VLookup.java index b56bc9b5bc..889fd39524 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VLookup.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VLookup.java @@ -58,6 +58,7 @@ import org.compiere.model.MLookup; import org.compiere.model.MLookupFactory; import org.compiere.model.MQuery; import org.compiere.model.MRole; +import org.compiere.model.SystemIDs; import org.compiere.swing.CButton; import org.compiere.swing.CMenuItem; import org.compiere.swing.CTextField; @@ -95,7 +96,7 @@ import org.compiere.util.ValueNamePair; * @sponsor www.metas.de */ public class VLookup extends JComponent - implements VEditor, ActionListener, FocusListener + implements VEditor, ActionListener, FocusListener, SystemIDs { /** * @@ -169,7 +170,7 @@ public class VLookup extends JComponent */ public static VLookup createBPartner (int WindowNo) { - int AD_Column_ID = 3499; // C_Invoice.C_BPartner_ID + int AD_Column_ID = COLUMN_C_INVOICE_C_BPARTNER_ID; // C_Invoice.C_BPartner_ID try { Lookup lookup = MLookupFactory.get (Env.getCtx(), WindowNo, @@ -190,7 +191,7 @@ public class VLookup extends JComponent */ public static VLookup createProduct (int WindowNo) { - int AD_Column_ID = 3840; // C_InvoiceLine.M_Product_ID + int AD_Column_ID = COLUMN_C_INVOICELINE_M_PRODUCT_ID; // C_InvoiceLine.M_Product_ID try { Lookup lookup = MLookupFactory.get (Env.getCtx(), WindowNo, 0, @@ -211,7 +212,7 @@ public class VLookup extends JComponent */ public static VLookup createUser (int WindowNo) { - int AD_Column_ID = 10443; // AD_WF_Activity.AD_User_UD + int AD_Column_ID = COLUMN_AD_WF_ACTIVITY_AD_USER_ID; // AD_WF_Activity.AD_User_UD try { Lookup lookup = MLookupFactory.get (Env.getCtx(), WindowNo, 0, diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VPAttribute.java b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VPAttribute.java index c7a578caa3..1e9ce5ef9d 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VPAttribute.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VPAttribute.java @@ -43,6 +43,7 @@ import org.compiere.model.GridTab; import org.compiere.model.MAttributeSet; import org.compiere.model.MPAttributeLookup; import org.compiere.model.MProduct; +import org.compiere.model.SystemIDs; import org.compiere.swing.CButton; import org.compiere.swing.CMenuItem; import org.compiere.util.CLogger; @@ -61,7 +62,7 @@ import org.compiere.util.Msg; *
  • BF [ 2011222 ] ASI Dialog is reseting locator */ public class VPAttribute extends JComponent - implements VEditor, ActionListener + implements VEditor, ActionListener, SystemIDs { /** * @@ -400,7 +401,7 @@ public class VPAttribute extends JComponent + ", AD_Column_ID=" + m_AD_Column_ID); // M_Product.M_AttributeSetInstance_ID = 8418 - boolean productWindow = m_AD_Column_ID == 8418; // HARDCODED + boolean productWindow = m_AD_Column_ID == COLUMN_M_PRODUCT_M_ATTRIBUTESETINSTANCE_ID; // HARDCODED // Exclude ability to enter ASI boolean exclude = true; diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VPAttributeDialog.java b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VPAttributeDialog.java index 13b35c4193..9f4fea048d 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VPAttributeDialog.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VPAttributeDialog.java @@ -54,6 +54,7 @@ import org.compiere.model.MLotCtl; import org.compiere.model.MQuery; import org.compiere.model.MRole; import org.compiere.model.MSerNoCtl; +import org.compiere.model.SystemIDs; import org.compiere.model.X_M_MovementLine; import org.compiere.swing.CButton; import org.compiere.swing.CCheckBox; @@ -79,7 +80,7 @@ import org.compiere.util.Msg; * @version $Id: VPAttributeDialog.java,v 1.4 2006/07/30 00:51:27 jjanke Exp $ */ public class VPAttributeDialog extends CDialog - implements ActionListener + implements ActionListener, SystemIDs { /** * @@ -600,7 +601,7 @@ public class VPAttributeDialog extends CDialog // teo_sarca [ 1564520 ] Inventory Move: can't select existing attributes int M_Locator_ID = 0; - if (m_AD_Column_ID == 8551) { // TODO: hardcoded: M_MovementLine[324].M_AttributeSetInstance_ID[8551] + if (m_AD_Column_ID == COLUMN_M_MOVEMENTLINE_M_ATTRIBUTESETINSTANCE_ID) { // TODO: hardcoded: M_MovementLine[324].M_AttributeSetInstance_ID[8551] M_Locator_ID = Env.getContextAsInt(Env.getCtx(), m_WindowNoParent, X_M_MovementLine.COLUMNNAME_M_Locator_ID, true); // only window } @@ -683,7 +684,7 @@ public class VPAttributeDialog extends CDialog // setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); // - int AD_Window_ID = 257; // Lot + int AD_Window_ID = WINDOW_LOT; // Lot AWindow frame = new AWindow(); if (frame.initWindow(AD_Window_ID, zoomQuery)) { diff --git a/org.adempiere.ui.swing/src/org/compiere/pos/PosPayment.java b/org.adempiere.ui.swing/src/org/compiere/pos/PosPayment.java index 49a530316b..de88e18806 100644 --- a/org.adempiere.ui.swing/src/org/compiere/pos/PosPayment.java +++ b/org.adempiere.ui.swing/src/org/compiere/pos/PosPayment.java @@ -53,6 +53,7 @@ import org.compiere.model.MPOS; import org.compiere.model.MPOSKey; import org.compiere.model.MPayment; import org.compiere.model.MPaymentValidate; +import org.compiere.model.SystemIDs; import org.compiere.swing.CButton; import org.compiere.swing.CComboBox; import org.compiere.swing.CDialog; @@ -64,7 +65,7 @@ import org.compiere.util.Env; import org.compiere.util.Msg; import org.compiere.util.ValueNamePair; -public class PosPayment extends CDialog implements PosKeyListener, VetoableChangeListener, ActionListener { +public class PosPayment extends CDialog implements PosKeyListener, VetoableChangeListener, ActionListener, SystemIDs { /** * */ @@ -247,7 +248,7 @@ public class PosPayment extends CDialog implements PosKeyListener, VetoableChang mainPanel.add(new CLabel(Msg.translate(p_ctx, "TenderType"), "growx")); // Payment type selection - int AD_Column_ID = 8416; //C_Payment_v.TenderType + int AD_Column_ID = COLUMN_C_PAYMENT_V_TENDERTYPE; //C_Payment_v.TenderType MLookup lookup = MLookupFactory.get(Env.getCtx(), 0, 0, AD_Column_ID, DisplayType.List); ArrayList types = lookup.getData(true, false, true, true); diff --git a/org.adempiere.ui.swing/src/org/compiere/print/Viewer.java b/org.adempiere.ui.swing/src/org/compiere/print/Viewer.java index 9d20a06bc1..a60941ad4f 100644 --- a/org.adempiere.ui.swing/src/org/compiere/print/Viewer.java +++ b/org.adempiere.ui.swing/src/org/compiere/print/Viewer.java @@ -80,6 +80,7 @@ import org.compiere.model.MQuery; import org.compiere.model.MRole; import org.compiere.model.MUser; import org.compiere.model.PrintInfo; +import org.compiere.model.SystemIDs; import org.compiere.model.X_C_Invoice; import org.compiere.swing.CButton; import org.compiere.swing.CCheckBox; @@ -124,7 +125,7 @@ import org.compiere.util.ValueNamePair; * */ public class Viewer extends CFrame - implements ActionListener, ChangeListener, WindowStateListener, IReportEngineEventListener + implements ActionListener, ChangeListener, WindowStateListener, IReportEngineEventListener, SystemIDs { /** * @@ -1188,7 +1189,7 @@ public class Viewer extends CFrame { AWindow win = new AWindow (getGraphicsConfiguration()); new AWindowListener (win, this); // forwards Window Events - int AD_Window_ID = 240; // hardcoded + int AD_Window_ID = WINDOW_PRINTFORMAT; // hardcoded int AD_PrintFormat_ID = m_reportEngine.getPrintFormat().get_ID(); boolean loadedOK = win.initWindow(AD_Window_ID, MQuery.getEqualQuery("AD_PrintFormat_ID", AD_PrintFormat_ID)); if (loadedOK) diff --git a/org.adempiere.ui.swing/src/org/eevolution/form/VInOutInvoiceGen.java b/org.adempiere.ui.swing/src/org/eevolution/form/VInOutInvoiceGen.java index 2444d4cc0f..3bfbaa88da 100755 --- a/org.adempiere.ui.swing/src/org/eevolution/form/VInOutInvoiceGen.java +++ b/org.adempiere.ui.swing/src/org/eevolution/form/VInOutInvoiceGen.java @@ -58,6 +58,7 @@ import org.compiere.model.MPInstance; import org.compiere.model.MPInstancePara; import org.compiere.model.MPrivateAccess; import org.compiere.model.MRMA; +import org.compiere.model.SystemIDs; import org.compiere.plaf.CompiereColor; import org.compiere.print.ReportCtl; import org.compiere.print.ReportEngine; @@ -83,7 +84,7 @@ import org.compiere.util.Trx; */ public class VInOutInvoiceGen extends CPanel implements FormPanel, ActionListener, VetoableChangeListener, - ChangeListener, TableModelListener, IProcessMonitor + ChangeListener, TableModelListener, IProcessMonitor, SystemIDs { /** * @@ -534,11 +535,11 @@ public class VInOutInvoiceGen extends CPanel if (docTypeKNPair.getKey() == MRMA.Table_ID) { - AD_Process_ID = 52001; // M_InOut_GenerateRMA - org.adempiere.process.InOutGenerateRMA + AD_Process_ID = PROCESS_M_INOUT_GENERATERMA_MANUAL; // M_InOut_GenerateRMA - org.adempiere.process.InOutGenerateRMA } else { - AD_Process_ID = 199; // M_InOut_Generate - org.compiere.process.InOutGenerate + AD_Process_ID = PROCESS_M_INOUT_GENERATE_MANUAL; // M_InOut_Generate - org.compiere.process.InOutGenerate } MPInstance instance = new MPInstance(Env.getCtx(), AD_Process_ID, 0); @@ -702,11 +703,11 @@ public class VInOutInvoiceGen extends CPanel if (docTypeKNPair.getKey() == MRMA.Table_ID) { - AD_Process_ID = 52002; // C_Invoice_GenerateRMA - org.adempiere.process.InvoiceGenerateRMA + AD_Process_ID = PROCESS_C_INVOICE_GENERATERMA_MANUAL; // C_Invoice_GenerateRMA - org.adempiere.process.InvoiceGenerateRMA } else { - AD_Process_ID = 134; // HARDCODED C_InvoiceCreate + AD_Process_ID = PROCESS_C_INVOICE_GENERATE_MANUAL; // HARDCODED C_InvoiceCreate } MPInstance instance = new MPInstance(Env.getCtx(), AD_Process_ID, 0); if (!instance.save()) @@ -864,12 +865,12 @@ public class VInOutInvoiceGen extends CPanel public void unlockUI (ProcessInfo pi) { // - if(pi.getAD_Process_ID() == 199) + if(pi.getAD_Process_ID() == PROCESS_M_INOUT_GENERATE_MANUAL) { generateShipments_complete(pi); generateInvoices (); } - if(pi.getAD_Process_ID() == 134) + if(pi.getAD_Process_ID() == PROCESS_C_INVOICE_GENERATE_MANUAL) { generateInvoice_complete(pi); this.setEnabled(true); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/WArchive.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/WArchive.java index ce0148635c..52f9fd1f25 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/WArchive.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/WArchive.java @@ -9,6 +9,7 @@ import org.adempiere.webui.component.Window; import org.adempiere.webui.panel.ADForm; import org.adempiere.webui.session.SessionManager; import org.compiere.model.MBPartner; +import org.compiere.model.SystemIDs; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; @@ -27,7 +28,7 @@ import org.zkoss.zul.Menupopup; * @author Jorg Janke * @version $Id: AArchive.java,v 1.2 2006/07/30 00:51:27 jjanke Exp $ */ -public class WArchive implements EventListener +public class WArchive implements EventListener, SystemIDs { /** * Constructor @@ -153,7 +154,7 @@ public class WArchive implements EventListener { if (e.getTarget() instanceof Menuitem) { - int AD_Form_ID = 118; // ArchiveViewer + int AD_Form_ID = FORM_ARCHIVEVIEWER; // ArchiveViewer ADForm form = ADForm.openForm(AD_Form_ID); WArchiveViewer av = (WArchiveViewer) form.getICustomForm(); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/WRequest.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/WRequest.java index e84c8fefaa..dbb4db7f7b 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/WRequest.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/WRequest.java @@ -35,6 +35,7 @@ import org.compiere.model.MQuery; import org.compiere.model.MRMA; import org.compiere.model.MRequest; import org.compiere.model.MUser; +import org.compiere.model.SystemIDs; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; @@ -56,7 +57,7 @@ import org.zkoss.zul.Menupopup; * @author Teo Sarca, SC ARHIPAC SERVICE SRL *
  • BF [ 1904928 ] Request: Related Request field not filled */ -public class WRequest implements EventListener +public class WRequest implements EventListener, SystemIDs { /** * Constructor @@ -204,7 +205,7 @@ public class WRequest implements EventListener query.setRecordCount(0); } - int AD_Window_ID = 232; // 232=all - 201=my + int AD_Window_ID = WINDOW_REQUESTS_ALL; // 232=all - 201=my ADWindow frame = SessionManager.getAppDesktop().openWindow(AD_Window_ID, query); if(frame == null) return; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/acct/WAcctViewerData.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/acct/WAcctViewerData.java index 0e74667974..759e931bd5 100755 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/acct/WAcctViewerData.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/acct/WAcctViewerData.java @@ -38,6 +38,7 @@ import org.compiere.model.MAcctSchemaElement; import org.compiere.model.MFactAcct; import org.compiere.model.MLookupFactory; import org.compiere.model.MRefList; +import org.compiere.model.SystemIDs; import org.compiere.report.core.RColumn; import org.compiere.report.core.RModel; import org.compiere.util.CLogger; @@ -57,7 +58,7 @@ import org.compiere.util.ValueNamePair; * July 27, 2007 */ -public class WAcctViewerData +public class WAcctViewerData implements SystemIDs { /** Window */ public int WindowNo; @@ -199,7 +200,7 @@ public class WAcctViewerData protected void fillPostingType (Listbox cb) { - int AD_Reference_ID = 125; + int AD_Reference_ID = REFERENCE_POSTING_TYPE; ValueNamePair[] pt = MRefList.getList(Env.getCtx(), AD_Reference_ID, true); for (int i = 0; i < pt.length; i++) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessDialog.java index c4239742b7..16af457cb0 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessDialog.java @@ -14,7 +14,6 @@ import java.util.logging.Level; import org.adempiere.util.IProcessMonitor; import org.adempiere.util.ServerContext; import org.adempiere.webui.AdempiereWebUI; -import org.adempiere.webui.apps.ProcessDialog.ProcessDialogRunnable; import org.adempiere.webui.component.Button; import org.adempiere.webui.component.Panel; import org.adempiere.webui.component.Window; @@ -23,6 +22,7 @@ import org.adempiere.webui.process.WProcessInfo; import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.window.FDialog; import org.adempiere.webui.window.SimplePDFViewer; +import org.compiere.model.SystemIDs; import org.compiere.print.ReportEngine; import org.compiere.process.ProcessInfo; import org.compiere.process.ProcessInfoUtil; @@ -33,7 +33,6 @@ import org.compiere.util.Msg; import org.zkoss.zk.au.out.AuEcho; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Desktop; -import org.zkoss.zk.ui.Execution; import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; @@ -80,7 +79,7 @@ import com.lowagie.text.pdf.PdfWriter; * @author arboleda - globalqss * - Implement ShowHelp option on processes and reports */ -public class ProcessDialog extends Window implements EventListener, IProcessMonitor +public class ProcessDialog extends Window implements EventListener, IProcessMonitor, SystemIDs { /** * generate serial version ID @@ -483,9 +482,9 @@ public class ProcessDialog extends Window implements EventListener, IProcessMoni { log.config(""); // Print invoices - if (m_AD_Process_ID == 119) + if (m_AD_Process_ID == PROCESS_C_INVOICE_GENERATE) printInvoices(); - else if (m_AD_Process_ID == 118) + else if (m_AD_Process_ID == PROCESS_M_INOUT_GENERATE) printShipments(); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java index bdc5f60f76..7783cb9b75 100755 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java @@ -47,6 +47,7 @@ import org.adempiere.webui.window.FDialog; import org.compiere.apps.form.Allocation; import org.compiere.model.MLookup; import org.compiere.model.MLookupFactory; +import org.compiere.model.SystemIDs; import org.compiere.util.DisplayType; import org.compiere.util.Env; import org.compiere.util.Msg; @@ -69,7 +70,7 @@ import org.zkoss.zul.Space; * Contributor : Fabian Aguilar - OFBConsulting - Multiallocation */ public class WAllocation extends Allocation - implements IFormController, EventListener, WTableModelListener, ValueChangeListener + implements IFormController, EventListener, WTableModelListener, ValueChangeListener, SystemIDs { /** @@ -294,21 +295,21 @@ public class WAllocation extends Allocation public void dynInit() throws Exception { // Currency - int AD_Column_ID = 3505; // C_Invoice.C_Currency_ID + int AD_Column_ID = COLUMN_C_INVOICE_C_CURRENCY_ID; // C_Invoice.C_Currency_ID MLookup lookupCur = MLookupFactory.get (Env.getCtx(), form.getWindowNo(), 0, AD_Column_ID, DisplayType.TableDir); currencyPick = new WTableDirEditor("C_Currency_ID", true, false, true, lookupCur); currencyPick.setValue(new Integer(m_C_Currency_ID)); currencyPick.addValueChangeListener(this); // Organization filter selection - AD_Column_ID = 839; //C_Period.AD_Org_ID (needed to allow org 0) + AD_Column_ID = COLUMN_C_PERIOD_AD_ORG_ID; //C_Period.AD_Org_ID (needed to allow org 0) MLookup lookupOrg = MLookupFactory.get(Env.getCtx(), form.getWindowNo(), 0, AD_Column_ID, DisplayType.TableDir); organizationPick = new WTableDirEditor("AD_Org_ID", true, false, true, lookupOrg); organizationPick.setValue(Env.getAD_Org_ID(Env.getCtx())); organizationPick.addValueChangeListener(this); // BPartner - AD_Column_ID = 3499; // C_Invoice.C_BPartner_ID + AD_Column_ID = COLUMN_C_INVOICE_C_BPARTNER_ID; // C_Invoice.C_BPartner_ID MLookup lookupBP = MLookupFactory.get (Env.getCtx(), form.getWindowNo(), 0, AD_Column_ID, DisplayType.Search); bpartnerSearch = new WSearchEditor("C_BPartner_ID", true, false, true, lookupBP); bpartnerSearch.addValueChangeListener(this); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCreateFromInvoiceUI.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCreateFromInvoiceUI.java index 4ff64825c5..7a6982e60c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCreateFromInvoiceUI.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCreateFromInvoiceUI.java @@ -37,6 +37,7 @@ import org.compiere.model.GridTab; import org.compiere.model.MDocType; import org.compiere.model.MLookup; import org.compiere.model.MLookupFactory; +import org.compiere.model.SystemIDs; import org.compiere.util.CLogger; import org.compiere.util.DisplayType; import org.compiere.util.Env; @@ -48,7 +49,7 @@ import org.zkoss.zkex.zul.Borderlayout; import org.zkoss.zkex.zul.Center; import org.zkoss.zul.Space; -public class WCreateFromInvoiceUI extends CreateFromInvoice implements EventListener, ValueChangeListener +public class WCreateFromInvoiceUI extends CreateFromInvoice implements EventListener, ValueChangeListener, SystemIDs { private static final long serialVersionUID = 1L; @@ -246,7 +247,7 @@ public class WCreateFromInvoiceUI extends CreateFromInvoice implements EventList protected void initBPartner (boolean forInvoice) throws Exception { // load BPartner - int AD_Column_ID = 3499; // C_Invoice.C_BPartner_ID + int AD_Column_ID = COLUMN_C_INVOICE_C_BPARTNER_ID; // C_Invoice.C_BPartner_ID MLookup lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.Search); bPartnerField = new WSearchEditor ("C_BPartner_ID", true, false, true, lookup); // diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCreateFromRMAUI.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCreateFromRMAUI.java index fcfe17b076..5c5d79b617 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCreateFromRMAUI.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCreateFromRMAUI.java @@ -32,6 +32,7 @@ import org.compiere.grid.CreateFromRMA; import org.compiere.model.GridTab; import org.compiere.model.MLookup; import org.compiere.model.MLookupFactory; +import org.compiere.model.SystemIDs; import org.compiere.util.CLogger; import org.compiere.util.DisplayType; import org.compiere.util.Env; @@ -39,7 +40,7 @@ import org.compiere.util.Msg; import org.zkoss.zkex.zul.Borderlayout; import org.zkoss.zkex.zul.Center; -public class WCreateFromRMAUI extends CreateFromRMA implements ValueChangeListener +public class WCreateFromRMAUI extends CreateFromRMA implements ValueChangeListener, SystemIDs { private static final long serialVersionUID = 1L; @@ -148,7 +149,7 @@ public class WCreateFromRMAUI extends CreateFromRMA implements ValueChangeListen protected void initBPartner (boolean forInvoice) throws Exception { // load BPartner - int AD_Column_ID = 3499; // C_Invoice.C_BPartner_ID + int AD_Column_ID = COLUMN_C_INVOICE_C_BPARTNER_ID; // C_Invoice.C_BPartner_ID MLookup lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.Search); bPartnerField = new WSearchEditor ("C_BPartner_ID", true, false, true, lookup); // diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCreateFromShipmentUI.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCreateFromShipmentUI.java index 4559287e4e..ce5d1817e9 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCreateFromShipmentUI.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCreateFromShipmentUI.java @@ -45,6 +45,7 @@ import org.compiere.model.MLookup; import org.compiere.model.MLookupFactory; import org.compiere.model.MProduct; import org.compiere.model.MRMA; +import org.compiere.model.SystemIDs; import org.compiere.util.CLogger; import org.compiere.util.DisplayType; import org.compiere.util.Env; @@ -57,11 +58,8 @@ import org.zkoss.zkex.zul.Borderlayout; import org.zkoss.zkex.zul.Center; import org.zkoss.zul.Space; -public class WCreateFromShipmentUI extends CreateFromShipment implements EventListener, ValueChangeListener +public class WCreateFromShipmentUI extends CreateFromShipment implements EventListener, ValueChangeListener, SystemIDs { - private static final int WINDOW_CUSTOMER_RETURN = 53097; - - private static final int WINDOW_RETURN_TO_VENDOR = 53098; private WCreateFromWindow window; @@ -149,7 +147,7 @@ public class WCreateFromShipmentUI extends CreateFromShipment implements EventLi protected void zkInit() throws Exception { - boolean isRMAWindow = ((getGridTab().getAD_Window_ID() == WINDOW_RETURN_TO_VENDOR) || (getGridTab().getAD_Window_ID() == WINDOW_CUSTOMER_RETURN)); + boolean isRMAWindow = ((getGridTab().getAD_Window_ID() == WINDOW_RETURNTOVENDOR) || (getGridTab().getAD_Window_ID() == WINDOW_CUSTOMERRETURN)); bPartnerLabel.setText(Msg.getElement(Env.getCtx(), "C_BPartner_ID")); orderLabel.setText(Msg.getElement(Env.getCtx(), "C_Order_ID", false)); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCreateFromStatementUI.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCreateFromStatementUI.java index 291b0bf3ee..344f994d73 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCreateFromStatementUI.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCreateFromStatementUI.java @@ -44,6 +44,7 @@ import org.compiere.model.MColumn; import org.compiere.model.MLookup; import org.compiere.model.MLookupFactory; import org.compiere.model.MPayment; +import org.compiere.model.SystemIDs; import org.compiere.util.CLogger; import org.compiere.util.DisplayType; import org.compiere.util.Env; @@ -55,7 +56,7 @@ import org.zkoss.zkex.zul.Borderlayout; import org.zkoss.zkex.zul.Center; import org.zkoss.zul.Hbox; -public class WCreateFromStatementUI extends CreateFromStatement implements EventListener +public class WCreateFromStatementUI extends CreateFromStatement implements EventListener, SystemIDs { private static final long serialVersionUID = 1L; @@ -143,7 +144,7 @@ public class WCreateFromStatementUI extends CreateFromStatement implements Event window.setTitle(getTitle()); - int AD_Column_ID = 4917; // C_BankStatement.C_BankAccount_ID + int AD_Column_ID = COLUMN_C_BANKSTATEMENT_C_BANKACCOUNT_ID; // C_BankStatement.C_BankAccount_ID MLookup lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.TableDir); bankAccountField = new WTableDirEditor ("C_BankAccount_ID", true, false, true, lookup); // Set Default diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPayPrint.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPayPrint.java index feadafbe1a..69166cb29e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPayPrint.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPayPrint.java @@ -49,6 +49,7 @@ import org.compiere.model.MLookup; import org.compiere.model.MLookupFactory; import org.compiere.model.MPaySelectionCheck; import org.compiere.model.MPaymentBatch; +import org.compiere.model.SystemIDs; import org.compiere.print.ReportEngine; import org.compiere.util.DB; import org.compiere.util.DisplayType; @@ -72,7 +73,7 @@ import org.zkoss.zul.Filedownload; * Contributors: * Carlos Ruiz - GlobalQSS - FR 3132033 - Make payment export class configurable per bank */ -public class WPayPrint extends PayPrint implements IFormController, EventListener, ValueChangeListener +public class WPayPrint extends PayPrint implements IFormController, EventListener, ValueChangeListener, SystemIDs { private CustomForm form = new CustomForm(); @@ -194,7 +195,7 @@ public class WPayPrint extends PayPrint implements IFormController, EventListene private void dynInit() { // C_PaySelection_ID - int AD_Column_ID = 7670; // C_PaySelectionCheck.C_PaySelection_ID + int AD_Column_ID = COLUMN_C_PAYSELECTIONCHECK_C_PAYSELECTION_ID; // C_PaySelectionCheck.C_PaySelection_ID MLookup lookupPS = MLookupFactory.get (Env.getCtx(), m_WindowNo, 0, AD_Column_ID, DisplayType.Search); paySelectSearch = new WSearchEditor("C_PaySelection_ID", true, false, true, lookupPS); paySelectSearch.addValueChangeListener(this); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaySelect.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaySelect.java index f421058825..f18f756e74 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaySelect.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaySelect.java @@ -45,9 +45,9 @@ import org.adempiere.webui.panel.IFormController; import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.window.FDialog; import org.compiere.apps.form.PaySelect; +import org.compiere.model.SystemIDs; import org.compiere.model.X_C_PaySelection; import org.compiere.process.ProcessInfo; -import org.compiere.util.ASyncProcess; import org.compiere.util.Env; import org.compiere.util.KeyNamePair; import org.compiere.util.Msg; @@ -73,7 +73,7 @@ import org.zkoss.zul.Space; * @version $Id: VPaySelect.java,v 1.3 2006/07/30 00:51:28 jjanke Exp $ */ public class WPaySelect extends PaySelect - implements IFormController, EventListener, WTableModelListener, IProcessMonitor + implements IFormController, EventListener, WTableModelListener, IProcessMonitor, SystemIDs { /** @todo withholding */ @@ -375,7 +375,7 @@ public class WPaySelect extends PaySelect return; // Prepare Process - int AD_Proces_ID = 155; // C_PaySelection_CreatePayment + int AD_Proces_ID = PROCESS_C_PAYSELECTION_CREATEPAYMENT; // C_PaySelection_CreatePayment // Execute Process ProcessModalDialog dialog = new ProcessModalDialog(this, m_WindowNo, @@ -426,7 +426,7 @@ public class WPaySelect extends PaySelect this.dispose(); // Start PayPrint - int AD_Form_ID = 106; // Payment Print/Export + int AD_Form_ID = FORM_PAYMENT_PRINT_EXPORT; // Payment Print/Export ADForm form = SessionManager.getAppDesktop().openForm(AD_Form_ID); if (m_ps != null) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPFavourites.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPFavourites.java index 277cfcf68a..3dde314767 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPFavourites.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPFavourites.java @@ -21,6 +21,7 @@ import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.window.FDialog; import org.compiere.model.MTree; import org.compiere.model.MTreeNode; +import org.compiere.model.SystemIDs; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; @@ -44,7 +45,7 @@ import org.zkoss.zul.Vbox; * @author Elaine * @date November 20, 2008 */ -public class DPFavourites extends DashboardPanel implements EventListener { +public class DPFavourites extends DashboardPanel implements EventListener, SystemIDs { /** * @@ -98,7 +99,7 @@ public class DPFavourites extends DashboardPanel implements EventListener { + " INNER JOIN AD_Role r ON (ci.AD_Client_ID=r.AD_Client_ID) " + "WHERE AD_Role_ID=?", AD_Role_ID); if (AD_Tree_ID <= 0) - AD_Tree_ID = 10; // Menu + AD_Tree_ID = TREE_MENUPRIMARY; // Menu m_AD_Tree_ID = AD_Tree_ID; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WLocatorEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WLocatorEditor.java index 87a55b33e9..5f2ed9e8f7 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WLocatorEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WLocatorEditor.java @@ -39,6 +39,7 @@ import org.compiere.model.MQuery; import org.compiere.model.MRole; import org.compiere.model.MTable; import org.compiere.model.MWarehouse; +import org.compiere.model.SystemIDs; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; @@ -54,7 +55,7 @@ import org.zkoss.zk.ui.event.Events; * @date Jul 23, 2007 */ -public class WLocatorEditor extends WEditor implements EventListener, PropertyChangeListener, ContextMenuListener, IZoomableEditor +public class WLocatorEditor extends WEditor implements EventListener, PropertyChangeListener, ContextMenuListener, IZoomableEditor, SystemIDs { private static final String[] LISTENER_EVENTS = {Events.ON_CLICK}; @@ -269,7 +270,7 @@ public class WLocatorEditor extends WEditor implements EventListener, PropertyCh { int AD_Window_ID = MTable.get(Env.getCtx(), MLocator.Table_ID).getAD_Window_ID(); if (AD_Window_ID <= 0) - AD_Window_ID = 139; // hardcoded window Warehouse & Locators + AD_Window_ID = WINDOW_WAREHOUSE_LOCATOR; // hardcoded window Warehouse & Locators log.info(""); // diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WPAttributeEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WPAttributeEditor.java index b60935f710..f265aa76d6 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WPAttributeEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WPAttributeEditor.java @@ -27,6 +27,7 @@ import org.compiere.model.GridTab; import org.compiere.model.Lookup; import org.compiere.model.MAttributeSet; import org.compiere.model.MProduct; +import org.compiere.model.SystemIDs; import org.compiere.util.CLogger; import org.compiere.util.Env; import org.zkoss.zk.ui.event.Event; @@ -37,7 +38,7 @@ import org.zkoss.zk.ui.event.Events; * @author Low Heng Sin * */ -public class WPAttributeEditor extends WEditor implements ContextMenuListener +public class WPAttributeEditor extends WEditor implements ContextMenuListener, SystemIDs { private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE, Events.ON_OK}; @@ -167,7 +168,7 @@ public class WPAttributeEditor extends WEditor implements ContextMenuListener + ", AD_Column_ID=" + gridField.getAD_Column_ID()); // M_Product.M_AttributeSetInstance_ID = 8418 - boolean productWindow = (gridField.getAD_Column_ID() == 8418); // HARDCODED + boolean productWindow = (gridField.getAD_Column_ID() == COLUMN_M_PRODUCT_M_ATTRIBUTESETINSTANCE_ID); // HARDCODED // Exclude ability to enter ASI boolean exclude = true; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java index bafbebfc96..0344854d8d 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java @@ -39,6 +39,7 @@ import org.compiere.model.Lookup; import org.compiere.model.MLookup; import org.compiere.model.MLookupFactory; import org.compiere.model.MRole; +import org.compiere.model.SystemIDs; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.DisplayType; @@ -54,7 +55,7 @@ import org.zkoss.zk.ui.event.Events; * @author Ashley G Ramdass * */ -public class WSearchEditor extends WEditor implements ContextMenuListener, ValueChangeListener, IZoomableEditor +public class WSearchEditor extends WEditor implements ContextMenuListener, ValueChangeListener, IZoomableEditor, SystemIDs { private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE, Events.ON_OK}; private Lookup lookup; @@ -822,7 +823,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value * @return WSearchEditor */ public static WSearchEditor createBPartner(int windowNo) { - int AD_Column_ID = 3499; // C_Invoice.C_BPartner_ID + int AD_Column_ID = COLUMN_C_INVOICE_C_BPARTNER_ID; // C_Invoice.C_BPartner_ID try { Lookup lookup = MLookupFactory.get (Env.getCtx(), windowNo, @@ -841,7 +842,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value * @return WSearchEditor */ public static WSearchEditor createProduct(int windowNo) { - int AD_Column_ID = 3840; // C_InvoiceLine.M_Product_ID + int AD_Column_ID = COLUMN_C_INVOICELINE_M_PRODUCT_ID; // C_InvoiceLine.M_Product_ID try { Lookup lookup = MLookupFactory.get (Env.getCtx(), windowNo, 0, diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java index e806e8b14a..d13a0184c9 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java @@ -69,6 +69,7 @@ import org.compiere.model.MProcess; import org.compiere.model.MQuery; import org.compiere.model.MRecentItem; import org.compiere.model.MRole; +import org.compiere.model.SystemIDs; import org.compiere.process.DocAction; import org.compiere.process.ProcessInfo; import org.compiere.process.ProcessInfoUtil; @@ -118,7 +119,7 @@ import org.zkoss.zul.Menupopup; * https://sourceforge.net/tracker/?func=detail&aid=2985892&group_id=176962&atid=955896 */ public abstract class AbstractADWindowPanel extends AbstractUIPart implements ToolbarListener, - EventListener, DataStatusListener, ActionListener, IProcessMonitor + EventListener, DataStatusListener, ActionListener, IProcessMonitor, SystemIDs { private static final CLogger logger; @@ -2061,7 +2062,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To // Record_ID - Change Log ID if (record_ID == -1 - && (wButton.getProcess_ID() == 306 || wButton.getProcess_ID() == 307)) + && (wButton.getProcess_ID() == PROCESS_AD_CHANGELOG_UNDO || wButton.getProcess_ID() == PROCESS_AD_CHANGELOG_REDO)) { Integer id = (Integer)curTab.getValue("AD_ChangeLog_ID"); record_ID = id.intValue(); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoAssignmentPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoAssignmentPanel.java index 8508bf6560..4c366a7b45 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoAssignmentPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoAssignmentPanel.java @@ -40,6 +40,7 @@ import org.compiere.minigrid.ColumnInfo; import org.compiere.minigrid.IDColumn; import org.compiere.model.MLookupFactory; import org.compiere.model.MQuery; +import org.compiere.model.SystemIDs; import org.compiere.util.DB; import org.compiere.util.DisplayType; import org.compiere.util.Env; @@ -66,7 +67,7 @@ import org.zkoss.zul.Vbox; * @version InfoAssignment.java Adempiere Swing UI 3.4.1 */ -public class InfoAssignmentPanel extends InfoPanel implements EventListener, ValueChangeListener +public class InfoAssignmentPanel extends InfoPanel implements EventListener, ValueChangeListener, SystemIDs { /** * @@ -157,13 +158,13 @@ public class InfoAssignmentPanel extends InfoPanel implements EventListener, Val { try { - int AD_Column_ID = 6851; // S_Resource.S_ResourceType_ID + int AD_Column_ID = COLUMN_S_RESOURCE_S_RESOURCETYPE_ID; // S_Resource.S_ResourceType_ID fieldResourceType = new WSearchEditor ( MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.TableDir), Msg.translate(Env.getCtx(), "S_ResourceType_ID"), "", false, false, true); - AD_Column_ID = 6826; // S_ResourceAssignment.S_Resource_ID + AD_Column_ID = COLUMN_S_RESOURCEASSIGNMENT_S_RESOURCE_ID; // S_ResourceAssignment.S_Resource_ID fieldResource = new WSearchEditor ( MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.TableDir), diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java index f761c4c665..928fa1fa8c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java @@ -30,6 +30,7 @@ import org.compiere.model.MRole; import org.compiere.model.MTree; import org.compiere.model.MTreeNode; import org.compiere.model.MUser; +import org.compiere.model.SystemIDs; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; @@ -53,7 +54,7 @@ import org.zkoss.zul.Treerow; * @date Feb 25, 2007 * @version $Revision: 0.10 $ */ -public class MenuPanel extends Panel implements EventListener +public class MenuPanel extends Panel implements EventListener, SystemIDs { /** * @@ -144,7 +145,7 @@ public class MenuPanel extends Panel implements EventListener + " INNER JOIN AD_Role r ON (ci.AD_Client_ID=r.AD_Client_ID) " + "WHERE AD_Role_ID=?", adRoleId); if (AD_Tree_ID <= 0) - AD_Tree_ID = 10; // Menu + AD_Tree_ID = TREE_MENUPRIMARY; // Menu return AD_Tree_ID; } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java index c8a59e63ab..6b0d868d5e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java @@ -67,6 +67,7 @@ import org.compiere.model.MProduct; import org.compiere.model.MQuery; import org.compiere.model.MRole; import org.compiere.model.MUserQuery; +import org.compiere.model.SystemIDs; import org.compiere.model.X_AD_Column; import org.compiere.util.AdempiereSystemError; import org.compiere.util.CLogger; @@ -96,7 +97,7 @@ import org.zkoss.zul.Hbox; * @author Sendy Yagambrum * @date June 27, 2007 */ -public class FindWindow extends Window implements EventListener,ValueChangeListener +public class FindWindow extends Window implements EventListener,ValueChangeListener, SystemIDs { /** * @@ -157,7 +158,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe /** Length of Fields on first tab */ public static final int FIELDLENGTH = 20; /** Reference ID for Yes/No */ - public static final int AD_REFERENCE_ID_YESNO = 319; + public static final int AD_REFERENCE_ID_YESNO = REFERENCE_YESNO; private int m_AD_Tab_ID = 0; private MUserQuery[] userQueries; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WAccountDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WAccountDialog.java index 8914c56c67..dbd3875e5d 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WAccountDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WAccountDialog.java @@ -48,6 +48,7 @@ import org.compiere.model.MAccountLookup; import org.compiere.model.MAcctSchema; import org.compiere.model.MAcctSchemaElement; import org.compiere.model.MQuery; +import org.compiere.model.SystemIDs; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; @@ -72,7 +73,7 @@ import org.zkoss.zul.Vbox; * @author Low Heng Sin */ public final class WAccountDialog extends Window - implements EventListener, DataStatusListener, ValueChangeListener + implements EventListener, DataStatusListener, ValueChangeListener, SystemIDs { private static final long serialVersionUID = 7999516267209766287L; @@ -272,7 +273,7 @@ public final class WAccountDialog extends Window Env.setContext(Env.getCtx(), m_WindowNo, "C_AcctSchema_ID", m_C_AcctSchema_ID); // Model - int AD_Window_ID = 153; // Maintain Account Combinations + int AD_Window_ID = WINDOW_ACCOUNTCOMBINATION; // Maintain Account Combinations GridWindowVO wVO = AEnv.getMWindowVO (m_WindowNo, AD_Window_ID, 0); if (wVO == null) return false; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPAttributeDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPAttributeDialog.java index 6b3b61d566..c4d534aca7 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPAttributeDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPAttributeDialog.java @@ -51,6 +51,7 @@ import org.compiere.model.MLotCtl; import org.compiere.model.MQuery; import org.compiere.model.MRole; import org.compiere.model.MSerNoCtl; +import org.compiere.model.SystemIDs; import org.compiere.model.X_M_MovementLine; import org.compiere.util.CLogger; import org.compiere.util.DB; @@ -78,7 +79,7 @@ import org.zkoss.zul.impl.InputElement; * ZK Port * @author Low Heng Sin */ -public class WPAttributeDialog extends Window implements EventListener +public class WPAttributeDialog extends Window implements EventListener, SystemIDs { /** * @@ -793,7 +794,7 @@ public class WPAttributeDialog extends Window implements EventListener // teo_sarca [ 1564520 ] Inventory Move: can't select existing attributes int M_Locator_ID = 0; - if (m_AD_Column_ID == 8551) { // TODO: hardcoded: M_MovementLine[324].M_AttributeSetInstance_ID[8551] + if (m_AD_Column_ID == COLUMN_M_MOVEMENTLINE_M_ATTRIBUTESETINSTANCE_ID) { // TODO: hardcoded: M_MovementLine[324].M_AttributeSetInstance_ID[8551] M_Locator_ID = Env.getContextAsInt(Env.getCtx(), m_WindowNoParent, X_M_MovementLine.COLUMNNAME_M_Locator_ID, true); // only window } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java index 8a49662237..1d14c19749 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java @@ -53,6 +53,7 @@ import org.compiere.model.MRole; import org.compiere.model.MSysConfig; import org.compiere.model.MTable; import org.compiere.model.MUser; +import org.compiere.model.SystemIDs; import org.compiere.print.ArchiveEngine; import org.compiere.print.MPrintFormat; import org.compiere.print.ReportEngine; @@ -100,7 +101,7 @@ import org.zkoss.zul.Vbox; * * @author Low Heng Sin */ -public class ZkReportViewer extends Window implements EventListener, ITabOnCloseHandler { +public class ZkReportViewer extends Window implements EventListener, ITabOnCloseHandler, SystemIDs { /** * */ @@ -997,7 +998,7 @@ public class ZkReportViewer extends Window implements EventListener, ITabOnClose */ private void cmd_customize() { - int AD_Window_ID = 240; // hardcoded + int AD_Window_ID = WINDOW_PRINTFORMAT; // hardcoded int AD_PrintFormat_ID = m_reportEngine.getPrintFormat().get_ID(); AEnv.zoom(AD_Window_ID, MQuery.getEqualQuery("AD_PrintFormat_ID", AD_PrintFormat_ID)); } // cmd_customize diff --git a/org.adempiere.ui/src/org/compiere/apps/form/FactReconcile.java b/org.adempiere.ui/src/org/compiere/apps/form/FactReconcile.java index d6e57dce9d..abca3dd2bb 100644 --- a/org.adempiere.ui/src/org/compiere/apps/form/FactReconcile.java +++ b/org.adempiere.ui/src/org/compiere/apps/form/FactReconcile.java @@ -12,13 +12,14 @@ import org.compiere.minigrid.IMiniTable; import org.compiere.model.MFactReconciliation; import org.compiere.model.MRole; import org.compiere.model.Query; +import org.compiere.model.SystemIDs; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.KeyNamePair; import org.compiere.util.Msg; -public class FactReconcile { +public class FactReconcile implements SystemIDs { /** Logger */ public static CLogger log = CLogger.getCLogger(FactReconcile.class); @@ -37,10 +38,10 @@ public class FactReconcile { public int idColIndex = 8; public int amtColIndex = 0; - static protected int col_C_AcctSchema_ID = 2513; // Fact_Acct.C_AcctSchema_ID - static protected int col_AD_Org_ID = 839; // C_Period.AD_Org_ID (needed to allow org 0) - static protected int col_C_BPartner_ID = 3499; // C_Invoice.C_BPartner_ID - static protected int col_M_Product_ID = 2527; // Fact_Acct.M_Product_ID + static protected int col_C_AcctSchema_ID = COLUMN_FACT_ACCT_C_ACCTSCHEMA_ID; // Fact_Acct.C_AcctSchema_ID + static protected int col_AD_Org_ID = COLUMN_C_PERIOD_AD_ORG_ID; // C_Period.AD_Org_ID (needed to allow org 0) + static protected int col_C_BPartner_ID = COLUMN_C_INVOICE_C_BPARTNER_ID; // C_Invoice.C_BPartner_ID + static protected int col_M_Product_ID = COLUMN_FACT_ACCT_M_PRODUCT_ID; // Fact_Acct.M_Product_ID public void dynInit() throws Exception diff --git a/org.adempiere.ui/src/org/compiere/apps/form/InOutGen.java b/org.adempiere.ui/src/org/compiere/apps/form/InOutGen.java index 7575480bc7..727b27efb1 100644 --- a/org.adempiere.ui/src/org/compiere/apps/form/InOutGen.java +++ b/org.adempiere.ui/src/org/compiere/apps/form/InOutGen.java @@ -29,6 +29,7 @@ import org.compiere.model.MPInstance; import org.compiere.model.MPInstancePara; import org.compiere.model.MPrivateAccess; import org.compiere.model.MRMA; +import org.compiere.model.SystemIDs; import org.compiere.print.ReportEngine; import org.compiere.process.ProcessInfo; import org.compiere.util.CLogger; @@ -42,7 +43,7 @@ import org.compiere.util.Trx; * Generate Shipment (manual) controller class * */ -public class InOutGen extends GenForm +public class InOutGen extends GenForm implements SystemIDs { /** Logger */ private static CLogger log = CLogger.getCLogger(InOutGen.class); @@ -264,11 +265,11 @@ public class InOutGen extends GenForm if (docTypeKNPair.getKey() == MRMA.Table_ID) { - AD_Process_ID = 52001; // M_InOut_GenerateRMA - org.adempiere.process.InOutGenerateRMA + AD_Process_ID = PROCESS_M_INOUT_GENERATERMA_MANUAL; // M_InOut_GenerateRMA - org.adempiere.process.InOutGenerateRMA } else { - AD_Process_ID = 199; // M_InOut_Generate - org.compiere.process.InOutGenerate + AD_Process_ID = PROCESS_M_INOUT_GENERATE_MANUAL; // M_InOut_Generate - org.compiere.process.InOutGenerate } MPInstance instance = new MPInstance(Env.getCtx(), AD_Process_ID, 0); diff --git a/org.adempiere.ui/src/org/compiere/apps/form/InvoiceGen.java b/org.adempiere.ui/src/org/compiere/apps/form/InvoiceGen.java index 0bd565a741..d7731f444d 100644 --- a/org.adempiere.ui/src/org/compiere/apps/form/InvoiceGen.java +++ b/org.adempiere.ui/src/org/compiere/apps/form/InvoiceGen.java @@ -29,6 +29,7 @@ import org.compiere.model.MPInstance; import org.compiere.model.MPInstancePara; import org.compiere.model.MPrivateAccess; import org.compiere.model.MRMA; +import org.compiere.model.SystemIDs; import org.compiere.print.ReportEngine; import org.compiere.process.ProcessInfo; import org.compiere.util.CLogger; @@ -42,7 +43,7 @@ import org.compiere.util.Trx; * Generate Invoice (manual) controller class * */ -public class InvoiceGen extends GenForm +public class InvoiceGen extends GenForm implements SystemIDs { /** Logger */ private static CLogger log = CLogger.getCLogger(InvoiceGen.class); @@ -263,11 +264,11 @@ public class InvoiceGen extends GenForm if (docTypeKNPair.getKey() == MRMA.Table_ID) { - AD_Process_ID = 52002; // C_Invoice_GenerateRMA - org.adempiere.process.InvoiceGenerateRMA + AD_Process_ID = PROCESS_C_INVOICE_GENERATERMA_MANUAL; // C_Invoice_GenerateRMA - org.adempiere.process.InvoiceGenerateRMA } else { - AD_Process_ID = 134; // HARDCODED C_InvoiceCreate + AD_Process_ID = PROCESS_C_INVOICE_GENERATE_MANUAL; // HARDCODED C_InvoiceCreate } MPInstance instance = new MPInstance(Env.getCtx(), AD_Process_ID, 0); if (!instance.save()) diff --git a/org.adempiere.ui/src/org/compiere/apps/form/PayPrint.java b/org.adempiere.ui/src/org/compiere/apps/form/PayPrint.java index 211ae935b3..f803cb6e34 100644 --- a/org.adempiere.ui/src/org/compiere/apps/form/PayPrint.java +++ b/org.adempiere.ui/src/org/compiere/apps/form/PayPrint.java @@ -28,6 +28,7 @@ import org.compiere.model.MLookupFactory; import org.compiere.model.MLookupInfo; import org.compiere.model.MPaySelectionCheck; import org.compiere.model.MPaymentBatch; +import org.compiere.model.SystemIDs; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; @@ -35,7 +36,7 @@ import org.compiere.util.KeyNamePair; import org.compiere.util.Language; import org.compiere.util.ValueNamePair; -public class PayPrint { +public class PayPrint implements SystemIDs { /** Window No */ public int m_WindowNo = 0; @@ -143,7 +144,7 @@ public class PayPrint { ArrayList data = new ArrayList(); // load PaymentRule for Bank - int AD_Reference_ID = 195; // MLookupInfo.getAD_Reference_ID("All_Payment Rule"); + int AD_Reference_ID = REFERENCE_PAYMENTRULE; // MLookupInfo.getAD_Reference_ID("All_Payment Rule"); Language language = Language.getLanguage(Env.getAD_Language(Env.getCtx())); MLookupInfo info = MLookupFactory.getLookup_List(language, AD_Reference_ID); String sql = info.Query.substring(0, info.Query.indexOf(" ORDER BY")) diff --git a/org.adempiere.ui/src/org/compiere/apps/form/PaySelect.java b/org.adempiere.ui/src/org/compiere/apps/form/PaySelect.java index 5fa783ebdb..2f234ea2d1 100644 --- a/org.adempiere.ui/src/org/compiere/apps/form/PaySelect.java +++ b/org.adempiere.ui/src/org/compiere/apps/form/PaySelect.java @@ -31,6 +31,7 @@ import org.compiere.model.MLookupInfo; import org.compiere.model.MPaySelection; import org.compiere.model.MPaySelectionLine; import org.compiere.model.MRole; +import org.compiere.model.SystemIDs; import org.compiere.model.X_C_Order; import org.compiere.process.ProcessInfo; import org.compiere.util.CLogger; @@ -44,7 +45,7 @@ import org.compiere.util.Trx; import org.compiere.util.ValueNamePair; -public class PaySelect +public class PaySelect implements SystemIDs { /** @todo withholding */ @@ -247,7 +248,7 @@ public class PaySelect ArrayList data = new ArrayList(); - int AD_Reference_ID = 195; // MLookupInfo.getAD_Reference_ID("All_Payment Rule"); + int AD_Reference_ID = REFERENCE_PAYMENTRULE; // MLookupInfo.getAD_Reference_ID("All_Payment Rule"); Language language = Env.getLanguage(Env.getCtx()); MLookupInfo info = MLookupFactory.getLookup_List(language, AD_Reference_ID); String sql = info.Query.substring(0, info.Query.indexOf(" ORDER BY")) diff --git a/org.adempiere.ui/src/org/compiere/apps/form/TrxMaterial.java b/org.adempiere.ui/src/org/compiere/apps/form/TrxMaterial.java index d700d93f4f..961f25a071 100644 --- a/org.adempiere.ui/src/org/compiere/apps/form/TrxMaterial.java +++ b/org.adempiere.ui/src/org/compiere/apps/form/TrxMaterial.java @@ -24,12 +24,13 @@ import org.compiere.model.GridTab; import org.compiere.model.GridWindow; import org.compiere.model.GridWindowVO; import org.compiere.model.MQuery; +import org.compiere.model.SystemIDs; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; -public class TrxMaterial { +public class TrxMaterial implements SystemIDs { /** Window No */ public int m_WindowNo = 0; @@ -47,10 +48,10 @@ public class TrxMaterial { * Based on AD_Window: Material Transactions */ public void dynInit(IStatusBar statusBar) - { + { m_staticQuery = new MQuery(); m_staticQuery.addRestriction("AD_Client_ID", MQuery.EQUAL, Env.getAD_Client_ID(Env.getCtx())); - int AD_Window_ID = 223; // Hardcoded + int AD_Window_ID = WINDOW_MATERIALTRANSACTIONS_INDIRECTUSER; // Hardcoded GridWindowVO wVO = Env.getMWindowVO (m_WindowNo, AD_Window_ID, 0); if (wVO == null) return; @@ -126,9 +127,9 @@ public class TrxMaterial { { log.fine("M_InOutLine_ID=" + lineID); if (Env.getContext(Env.getCtx(), m_WindowNo, "MovementType").startsWith("C")) - AD_Window_ID = 169; // Customer + AD_Window_ID = WINDOW_SHIPMENT_CUSTOMER; // Customer else - AD_Window_ID = 184; // Vendor + AD_Window_ID = WINDOW_MATERIALRECEIPT; // Vendor ColumnName = "M_InOut_ID"; SQL = "SELECT M_InOut_ID FROM M_InOutLine WHERE M_InOutLine_ID=?"; } @@ -138,7 +139,7 @@ public class TrxMaterial { if (lineID != 0) { log.fine("M_InventoryLine_ID=" + lineID); - AD_Window_ID = 168; + AD_Window_ID = WINDOW_PHYSICALINVENTORY; ColumnName = "M_Inventory_ID"; SQL = "SELECT M_Inventory_ID FROM M_InventoryLine WHERE M_InventoryLine_ID=?"; } @@ -148,7 +149,7 @@ public class TrxMaterial { if (lineID != 0) { log.fine("M_MovementLine_ID=" + lineID); - AD_Window_ID = 170; + AD_Window_ID = WINDOW_INVENTORYMOVE; ColumnName = "M_Movement_ID"; SQL = "SELECT M_Movement_ID FROM M_MovementLine WHERE M_MovementLine_ID=?"; } @@ -158,7 +159,7 @@ public class TrxMaterial { if (lineID != 0) { log.fine("M_ProductionLine_ID=" + lineID); - AD_Window_ID = 191; + AD_Window_ID = WINDOW_PRODUCTION; ColumnName = "M_Production_ID"; SQL = "SELECT M_Production_ID FROM M_ProductionLine WHERE M_ProductionLine_ID=?"; } @@ -191,4 +192,6 @@ public class TrxMaterial { if (parentID == 0) log.log(Level.SEVERE, "No ParentValue - " + SQL + " - " + lineID); } // zoom + + } diff --git a/org.adempiere.ui/src/org/compiere/print/ReportCtl.java b/org.adempiere.ui/src/org/compiere/print/ReportCtl.java index b402ce40bc..28cdb24530 100644 --- a/org.adempiere.ui/src/org/compiere/print/ReportCtl.java +++ b/org.adempiere.ui/src/org/compiere/print/ReportCtl.java @@ -27,6 +27,7 @@ import org.compiere.model.MProcess; import org.compiere.model.MQuery; import org.compiere.model.MTable; import org.compiere.model.PrintInfo; +import org.compiere.model.SystemIDs; import org.compiere.process.ProcessInfo; import org.compiere.util.CLogger; import org.compiere.util.Env; @@ -40,7 +41,7 @@ import org.compiere.util.Env; * @author Teo Sarca, SC ARHIPAC SERVICE SRL *
  • FR [ 1866739 ] ReportCtl: use printformat from the transient/serializable */ -public class ReportCtl +public class ReportCtl implements SystemIDs { /** * @deprecated Please use {@link ServerReportCtl#PARAM_PRINTER_NAME} @@ -115,21 +116,21 @@ public class ReportCtl /** * Order Print */ - if (pi.getAD_Process_ID() == 110) // C_Order + if (pi.getAD_Process_ID() == PROCESS_RPT_C_ORDER) // C_Order return startDocumentPrint(ReportEngine.ORDER, pi.getRecord_ID(), parent, WindowNo, !pi.isPrintPreview()); if (pi.getAD_Process_ID() == MProcess.getProcess_ID("Rpt PP_Order", null)) // C_Order return startDocumentPrint(ReportEngine.MANUFACTURING_ORDER, pi.getRecord_ID(), parent, WindowNo, !pi.isPrintPreview()); if (pi.getAD_Process_ID() == MProcess.getProcess_ID("Rpt DD_Order", null)) // C_Order return startDocumentPrint(ReportEngine.DISTRIBUTION_ORDER, pi.getRecord_ID(), parent, WindowNo, !pi.isPrintPreview()); - else if (pi.getAD_Process_ID() == 116) // C_Invoice + else if (pi.getAD_Process_ID() == PROCESS_RPT_C_INVOICE) // C_Invoice return startDocumentPrint(ReportEngine.INVOICE, pi.getRecord_ID(), parent, WindowNo, !pi.isPrintPreview()); - else if (pi.getAD_Process_ID() == 117) // M_InOut + else if (pi.getAD_Process_ID() == PROCESS_RPT_M_INOUT) // M_InOut return startDocumentPrint(ReportEngine.SHIPMENT, pi.getRecord_ID(), parent, WindowNo, !pi.isPrintPreview()); - else if (pi.getAD_Process_ID() == 217) // C_Project + else if (pi.getAD_Process_ID() == PROCESS_RPT_C_PROJECT) // C_Project return startDocumentPrint(ReportEngine.PROJECT, pi.getRecord_ID(), parent, WindowNo, !pi.isPrintPreview()); - else if (pi.getAD_Process_ID() == 276) // C_RfQResponse + else if (pi.getAD_Process_ID() == PROCESS_RPT_C_RFQRESPONSE) // C_RfQResponse return startDocumentPrint(ReportEngine.RFQ, pi.getRecord_ID(), parent, WindowNo, !pi.isPrintPreview()); - else if (pi.getAD_Process_ID() == 313) // C_Payment + else if (pi.getAD_Process_ID() == PROCESS_RPT_C_PAYMENT) // C_Payment return startCheckPrint(pi.getRecord_ID(), !pi.isPrintPreview()); /** else if (pi.getAD_Process_ID() == 290) // Movement Submission by VHARCQ @@ -139,10 +140,10 @@ public class ReportCtl else if (pi.AD_Process_ID == 9999999) // PaySelection return startDocumentPrint(REMITTANCE, pi, IsDirectPrint); **/ - else if (pi.getAD_Process_ID() == 159) // Dunning + else if (pi.getAD_Process_ID() == PROCESS_RPT_C_DUNNING) // Dunning return startDocumentPrint(ReportEngine.DUNNING, pi.getRecord_ID(), parent, WindowNo, !pi.isPrintPreview()); - else if (pi.getAD_Process_ID() == 202 // Financial Report - || pi.getAD_Process_ID() == 204) // Financial Statement + else if (pi.getAD_Process_ID() == PROCESS_RPT_FINREPORT // Financial Report + || pi.getAD_Process_ID() == PROCESS_RPT_FINSTATEMENT) // Financial Statement return startFinReport (pi); /******************** * Standard Report From b2338cc04d7dcdf281d87da97f30de9515465e36 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Wed, 25 Apr 2012 12:54:18 -0500 Subject: [PATCH 44/49] IDEMPIERE-236 Centralization of hardcoded IDs / display types --- .../src/org/compiere/model/SystemIDs.java | 39 +- .../src/org/compiere/util/DisplayType.java | 1164 +++++++++-------- 2 files changed, 608 insertions(+), 595 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/SystemIDs.java b/org.adempiere.base/src/org/compiere/model/SystemIDs.java index fa091d7cc4..c6c251bb41 100644 --- a/org.adempiere.base/src/org/compiere/model/SystemIDs.java +++ b/org.adempiere.base/src/org/compiere/model/SystemIDs.java @@ -77,27 +77,38 @@ public interface SystemIDs public final static int PROCESS_RPT_FINREPORT = 202; public final static int PROCESS_RPT_FINSTATEMENT = 204; - public final static int REFERENCE_DATATYPE_ACCOUNT = DisplayType.Account; //25 - public final static int REFERENCE_DATATYPE_INTEGER = 11; - public final static int REFERENCE_DATATYPE_LIST = 17; - public final static int REFERENCE_DATATYPE_TEXT = 14; - public final static int REFERENCE_DATATYPE_MEMO = 34; + public final static int REFERENCE_DATATYPE_ACCOUNT = 25; public final static int REFERENCE_DATATYPE_AMOUNT = 12; + public final static int REFERENCE_DATATYPE_ASSIGNMENT = 33; + public final static int REFERENCE_DATATYPE_BINARY = 23; + public final static int REFERENCE_DATATYPE_BUTTON = 28; + public final static int REFERENCE_DATATYPE_COLOR = 27; + public final static int REFERENCE_DATATYPE_COSTPRICE = 37; public final static int REFERENCE_DATATYPE_DATE = 15; public final static int REFERENCE_DATATYPE_DATETIME = 16; + public final static int REFERENCE_DATATYPE_FILENAME = 39; + public final static int REFERENCE_DATATYPE_FILEPATH = 38; public final static int REFERENCE_DATATYPE_ID = 13; - public final static int REFERENCE_DATATYPE_STRING = 10; + public final static int REFERENCE_DATATYPE_IMAGE = 32; + public final static int REFERENCE_DATATYPE_INTEGER = 11; + public final static int REFERENCE_DATATYPE_LIST = 17; + public final static int REFERENCE_DATATYPE_LOCATION = 21; + public final static int REFERENCE_DATATYPE_LOCATOR = 31; + public final static int REFERENCE_DATATYPE_MEMO = 34; public final static int REFERENCE_DATATYPE_NUMBER = 22; - public final static int REFERENCE_DATATYPE_YES_NO = 20; - public final static int REFERENCE_DATATYPE_BUTTON = 28; + public final static int REFERENCE_DATATYPE_PRINTNAME = 42; + public final static int REFERENCE_DATATYPE_PRODUCTATTRIBUTE = 35; + public final static int REFERENCE_DATATYPE_QUANTITY = 29; + public final static int REFERENCE_DATATYPE_ROWID = 26; + public final static int REFERENCE_DATATYPE_SEARCH = 30; + public final static int REFERENCE_DATATYPE_STRING = 10; public final static int REFERENCE_DATATYPE_TABLE = 18; public final static int REFERENCE_DATATYPE_TABLEDIR = 19; - public final static int REFERENCE_DATATYPE_SEARCH = 30; - public final static int REFERENCE_DATATYPE_QUANTITY = 29; - public final static int REFERENCE_DATATYPE_PRODUCTATTRIBUTE = 35; - public final static int REFERENCE_DATATYPE_LOCATOR = 31; - public final static int REFERENCE_DATATYPE_LOCATION = 21; - public final static int REFERENCE_DATATYPE_COLOR = 27; + public final static int REFERENCE_DATATYPE_TEXT = 14; + public final static int REFERENCE_DATATYPE_TEXTLONG = 36; + public final static int REFERENCE_DATATYPE_TIME = 24; + public final static int REFERENCE_DATATYPE_URL = 40; + public final static int REFERENCE_DATATYPE_YES_NO = 20; public static final int REFERENCE_AD_USER = 110; public final static int REFERENCE_DOCUMENTACTION = 135; diff --git a/org.adempiere.base/src/org/compiere/util/DisplayType.java b/org.adempiere.base/src/org/compiere/util/DisplayType.java index c1daf67560..db8ad252f5 100644 --- a/org.adempiere.base/src/org/compiere/util/DisplayType.java +++ b/org.adempiere.base/src/org/compiere/util/DisplayType.java @@ -1,581 +1,583 @@ -/****************************************************************************** - * Product: Compiere ERP & CRM Smart Business Solution * - * Copyright (C) 1999-2006 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.util; - -import java.text.DateFormat; -import java.text.DecimalFormat; -import java.text.NumberFormat; -import java.text.SimpleDateFormat; -import java.util.Locale; -import java.util.logging.Level; - -/** - * System Display Types. - *
    - *	SELECT AD_Reference_ID, Name FROM AD_Reference WHERE ValidationType = 'D'
    - *  
    - * @author Jorg Janke - * @version $Id: DisplayType.java,v 1.6 2006/08/30 20:30:44 comdivision Exp $ - * - * @author Teo Sarca, SC ARHIPAC SERVICE SRL - *
  • BF [ 1810632 ] PricePrecision error in InfoProduct (and similar) - */ -public final class DisplayType -{ - /** Display Type 10 String */ - public static final int String = 10; - /** Display Type 11 Integer */ - public static final int Integer = 11; - /** Display Type 12 Amount */ - public static final int Amount = 12; - /** Display Type 13 ID */ - public static final int ID = 13; - /** Display Type 14 Text */ - public static final int Text = 14; - /** Display Type 15 Date */ - public static final int Date = 15; - /** Display Type 16 DateTime */ - public static final int DateTime = 16; - /** Display Type 17 List */ - public static final int List = 17; - /** Display Type 18 Table */ - public static final int Table = 18; - /** Display Type 19 TableDir */ - public static final int TableDir = 19; - /** Display Type 20 YN */ - public static final int YesNo = 20; - /** Display Type 21 Location */ - public static final int Location = 21; - /** Display Type 22 Number */ - public static final int Number = 22; - /** Display Type 23 BLOB */ - public static final int Binary = 23; - /** Display Type 24 Time */ - public static final int Time = 24; - /** Display Type 25 Account */ - public static final int Account = 25; - /** Display Type 26 RowID */ - public static final int RowID = 26; - /** Display Type 27 Color */ - public static final int Color = 27; - /** Display Type 28 Button */ - public static final int Button = 28; - /** Display Type 29 Quantity */ - public static final int Quantity = 29; - /** Display Type 30 Search */ - public static final int Search = 30; - /** Display Type 31 Locator */ - public static final int Locator = 31; - /** Display Type 32 Image */ - public static final int Image = 32; - /** Display Type 33 Assignment */ - public static final int Assignment = 33; - /** Display Type 34 Memo */ - public static final int Memo = 34; - /** Display Type 35 PAttribute */ - public static final int PAttribute = 35; - /** Display Type 36 CLOB */ - public static final int TextLong = 36; - /** Display Type 37 CostPrice */ - public static final int CostPrice = 37; - /** Display Type 38 File Path */ - public static final int FilePath = 38; - /** Display Type 39 File Name */ - public static final int FileName = 39; - /** Display Type 40 URL */ - public static final int URL = 40; - /** Display Type 42 PrinterName */ - public static final int PrinterName = 42; - // Candidates: - - /** - * - New Display Type - INSERT INTO AD_REFERENCE - (AD_REFERENCE_ID, AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED,UPDATEDBY, - NAME,DESCRIPTION,HELP, VALIDATIONTYPE,VFORMAT,ENTITYTYPE) - VALUES (35, 0,0,'Y',SysDate,0,SysDate,0, - 'PAttribute','Product Attribute',null,'D',null,'D'); - * - * - org.compiere.model.MModel (??) - * - org.compiere.grid.ed.VEditor/Dialog - * - org.compiere.grid.ed.VEditorFactory - * - RColumn, WWindow - * add/check 0_cleanupAD.sql - */ - - // See DBA_DisplayType.sql ---------------------------------------------- - - /** Maximum number of digits */ - private static final int MAX_DIGITS = 28; // Oracle Standard Limitation 38 digits - /** Digits of an Integer */ - private static final int INTEGER_DIGITS = 10; - /** Maximum number of fractions */ - private static final int MAX_FRACTION = 12; - /** Default Amount Precision */ - private static final int AMOUNT_FRACTION = 2; - - /** Logger */ - private static CLogger s_log = CLogger.getCLogger (DisplayType.class); - - /** - * Returns true if (numeric) ID (Table, Search, Account, ..). - * (stored as Integer) - * @param displayType Display Type - * @return true if ID - */ - public static boolean isID (int displayType) - { - if (displayType == ID || displayType == Table || displayType == TableDir - || displayType == Search || displayType == Location || displayType == Locator - || displayType == Account || displayType == Assignment || displayType == PAttribute - || displayType == Image || displayType == Color) - return true; - return false; - } // isID - - /** - * Returns true, if DisplayType is numeric (Amount, Number, Quantity, Integer). - * (stored as BigDecimal) - * @param displayType Display Type - * @return true if numeric - */ - public static boolean isNumeric(int displayType) - { - if (displayType == Amount || displayType == Number || displayType == CostPrice - || displayType == Integer || displayType == Quantity) - return true; - return false; - } // isNumeric - - /** - * Get Default Precision. - * Used for databases who cannot handle dynamic number precision. - * @param displayType display type - * @return scale (decimal precision) - */ - public static int getDefaultPrecision(int displayType) - { - if (displayType == Amount) - return 2; - if (displayType == Number) - return 6; - if (displayType == CostPrice - || displayType == Quantity) - return 4; - return 0; - } // getDefaultPrecision - - - /** - * Returns true, if DisplayType is text (String, Text, TextLong, Memo). - * @param displayType Display Type - * @return true if text - */ - public static boolean isText(int displayType) - { - if (displayType == String || displayType == Text - || displayType == TextLong || displayType == Memo - || displayType == FilePath || displayType == FileName - || displayType == URL || displayType == PrinterName) - return true; - return false; - } // isText - - /** - * Returns true if DisplayType is a Date. - * (stored as Timestamp) - * @param displayType Display Type - * @return true if date - */ - public static boolean isDate (int displayType) - { - if (displayType == Date || displayType == DateTime || displayType == Time) - return true; - return false; - } // isDate - - /** - * Returns true if DisplayType is a VLookup (List, Table, TableDir, Search). - * (stored as Integer) - * @param displayType Display Type - * @return true if Lookup - */ - public static boolean isLookup(int displayType) - { - if (displayType == List || displayType == Table - || displayType == TableDir || displayType == Search) - return true; - return false; - } // isLookup - - /** - * Returns true if DisplayType is a Large Object - * @param displayType Display Type - * @return true if LOB - */ - public static boolean isLOB (int displayType) - { - if (displayType == Binary - || displayType == TextLong) - return true; - return false; - } // isLOB - - /************************************************************************** - * Return Format for numeric DisplayType - * @param displayType Display Type (default Number) - * @param language Language - * @param pattern Java Number Format pattern e.g. "#,##0.00" - * @return number format - */ - public static DecimalFormat getNumberFormat(int displayType, Language language, String pattern) - { - Language myLanguage = language; - if (myLanguage == null) - myLanguage = Language.getLoginLanguage(); - Locale locale = myLanguage.getLocale(); - DecimalFormat format = null; - if (locale != null) - format = (DecimalFormat)NumberFormat.getNumberInstance(locale); - else - format = (DecimalFormat)NumberFormat.getNumberInstance(Locale.US); - // - if (pattern != null && pattern.length() > 0) - { - try { - format.applyPattern(pattern); - return format; - } - catch (IllegalArgumentException e) { - s_log.log(Level.WARNING, "Invalid number format: " + pattern); - } - } - else if (displayType == Integer) - { - format.setParseIntegerOnly(true); - format.setMaximumIntegerDigits(INTEGER_DIGITS); - format.setMaximumFractionDigits(0); - } - else if (displayType == Quantity) - { - format.setMaximumIntegerDigits(MAX_DIGITS); - format.setMaximumFractionDigits(MAX_FRACTION); - } - else if (displayType == Amount) - { - format.setMaximumIntegerDigits(MAX_DIGITS); - format.setMaximumFractionDigits(MAX_FRACTION); - format.setMinimumFractionDigits(AMOUNT_FRACTION); - } - else if (displayType == CostPrice) - { - format.setMaximumIntegerDigits(MAX_DIGITS); - format.setMaximumFractionDigits(MAX_FRACTION); - format.setMinimumFractionDigits(AMOUNT_FRACTION); - } - else // if (displayType == Number) - { - format.setMaximumIntegerDigits(MAX_DIGITS); - format.setMaximumFractionDigits(MAX_FRACTION); - format.setMinimumFractionDigits(1); - } - return format; - } // getDecimalFormat - - /************************************************************************** - * Return Format for numeric DisplayType - * @param displayType Display Type (default Number) - * @param language Language - * @return number format - */ - public static DecimalFormat getNumberFormat(int displayType, Language language) - { - return getNumberFormat(displayType, language, null); - } - - /** - * Return Format for numeric DisplayType - * @param displayType Display Type - * @return number format - */ - public static DecimalFormat getNumberFormat(int displayType) - { - return getNumberFormat (displayType, null); - } // getNumberFormat - - - /************************************************************************* - * Return Date Format - * @return date format - */ - public static SimpleDateFormat getDateFormat() - { - return getDateFormat (DisplayType.Date, null); - } // getDateFormat - - /** - * Return Date Format - * @param language Language - * @return date format - */ - public static SimpleDateFormat getDateFormat (Language language) - { - return getDateFormat (DisplayType.Date, language); - } // getDateFormat - - /** - * Return format for date displayType - * @param displayType Display Type - * @return date format - */ - public static SimpleDateFormat getDateFormat (int displayType) - { - return getDateFormat (displayType, null); - } // getDateFormat - - /** - * Return format for date displayType - * @param displayType Display Type (default Date) - * @param language Language - * @return date format - */ - public static SimpleDateFormat getDateFormat (int displayType, Language language) - { - return getDateFormat(displayType, language, null); - } - /** - * Return format for date displayType - * @param displayType Display Type (default Date) - * @param language Language - * @param pattern Java Simple Date Format pattern e.g. "dd/MM/yy" - * @return date format - */ - public static SimpleDateFormat getDateFormat (int displayType, Language language, String pattern) - { - Language myLanguage = language; - if (myLanguage == null) - myLanguage = Env.getLanguage(Env.getCtx()); - // - if ( pattern != null && pattern.length() > 0) - { - SimpleDateFormat format = (SimpleDateFormat)DateFormat.getInstance(); - try { - format.applyPattern(pattern); - return format; - } - catch (IllegalArgumentException e) { - s_log.log(Level.WARNING, "Invalid date pattern: " + pattern); - } - } - - if (displayType == DateTime) - return myLanguage.getDateTimeFormat(); - else if (displayType == Time) - return myLanguage.getTimeFormat(); - // else if (displayType == Date) - return myLanguage.getDateFormat(); // default - } // getDateFormat - - /** - * JDBC Date Format YYYY-MM-DD - * @return date format - */ - static public SimpleDateFormat getDateFormat_JDBC() - { - return new SimpleDateFormat ("yyyy-MM-dd"); - } // getDateFormat_JDBC - - /** - * JDBC Timestamp Format yyyy-mm-dd hh:mm:ss - * @return timestamp format - */ - static public SimpleDateFormat getTimestampFormat_Default() - { - return new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); - } // getTimestampFormat_JDBC - - /** - * Return Storage Class. - * (used for MiniTable) - * @param displayType Display Type - * @param yesNoAsBoolean - yes or no as boolean - * @return class Integer - BigDecimal - Timestamp - String - Boolean - */ - public static Class getClass (int displayType, boolean yesNoAsBoolean) - { - if (isText(displayType) || displayType == List) - return String.class; - else if (isID(displayType) || displayType == Integer) // note that Integer is stored as BD - return Integer.class; - else if (isNumeric(displayType)) - return java.math.BigDecimal.class; - else if (isDate(displayType)) - return java.sql.Timestamp.class; - else if (displayType == YesNo) - return yesNoAsBoolean ? Boolean.class : String.class; - else if (displayType == Button) - return String.class; - else if (isLOB(displayType)) // CLOB is String - return byte[].class; - // - return Object.class; - } // getClass - - /** - * Get SQL DataType - * @param displayType AD_Reference_ID - * @param columnName name - * @param fieldLength length - * @return SQL Data Type in Oracle Notation - */ - public static String getSQLDataType (int displayType, String columnName, int fieldLength) - { - if (columnName.equals("EntityType") - || columnName.equals ("AD_Language")) - return "VARCHAR2(" + fieldLength + ")"; - // ID - if (DisplayType.isID(displayType)) - { - if (displayType == DisplayType.Image // FIXTHIS - && columnName.equals("BinaryData")) - return "BLOB"; - // ID, CreatedBy/UpdatedBy, Acct - else if (columnName.endsWith("_ID") - || columnName.endsWith("tedBy") - || columnName.endsWith("_Acct") ) - return "NUMBER(10)"; - else if (fieldLength < 4) - return "CHAR(" + fieldLength + ")"; - else // EntityType, AD_Language fallback - return "VARCHAR2(" + fieldLength + ")"; - } - // - if (displayType == DisplayType.Integer) - return "NUMBER(10)"; - if (DisplayType.isDate(displayType)) - return "DATE"; - if (DisplayType.isNumeric(displayType)) - return "NUMBER"; - if (displayType == DisplayType.Binary) - return "BLOB"; - if (displayType == DisplayType.TextLong - || (displayType == DisplayType.Text && fieldLength >= 4000)) - return "CLOB"; - if (displayType == DisplayType.YesNo) - return "CHAR(1)"; - if (displayType == DisplayType.List) { - if (fieldLength == 1) - return "CHAR(" + fieldLength + ")"; - else - return "NVARCHAR2(" + fieldLength + ")"; - } - if (displayType == DisplayType.Color) // this condition is never reached - filtered above in isID - { - if (columnName.endsWith("_ID")) - return "NUMBER(10)"; - else - return "CHAR(" + fieldLength + ")"; - } - if (displayType == DisplayType.Button) - { - if (columnName.endsWith("_ID")) - return "NUMBER(10)"; - else - return "CHAR(" + fieldLength + ")"; - } - if (!DisplayType.isText(displayType)) - s_log.severe("Unhandled Data Type = " + displayType); - - return "NVARCHAR2(" + fieldLength + ")"; - } // getSQLDataType - - /** - * Get Description - * @param displayType display Type - * @return display type description - */ - public static String getDescription (int displayType) - { - if (displayType == String) - return "String"; - if (displayType == Integer) - return "Integer"; - if (displayType == Amount) - return "Amount"; - if (displayType == ID) - return "ID"; - if (displayType == Text) - return "Text"; - if (displayType == Date) - return "Date"; - if (displayType == DateTime) - return "DateTime"; - if (displayType == List) - return "List"; - if (displayType == Table) - return "Table"; - if (displayType == TableDir) - return "TableDir"; - if (displayType == YesNo) - return "YesNo"; - if (displayType == Location) - return "Location"; - if (displayType == Number) - return "Number"; - if (displayType == Binary) - return "Binary"; - if (displayType == Time) - return "Time"; - if (displayType == Account) - return "Account"; - if (displayType == RowID) - return "RowID"; - if (displayType == Color) - return "Color"; - if (displayType == Button) - return "Button"; - if (displayType == Quantity) - return "Quantity"; - if (displayType == Search) - return "Search"; - if (displayType == Locator) - return "Locator"; - if (displayType == Image) - return "Image"; - if (displayType == Assignment) - return "Assignment"; - if (displayType == Memo) - return "Memo"; - if (displayType == PAttribute) - return "PAttribute"; - if (displayType == TextLong) - return "TextLong"; - if (displayType == CostPrice) - return "CostPrice"; - if (displayType == FilePath) - return "FilePath"; - if (displayType == FileName) - return "FileName"; - if (displayType == URL) - return "URL"; - if (displayType == PrinterName) - return "PrinterName"; - // - return "UNKNOWN DisplayType=" + displayType; - } // getDescription - -} // DisplayType +/****************************************************************************** + * Product: Compiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 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.util; + +import java.text.DateFormat; +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.text.SimpleDateFormat; +import java.util.Locale; +import java.util.logging.Level; + +import org.compiere.model.SystemIDs; + +/** + * System Display Types. + *
    + *	SELECT AD_Reference_ID, Name FROM AD_Reference WHERE ValidationType = 'D'
    + *  
    + * @author Jorg Janke + * @version $Id: DisplayType.java,v 1.6 2006/08/30 20:30:44 comdivision Exp $ + * + * @author Teo Sarca, SC ARHIPAC SERVICE SRL + *
  • BF [ 1810632 ] PricePrecision error in InfoProduct (and similar) + */ +public final class DisplayType implements SystemIDs +{ + /** Display Type 10 String */ + public static final int String = REFERENCE_DATATYPE_STRING; + /** Display Type 11 Integer */ + public static final int Integer = REFERENCE_DATATYPE_INTEGER; + /** Display Type 12 Amount */ + public static final int Amount = REFERENCE_DATATYPE_AMOUNT; + /** Display Type 13 ID */ + public static final int ID = REFERENCE_DATATYPE_ID; + /** Display Type 14 Text */ + public static final int Text = REFERENCE_DATATYPE_TEXT; + /** Display Type 15 Date */ + public static final int Date = REFERENCE_DATATYPE_DATE; + /** Display Type 16 DateTime */ + public static final int DateTime = REFERENCE_DATATYPE_DATETIME; + /** Display Type 17 List */ + public static final int List = REFERENCE_DATATYPE_LIST; + /** Display Type 18 Table */ + public static final int Table = REFERENCE_DATATYPE_TABLE; + /** Display Type 19 TableDir */ + public static final int TableDir = REFERENCE_DATATYPE_TABLEDIR; + /** Display Type 20 YN */ + public static final int YesNo = REFERENCE_DATATYPE_YES_NO; + /** Display Type 21 Location */ + public static final int Location = REFERENCE_DATATYPE_LOCATION; + /** Display Type 22 Number */ + public static final int Number = REFERENCE_DATATYPE_NUMBER; + /** Display Type 23 BLOB */ + public static final int Binary = REFERENCE_DATATYPE_BINARY; + /** Display Type 24 Time */ + public static final int Time = REFERENCE_DATATYPE_TIME; + /** Display Type 25 Account */ + public static final int Account = REFERENCE_DATATYPE_ACCOUNT; + /** Display Type 26 RowID */ + public static final int RowID = REFERENCE_DATATYPE_ROWID; + /** Display Type 27 Color */ + public static final int Color = REFERENCE_DATATYPE_COLOR; + /** Display Type 28 Button */ + public static final int Button = REFERENCE_DATATYPE_BUTTON; + /** Display Type 29 Quantity */ + public static final int Quantity = REFERENCE_DATATYPE_QUANTITY; + /** Display Type 30 Search */ + public static final int Search = REFERENCE_DATATYPE_SEARCH; + /** Display Type 31 Locator */ + public static final int Locator = REFERENCE_DATATYPE_LOCATOR; + /** Display Type 32 Image */ + public static final int Image = REFERENCE_DATATYPE_IMAGE; + /** Display Type 33 Assignment */ + public static final int Assignment = REFERENCE_DATATYPE_ASSIGNMENT; + /** Display Type 34 Memo */ + public static final int Memo = REFERENCE_DATATYPE_MEMO; + /** Display Type 35 PAttribute */ + public static final int PAttribute = REFERENCE_DATATYPE_PRODUCTATTRIBUTE; + /** Display Type 36 CLOB */ + public static final int TextLong = REFERENCE_DATATYPE_TEXTLONG; + /** Display Type 37 CostPrice */ + public static final int CostPrice = REFERENCE_DATATYPE_COSTPRICE; + /** Display Type 38 File Path */ + public static final int FilePath = REFERENCE_DATATYPE_FILEPATH; + /** Display Type 39 File Name */ + public static final int FileName = REFERENCE_DATATYPE_FILENAME; + /** Display Type 40 URL */ + public static final int URL = REFERENCE_DATATYPE_URL; + /** Display Type 42 PrinterName */ + public static final int PrinterName = REFERENCE_DATATYPE_PRINTNAME; + // Candidates: + + /** + * - New Display Type + INSERT INTO AD_REFERENCE + (AD_REFERENCE_ID, AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED,UPDATEDBY, + NAME,DESCRIPTION,HELP, VALIDATIONTYPE,VFORMAT,ENTITYTYPE) + VALUES (35, 0,0,'Y',SysDate,0,SysDate,0, + 'PAttribute','Product Attribute',null,'D',null,'D'); + * + * - org.compiere.model.MModel (??) + * - org.compiere.grid.ed.VEditor/Dialog + * - org.compiere.grid.ed.VEditorFactory + * - RColumn, WWindow + * add/check 0_cleanupAD.sql + */ + + // See DBA_DisplayType.sql ---------------------------------------------- + + /** Maximum number of digits */ + private static final int MAX_DIGITS = 28; // Oracle Standard Limitation 38 digits + /** Digits of an Integer */ + private static final int INTEGER_DIGITS = 10; + /** Maximum number of fractions */ + private static final int MAX_FRACTION = 12; + /** Default Amount Precision */ + private static final int AMOUNT_FRACTION = 2; + + /** Logger */ + private static CLogger s_log = CLogger.getCLogger (DisplayType.class); + + /** + * Returns true if (numeric) ID (Table, Search, Account, ..). + * (stored as Integer) + * @param displayType Display Type + * @return true if ID + */ + public static boolean isID (int displayType) + { + if (displayType == ID || displayType == Table || displayType == TableDir + || displayType == Search || displayType == Location || displayType == Locator + || displayType == Account || displayType == Assignment || displayType == PAttribute + || displayType == Image || displayType == Color) + return true; + return false; + } // isID + + /** + * Returns true, if DisplayType is numeric (Amount, Number, Quantity, Integer). + * (stored as BigDecimal) + * @param displayType Display Type + * @return true if numeric + */ + public static boolean isNumeric(int displayType) + { + if (displayType == Amount || displayType == Number || displayType == CostPrice + || displayType == Integer || displayType == Quantity) + return true; + return false; + } // isNumeric + + /** + * Get Default Precision. + * Used for databases who cannot handle dynamic number precision. + * @param displayType display type + * @return scale (decimal precision) + */ + public static int getDefaultPrecision(int displayType) + { + if (displayType == Amount) + return 2; + if (displayType == Number) + return 6; + if (displayType == CostPrice + || displayType == Quantity) + return 4; + return 0; + } // getDefaultPrecision + + + /** + * Returns true, if DisplayType is text (String, Text, TextLong, Memo). + * @param displayType Display Type + * @return true if text + */ + public static boolean isText(int displayType) + { + if (displayType == String || displayType == Text + || displayType == TextLong || displayType == Memo + || displayType == FilePath || displayType == FileName + || displayType == URL || displayType == PrinterName) + return true; + return false; + } // isText + + /** + * Returns true if DisplayType is a Date. + * (stored as Timestamp) + * @param displayType Display Type + * @return true if date + */ + public static boolean isDate (int displayType) + { + if (displayType == Date || displayType == DateTime || displayType == Time) + return true; + return false; + } // isDate + + /** + * Returns true if DisplayType is a VLookup (List, Table, TableDir, Search). + * (stored as Integer) + * @param displayType Display Type + * @return true if Lookup + */ + public static boolean isLookup(int displayType) + { + if (displayType == List || displayType == Table + || displayType == TableDir || displayType == Search) + return true; + return false; + } // isLookup + + /** + * Returns true if DisplayType is a Large Object + * @param displayType Display Type + * @return true if LOB + */ + public static boolean isLOB (int displayType) + { + if (displayType == Binary + || displayType == TextLong) + return true; + return false; + } // isLOB + + /************************************************************************** + * Return Format for numeric DisplayType + * @param displayType Display Type (default Number) + * @param language Language + * @param pattern Java Number Format pattern e.g. "#,##0.00" + * @return number format + */ + public static DecimalFormat getNumberFormat(int displayType, Language language, String pattern) + { + Language myLanguage = language; + if (myLanguage == null) + myLanguage = Language.getLoginLanguage(); + Locale locale = myLanguage.getLocale(); + DecimalFormat format = null; + if (locale != null) + format = (DecimalFormat)NumberFormat.getNumberInstance(locale); + else + format = (DecimalFormat)NumberFormat.getNumberInstance(Locale.US); + // + if (pattern != null && pattern.length() > 0) + { + try { + format.applyPattern(pattern); + return format; + } + catch (IllegalArgumentException e) { + s_log.log(Level.WARNING, "Invalid number format: " + pattern); + } + } + else if (displayType == Integer) + { + format.setParseIntegerOnly(true); + format.setMaximumIntegerDigits(INTEGER_DIGITS); + format.setMaximumFractionDigits(0); + } + else if (displayType == Quantity) + { + format.setMaximumIntegerDigits(MAX_DIGITS); + format.setMaximumFractionDigits(MAX_FRACTION); + } + else if (displayType == Amount) + { + format.setMaximumIntegerDigits(MAX_DIGITS); + format.setMaximumFractionDigits(MAX_FRACTION); + format.setMinimumFractionDigits(AMOUNT_FRACTION); + } + else if (displayType == CostPrice) + { + format.setMaximumIntegerDigits(MAX_DIGITS); + format.setMaximumFractionDigits(MAX_FRACTION); + format.setMinimumFractionDigits(AMOUNT_FRACTION); + } + else // if (displayType == Number) + { + format.setMaximumIntegerDigits(MAX_DIGITS); + format.setMaximumFractionDigits(MAX_FRACTION); + format.setMinimumFractionDigits(1); + } + return format; + } // getDecimalFormat + + /************************************************************************** + * Return Format for numeric DisplayType + * @param displayType Display Type (default Number) + * @param language Language + * @return number format + */ + public static DecimalFormat getNumberFormat(int displayType, Language language) + { + return getNumberFormat(displayType, language, null); + } + + /** + * Return Format for numeric DisplayType + * @param displayType Display Type + * @return number format + */ + public static DecimalFormat getNumberFormat(int displayType) + { + return getNumberFormat (displayType, null); + } // getNumberFormat + + + /************************************************************************* + * Return Date Format + * @return date format + */ + public static SimpleDateFormat getDateFormat() + { + return getDateFormat (DisplayType.Date, null); + } // getDateFormat + + /** + * Return Date Format + * @param language Language + * @return date format + */ + public static SimpleDateFormat getDateFormat (Language language) + { + return getDateFormat (DisplayType.Date, language); + } // getDateFormat + + /** + * Return format for date displayType + * @param displayType Display Type + * @return date format + */ + public static SimpleDateFormat getDateFormat (int displayType) + { + return getDateFormat (displayType, null); + } // getDateFormat + + /** + * Return format for date displayType + * @param displayType Display Type (default Date) + * @param language Language + * @return date format + */ + public static SimpleDateFormat getDateFormat (int displayType, Language language) + { + return getDateFormat(displayType, language, null); + } + /** + * Return format for date displayType + * @param displayType Display Type (default Date) + * @param language Language + * @param pattern Java Simple Date Format pattern e.g. "dd/MM/yy" + * @return date format + */ + public static SimpleDateFormat getDateFormat (int displayType, Language language, String pattern) + { + Language myLanguage = language; + if (myLanguage == null) + myLanguage = Env.getLanguage(Env.getCtx()); + // + if ( pattern != null && pattern.length() > 0) + { + SimpleDateFormat format = (SimpleDateFormat)DateFormat.getInstance(); + try { + format.applyPattern(pattern); + return format; + } + catch (IllegalArgumentException e) { + s_log.log(Level.WARNING, "Invalid date pattern: " + pattern); + } + } + + if (displayType == DateTime) + return myLanguage.getDateTimeFormat(); + else if (displayType == Time) + return myLanguage.getTimeFormat(); + // else if (displayType == Date) + return myLanguage.getDateFormat(); // default + } // getDateFormat + + /** + * JDBC Date Format YYYY-MM-DD + * @return date format + */ + static public SimpleDateFormat getDateFormat_JDBC() + { + return new SimpleDateFormat ("yyyy-MM-dd"); + } // getDateFormat_JDBC + + /** + * JDBC Timestamp Format yyyy-mm-dd hh:mm:ss + * @return timestamp format + */ + static public SimpleDateFormat getTimestampFormat_Default() + { + return new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); + } // getTimestampFormat_JDBC + + /** + * Return Storage Class. + * (used for MiniTable) + * @param displayType Display Type + * @param yesNoAsBoolean - yes or no as boolean + * @return class Integer - BigDecimal - Timestamp - String - Boolean + */ + public static Class getClass (int displayType, boolean yesNoAsBoolean) + { + if (isText(displayType) || displayType == List) + return String.class; + else if (isID(displayType) || displayType == Integer) // note that Integer is stored as BD + return Integer.class; + else if (isNumeric(displayType)) + return java.math.BigDecimal.class; + else if (isDate(displayType)) + return java.sql.Timestamp.class; + else if (displayType == YesNo) + return yesNoAsBoolean ? Boolean.class : String.class; + else if (displayType == Button) + return String.class; + else if (isLOB(displayType)) // CLOB is String + return byte[].class; + // + return Object.class; + } // getClass + + /** + * Get SQL DataType + * @param displayType AD_Reference_ID + * @param columnName name + * @param fieldLength length + * @return SQL Data Type in Oracle Notation + */ + public static String getSQLDataType (int displayType, String columnName, int fieldLength) + { + if (columnName.equals("EntityType") + || columnName.equals ("AD_Language")) + return "VARCHAR2(" + fieldLength + ")"; + // ID + if (DisplayType.isID(displayType)) + { + if (displayType == DisplayType.Image // FIXTHIS + && columnName.equals("BinaryData")) + return "BLOB"; + // ID, CreatedBy/UpdatedBy, Acct + else if (columnName.endsWith("_ID") + || columnName.endsWith("tedBy") + || columnName.endsWith("_Acct") ) + return "NUMBER(10)"; + else if (fieldLength < 4) + return "CHAR(" + fieldLength + ")"; + else // EntityType, AD_Language fallback + return "VARCHAR2(" + fieldLength + ")"; + } + // + if (displayType == DisplayType.Integer) + return "NUMBER(10)"; + if (DisplayType.isDate(displayType)) + return "DATE"; + if (DisplayType.isNumeric(displayType)) + return "NUMBER"; + if (displayType == DisplayType.Binary) + return "BLOB"; + if (displayType == DisplayType.TextLong + || (displayType == DisplayType.Text && fieldLength >= 4000)) + return "CLOB"; + if (displayType == DisplayType.YesNo) + return "CHAR(1)"; + if (displayType == DisplayType.List) { + if (fieldLength == 1) + return "CHAR(" + fieldLength + ")"; + else + return "NVARCHAR2(" + fieldLength + ")"; + } + if (displayType == DisplayType.Color) // this condition is never reached - filtered above in isID + { + if (columnName.endsWith("_ID")) + return "NUMBER(10)"; + else + return "CHAR(" + fieldLength + ")"; + } + if (displayType == DisplayType.Button) + { + if (columnName.endsWith("_ID")) + return "NUMBER(10)"; + else + return "CHAR(" + fieldLength + ")"; + } + if (!DisplayType.isText(displayType)) + s_log.severe("Unhandled Data Type = " + displayType); + + return "NVARCHAR2(" + fieldLength + ")"; + } // getSQLDataType + + /** + * Get Description + * @param displayType display Type + * @return display type description + */ + public static String getDescription (int displayType) + { + if (displayType == String) + return "String"; + if (displayType == Integer) + return "Integer"; + if (displayType == Amount) + return "Amount"; + if (displayType == ID) + return "ID"; + if (displayType == Text) + return "Text"; + if (displayType == Date) + return "Date"; + if (displayType == DateTime) + return "DateTime"; + if (displayType == List) + return "List"; + if (displayType == Table) + return "Table"; + if (displayType == TableDir) + return "TableDir"; + if (displayType == YesNo) + return "YesNo"; + if (displayType == Location) + return "Location"; + if (displayType == Number) + return "Number"; + if (displayType == Binary) + return "Binary"; + if (displayType == Time) + return "Time"; + if (displayType == Account) + return "Account"; + if (displayType == RowID) + return "RowID"; + if (displayType == Color) + return "Color"; + if (displayType == Button) + return "Button"; + if (displayType == Quantity) + return "Quantity"; + if (displayType == Search) + return "Search"; + if (displayType == Locator) + return "Locator"; + if (displayType == Image) + return "Image"; + if (displayType == Assignment) + return "Assignment"; + if (displayType == Memo) + return "Memo"; + if (displayType == PAttribute) + return "PAttribute"; + if (displayType == TextLong) + return "TextLong"; + if (displayType == CostPrice) + return "CostPrice"; + if (displayType == FilePath) + return "FilePath"; + if (displayType == FileName) + return "FileName"; + if (displayType == URL) + return "URL"; + if (displayType == PrinterName) + return "PrinterName"; + // + return "UNKNOWN DisplayType=" + displayType; + } // getDescription + +} // DisplayType From 5aecf6c9414357fa325cc4270a4bd8c57e0c7337 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Wed, 25 Apr 2012 17:52:54 +0200 Subject: [PATCH 45/49] IDEMPIERE-109 / Process parameter without element shouldn't be Centrally Maintained --- .../org/compiere/process/SynchronizeTerminology.java | 3 ++- .../src/org/compiere/model/MProcessPara.java | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) 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 a042b4794c..1d15f4eea5 100644 --- a/org.adempiere.base.process/src/org/compiere/process/SynchronizeTerminology.java +++ b/org.adempiere.base.process/src/org/compiere/process/SynchronizeTerminology.java @@ -78,6 +78,7 @@ public class SynchronizeTerminology extends SvrProcess rs.close(); trx.commit(true); // Create Elements for Process Parameters which are centrally maintained + /* IDEMPIERE 109 - this create unwanted Element sql="SELECT DISTINCT ColumnName, Name, Description, Help, EntityType " +" FROM AD_PROCESS_PARA p " +" WHERE NOT EXISTS " @@ -102,7 +103,7 @@ public class SynchronizeTerminology extends SvrProcess } pstmt.close(); rs.close(); - trx.commit(true); + trx.commit(true);*/ log.info("Adding missing Element Translations"); sql="INSERT INTO AD_ELEMENT_TRL (AD_Element_ID, AD_LANGUAGE, AD_Client_ID, AD_Org_ID," +" IsActive, Created, CreatedBy, Updated, UpdatedBy," diff --git a/org.adempiere.base/src/org/compiere/model/MProcessPara.java b/org.adempiere.base/src/org/compiere/model/MProcessPara.java index cfd47c1f54..48f3288049 100644 --- a/org.adempiere.base/src/org/compiere/model/MProcessPara.java +++ b/org.adempiere.base/src/org/compiere/model/MProcessPara.java @@ -268,4 +268,16 @@ public class MProcessPara extends X_AD_Process_Para } + /************************************************************************** + * Before Save + * @param newRecord + * @return save + */ + protected boolean beforeSave (boolean newRecord) + { + if (isCentrallyMaintained() && getAD_Element_ID() == 0) + setIsCentrallyMaintained(false); // IDEMPIERE 109 - param without element can't be centrally maintained + return true; + } // beforeSave + } // MProcessPara From f7687cff103fd0061ff2cb76c9cf8302c00496ca Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Thu, 26 Apr 2012 10:31:54 +0200 Subject: [PATCH 46/49] IDEMPIERE-240 / Let user choose the 'Statement Line Date' in CreateFromStatement --- org.adempiere.ui/src/org/compiere/grid/CreateFromStatement.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.adempiere.ui/src/org/compiere/grid/CreateFromStatement.java b/org.adempiere.ui/src/org/compiere/grid/CreateFromStatement.java index 23a571c9f6..bf02258997 100644 --- a/org.adempiere.ui/src/org/compiere/grid/CreateFromStatement.java +++ b/org.adempiere.ui/src/org/compiere/grid/CreateFromStatement.java @@ -265,7 +265,7 @@ public class CreateFromStatement extends CreateFrom protected void configureMiniTable (IMiniTable miniTable) { miniTable.setColumnClass(0, Boolean.class, false); // 0-Selection - miniTable.setColumnClass(1, Timestamp.class, true); // 1-TrxDate + miniTable.setColumnClass(1, Timestamp.class, false); // 1-TrxDate / nmicoud - idempiere 240 Let user choose the 'Statement Line Date' miniTable.setColumnClass(2, String.class, true); // 2-Payment miniTable.setColumnClass(3, String.class, true); // 3-Currency miniTable.setColumnClass(4, BigDecimal.class, true); // 4-Amount From 9b26b56a968a8bed05f7816b7bb31de5019c0fcd Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 26 Apr 2012 11:59:07 -0500 Subject: [PATCH 47/49] IDEMPIERE-250 Process parameters can inherit data from element (same as column and field) --- .../src/org/compiere/model/MProcessPara.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MProcessPara.java b/org.adempiere.base/src/org/compiere/model/MProcessPara.java index 48f3288049..114d03c91c 100644 --- a/org.adempiere.base/src/org/compiere/model/MProcessPara.java +++ b/org.adempiere.base/src/org/compiere/model/MProcessPara.java @@ -37,8 +37,7 @@ public class MProcessPara extends X_AD_Process_Para /** * */ - private static final long serialVersionUID = -2387741816477468470L; - + private static final long serialVersionUID = -6254678383726841920L; /** * Get MProcessPara from Cache @@ -277,6 +276,18 @@ public class MProcessPara extends X_AD_Process_Para { if (isCentrallyMaintained() && getAD_Element_ID() == 0) setIsCentrallyMaintained(false); // IDEMPIERE 109 - param without element can't be centrally maintained + + // Sync Terminology + if ((newRecord || is_ValueChanged ("AD_Element_ID")) + && getAD_Element_ID() != 0 && isCentrallyMaintained()) + { + M_Element element = new M_Element (getCtx(), getAD_Element_ID (), get_TrxName()); + setColumnName (element.getColumnName()); + setName (element.getName()); + setDescription (element.getDescription()); + setHelp (element.getHelp()); + } + return true; } // beforeSave From ede9f8fdb79230e718eecd2c9d151643716df9ba Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 26 Apr 2012 20:23:43 -0500 Subject: [PATCH 48/49] IDEMPIERE-252 Jasper exporting to spreadsheet with numbers formatted as text Thanks to Nils for the suggested solution at: http://sourceforge.net/projects/adempiere/forums/forum/610546/topic/4893175?message=10998881 --- .../compiere/report/JasperReportViewer.java | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/org.adempiere.report.jasper.swing/src/org/compiere/report/JasperReportViewer.java b/org.adempiere.report.jasper.swing/src/org/compiere/report/JasperReportViewer.java index 587692ec25..506d8a2d9f 100644 --- a/org.adempiere.report.jasper.swing/src/org/compiere/report/JasperReportViewer.java +++ b/org.adempiere.report.jasper.swing/src/org/compiere/report/JasperReportViewer.java @@ -16,10 +16,10 @@ import javax.swing.JSeparator; import javax.swing.SwingConstants; import net.sf.jasperreports.engine.JRException; -import net.sf.jasperreports.engine.JRExporterParameter; import net.sf.jasperreports.engine.JasperExportManager; import net.sf.jasperreports.engine.JasperPrint; -import net.sf.jasperreports.engine.export.JRXlsExporter; +import net.sf.jasperreports.engine.export.JExcelApiExporter; +import net.sf.jasperreports.engine.export.JExcelApiExporterParameter; import net.sf.jasperreports.view.JRViewer; import org.compiere.apps.EMailDialog; @@ -29,9 +29,11 @@ import org.compiere.util.Env; import org.compiere.util.Msg; public class JasperReportViewer extends JRViewer { + /** + * + */ + private static final long serialVersionUID = -8622715538000831737L; - private static final long serialVersionUID = -7988455595896562947L; - /** Logger */ private static CLogger log = CLogger.getCLogger(JasperReportViewer.class); @@ -103,9 +105,20 @@ class ExportListener implements ActionListener { } else if (viewer.getFormat().equals("HTML")) { JasperExportManager.exportReportToHtmlFile( viewer.getJasperPrint(), file.getAbsolutePath()); } else if (viewer.getFormat().equals("XLS")) { - JRXlsExporter exporter = new net.sf.jasperreports.engine.export.JRXlsExporter(); - exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, file.getAbsolutePath()); - exporter.setParameter(JRExporterParameter.JASPER_PRINT, viewer.getJasperPrint()); + //JRXlsExporter exporter = new net.sf.jasperreports.engine.export.JRXlsExporter(); + //exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, file.getAbsolutePath()); + //exporter.setParameter(JRExporterParameter.JASPER_PRINT, viewer.getJasperPrint()); + JExcelApiExporter exporter = new JExcelApiExporter(); + exporter.setParameter(JExcelApiExporterParameter.OUTPUT_FILE_NAME, file.getAbsolutePath()); + exporter.setParameter(JExcelApiExporterParameter.JASPER_PRINT, viewer.getJasperPrint()); + exporter.setParameter(JExcelApiExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE); + exporter.setParameter(JExcelApiExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); + exporter.setParameter(JExcelApiExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS, Boolean.TRUE); + exporter.setParameter(JExcelApiExporterParameter.IS_DETECT_CELL_TYPE , Boolean.TRUE); + exporter.setParameter(JExcelApiExporterParameter.IS_IGNORE_CELL_BACKGROUND, Boolean.TRUE); + exporter.setParameter(JExcelApiExporterParameter.IS_IGNORE_GRAPHICS, Boolean.TRUE); + exporter.setParameter(JExcelApiExporterParameter.IS_COLLAPSE_ROW_SPAN, Boolean.TRUE); + exporter.setParameter(JExcelApiExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE); exporter.exportReport(); } } catch (JRException e) { From 4fa70b977fb0ba519487617c024cd12f2c97ac48 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 26 Apr 2012 20:32:38 -0500 Subject: [PATCH 49/49] IDEMPIERE-252 Jasper exporting to spreadsheet with numbers formatted as text / porting solution to zk --- .../adempiere/webui/window/ZkJRViewer.java | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkJRViewer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkJRViewer.java index 64aad3cf21..c480d3bcb2 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkJRViewer.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkJRViewer.java @@ -10,11 +10,11 @@ import javax.servlet.http.HttpServletRequest; import net.sf.jasperreports.engine.JRExporterParameter; import net.sf.jasperreports.engine.JasperExportManager; import net.sf.jasperreports.engine.JasperPrint; +import net.sf.jasperreports.engine.export.JExcelApiExporter; +import net.sf.jasperreports.engine.export.JExcelApiExporterParameter; import net.sf.jasperreports.engine.export.JRCsvExporter; import net.sf.jasperreports.engine.export.JRHtmlExporter; import net.sf.jasperreports.engine.export.JRHtmlExporterParameter; -import net.sf.jasperreports.engine.export.JRXlsExporter; -import net.sf.jasperreports.engine.export.JRXlsExporterParameter; import org.adempiere.exceptions.AdempiereException; import org.adempiere.webui.component.Listbox; @@ -44,7 +44,6 @@ public class ZkJRViewer extends Window implements EventListener, ITabOnCloseHand * */ private static final long serialVersionUID = 2776405512345445561L; - private JasperPrint jasperPrint; private Listbox previewType = new Listbox(); private Iframe iframe; @@ -183,10 +182,21 @@ public class ZkJRViewer extends Window implements EventListener, ITabOnCloseHand FileOutputStream fos = new FileOutputStream(file); // coding For Excel: - JRXlsExporter exporterXLS = new JRXlsExporter(); - exporterXLS.setParameter(JRXlsExporterParameter.JASPER_PRINT, jasperPrint); - exporterXLS.setParameter(JRXlsExporterParameter.OUTPUT_STREAM, fos); - exporterXLS.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE); + // JRXlsExporter exporterXLS = new JRXlsExporter(); + // exporterXLS.setParameter(JRXlsExporterParameter.JASPER_PRINT, ); + // exporterXLS.setParameter(JRXlsExporterParameter.OUTPUT_STREAM, fos); + // exporterXLS.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE); + JExcelApiExporter exporterXLS = new JExcelApiExporter(); + exporterXLS.setParameter(JExcelApiExporterParameter.OUTPUT_FILE_NAME, file.getAbsolutePath()); + exporterXLS.setParameter(JExcelApiExporterParameter.JASPER_PRINT, jasperPrint); + exporterXLS.setParameter(JExcelApiExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE); + exporterXLS.setParameter(JExcelApiExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); + exporterXLS.setParameter(JExcelApiExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS, Boolean.TRUE); + exporterXLS.setParameter(JExcelApiExporterParameter.IS_DETECT_CELL_TYPE , Boolean.TRUE); + exporterXLS.setParameter(JExcelApiExporterParameter.IS_IGNORE_CELL_BACKGROUND, Boolean.TRUE); + exporterXLS.setParameter(JExcelApiExporterParameter.IS_IGNORE_GRAPHICS, Boolean.TRUE); + exporterXLS.setParameter(JExcelApiExporterParameter.IS_COLLAPSE_ROW_SPAN, Boolean.TRUE); + exporterXLS.setParameter(JExcelApiExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE); exporterXLS.exportReport(); media = new AMedia(getTitle(), "xls", "application/vnd.ms-excel", file, true);