From fb95f9fca8a0d7691fe1bd1ba4fed658a12d7e43 Mon Sep 17 00:00:00 2001 From: Elaine Tan Date: Mon, 5 Aug 2013 15:59:20 +0800 Subject: [PATCH] IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window --- .../oracle/201308051548_IDEMPIERE-1229.sql | 292 ++++++++++++++++++ .../201308051548_IDEMPIERE-1229.sql | 292 ++++++++++++++++++ .../org/compiere/model/I_AD_PrintFormat.java | 15 + .../org/compiere/model/X_AD_PrintFormat.java | 30 +- .../src/org/compiere/print/MPrintFormat.java | 18 +- .../src/org/compiere/util/Env.java | 80 +++++ .../src/org/compiere/apps/AEnv.java | 76 +---- .../src/org/compiere/print/AReport.java | 16 +- .../src/org/compiere/print/Viewer.java | 7 + .../src/org/adempiere/webui/apps/AEnv.java | 73 +---- .../src/org/adempiere/webui/apps/WReport.java | 10 +- .../webui/panel/action/ReportAction.java | 6 +- .../webui/window/ZkReportViewer.java | 10 + .../src/org/compiere/print/ReportCtl.java | 16 +- 14 files changed, 786 insertions(+), 155 deletions(-) create mode 100644 migration/i1.0c-release/oracle/201308051548_IDEMPIERE-1229.sql create mode 100644 migration/i1.0c-release/postgresql/201308051548_IDEMPIERE-1229.sql diff --git a/migration/i1.0c-release/oracle/201308051548_IDEMPIERE-1229.sql b/migration/i1.0c-release/oracle/201308051548_IDEMPIERE-1229.sql new file mode 100644 index 0000000000..d0ed2045a7 --- /dev/null +++ b/migration/i1.0c-release/oracle/201308051548_IDEMPIERE-1229.sql @@ -0,0 +1,292 @@ +-- Aug 1, 2013 12:32:12 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Table_ID,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,AD_Element_ID,IsSecure) VALUES (0,'N',0,493,210681,'N','N','N',0,'N',22,'N',19,'N','N','Y','01406b24-b108-4ef9-9533-688ceb8615c4','Y','AD_Window_ID','Data entry or display window','The Window field identifies a unique Window in the system.','Window','Y',TO_DATE('2013-08-01 12:32:11','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_DATE('2013-08-01 12:32:11','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N',143,'N') +; + +-- Aug 1, 2013 12:32:12 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) 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,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=210681 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) +; + +-- Aug 1, 2013 12:32:17 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +ALTER TABLE AD_PrintFormat ADD AD_Window_ID NUMBER(10) DEFAULT NULL +; + +-- Aug 1, 2013 12:35:28 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan) VALUES ('N',425,36,'N','N',60458,220,'Y',202367,'N','D','AD_PrintFormat_UU','d856c59c-850d-4f62-98c2-b30edf36641b','N','N',100,0,TO_DATE('2013-08-01 12:35:27','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2013-08-01 12:35:27','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2) +; + +-- Aug 1, 2013 12:35:28 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=202367 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) +; + +-- Aug 1, 2013 12:35:29 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,EntityType,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,AD_Client_ID,ColumnSpan) VALUES ('N',425,22,'N','N',210681,230,'Y',202368,'N','The Window field identifies a unique Window in the system.','D','Data entry or display window','Window','588d3710-0a9b-497d-a5fc-f03a565b8b2d','Y','N',100,0,TO_DATE('2013-08-01 12:35:28','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2013-08-01 12:35:28','YYYY-MM-DD HH24:MI:SS'),'Y',0,2) +; + +-- Aug 1, 2013 12:35:29 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=202368 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) +; + +-- Aug 1, 2013 12:36:10 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET DisplayLength=14,Updated=TO_DATE('2013-08-01 12:36:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202368 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N' WHERE AD_Field_ID=5666 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=10,IsDisplayedGrid='Y' WHERE AD_Field_ID=5662 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=20,IsDisplayedGrid='Y' WHERE AD_Field_ID=5664 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=30,IsDisplayedGrid='Y' WHERE AD_Field_ID=5659 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=40,IsDisplayedGrid='Y' WHERE AD_Field_ID=5665 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=50,IsDisplayedGrid='Y' WHERE AD_Field_ID=5652 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=60,IsDisplayedGrid='Y' WHERE AD_Field_ID=8291 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=70,IsDisplayedGrid='Y' WHERE AD_Field_ID=5655 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y' WHERE AD_Field_ID=5744 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y' WHERE AD_Field_ID=5656 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y' WHERE AD_Field_ID=5651 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y' WHERE AD_Field_ID=5663 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=120,IsDisplayedGrid='Y' WHERE AD_Field_ID=5653 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=130,IsDisplayedGrid='Y' WHERE AD_Field_ID=5762 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=140,IsDisplayedGrid='Y' WHERE AD_Field_ID=6503 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=150,IsDisplayedGrid='Y' WHERE AD_Field_ID=5657 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=160,IsDisplayedGrid='Y' WHERE AD_Field_ID=5661 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=170,IsDisplayedGrid='Y' WHERE AD_Field_ID=5654 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=180,IsDisplayedGrid='Y' WHERE AD_Field_ID=5658 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=190,IsDisplayedGrid='Y' WHERE AD_Field_ID=50179 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=200,IsDisplayedGrid='Y' WHERE AD_Field_ID=202368 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=210,IsDisplayedGrid='Y' WHERE AD_Field_ID=52009 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=220,IsDisplayedGrid='Y' WHERE AD_Field_ID=5660 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=230,IsDisplayedGrid='Y' WHERE AD_Field_ID=52008 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=202367 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=5666 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=10,IsDisplayed='Y' WHERE AD_Field_ID=5662 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=20,IsDisplayed='Y' WHERE AD_Field_ID=5664 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=30,IsDisplayed='Y' WHERE AD_Field_ID=5659 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=40,IsDisplayed='Y' WHERE AD_Field_ID=5665 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=50,IsDisplayed='Y' WHERE AD_Field_ID=5652 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=60,IsDisplayed='Y' WHERE AD_Field_ID=8291 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=70,IsDisplayed='Y' WHERE AD_Field_ID=5655 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=5744 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=5656 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=5651 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=5663 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=5653 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=5762 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y' WHERE AD_Field_ID=6503 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y' WHERE AD_Field_ID=5657 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y' WHERE AD_Field_ID=5661 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y' WHERE AD_Field_ID=5654 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=180,IsDisplayed='Y' WHERE AD_Field_ID=5658 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y' WHERE AD_Field_ID=50179 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=202368 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y' WHERE AD_Field_ID=52009 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y' WHERE AD_Field_ID=5660 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=52008 +; + +-- Aug 1, 2013 12:38:10 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET IsSameLine='Y', XPosition=4,Updated=TO_DATE('2013-08-01 12:38:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202368 +; + +SELECT register_migration_script('201308051548_IDEMPIERE-1229.sql') FROM dual +; \ No newline at end of file diff --git a/migration/i1.0c-release/postgresql/201308051548_IDEMPIERE-1229.sql b/migration/i1.0c-release/postgresql/201308051548_IDEMPIERE-1229.sql new file mode 100644 index 0000000000..c77a16a6d1 --- /dev/null +++ b/migration/i1.0c-release/postgresql/201308051548_IDEMPIERE-1229.sql @@ -0,0 +1,292 @@ +-- Aug 1, 2013 12:32:12 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Table_ID,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,AD_Element_ID,IsSecure) VALUES (0,'N',0,493,210681,'N','N','N',0,'N',22,'N',19,'N','N','Y','01406b24-b108-4ef9-9533-688ceb8615c4','Y','AD_Window_ID','Data entry or display window','The Window field identifies a unique Window in the system.','Window','Y',TO_TIMESTAMP('2013-08-01 12:32:11','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_TIMESTAMP('2013-08-01 12:32:11','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N',143,'N') +; + +-- Aug 1, 2013 12:32:12 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) 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,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=210681 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) +; + +-- Aug 1, 2013 12:32:17 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +ALTER TABLE AD_PrintFormat ADD COLUMN AD_Window_ID NUMERIC(10) DEFAULT NULL +; + +-- Aug 1, 2013 12:35:28 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,IsDisplayedGrid,AD_Client_ID,ColumnSpan) VALUES ('N',425,36,'N','N',60458,220,'Y',202367,'N','D','AD_PrintFormat_UU','d856c59c-850d-4f62-98c2-b30edf36641b','N','N',100,0,TO_TIMESTAMP('2013-08-01 12:35:27','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2013-08-01 12:35:27','YYYY-MM-DD HH24:MI:SS'),'Y','N',0,2) +; + +-- Aug 1, 2013 12:35:28 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=202367 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) +; + +-- Aug 1, 2013 12:35:29 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,EntityType,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,AD_Client_ID,ColumnSpan) VALUES ('N',425,22,'N','N',210681,230,'Y',202368,'N','The Window field identifies a unique Window in the system.','D','Data entry or display window','Window','588d3710-0a9b-497d-a5fc-f03a565b8b2d','Y','N',100,0,TO_TIMESTAMP('2013-08-01 12:35:28','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2013-08-01 12:35:28','YYYY-MM-DD HH24:MI:SS'),'Y',0,2) +; + +-- Aug 1, 2013 12:35:29 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=202368 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) +; + +-- Aug 1, 2013 12:36:10 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET DisplayLength=14,Updated=TO_TIMESTAMP('2013-08-01 12:36:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202368 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N' WHERE AD_Field_ID=5666 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=10,IsDisplayedGrid='Y' WHERE AD_Field_ID=5662 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=20,IsDisplayedGrid='Y' WHERE AD_Field_ID=5664 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=30,IsDisplayedGrid='Y' WHERE AD_Field_ID=5659 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=40,IsDisplayedGrid='Y' WHERE AD_Field_ID=5665 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=50,IsDisplayedGrid='Y' WHERE AD_Field_ID=5652 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=60,IsDisplayedGrid='Y' WHERE AD_Field_ID=8291 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=70,IsDisplayedGrid='Y' WHERE AD_Field_ID=5655 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y' WHERE AD_Field_ID=5744 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y' WHERE AD_Field_ID=5656 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y' WHERE AD_Field_ID=5651 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y' WHERE AD_Field_ID=5663 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=120,IsDisplayedGrid='Y' WHERE AD_Field_ID=5653 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=130,IsDisplayedGrid='Y' WHERE AD_Field_ID=5762 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=140,IsDisplayedGrid='Y' WHERE AD_Field_ID=6503 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=150,IsDisplayedGrid='Y' WHERE AD_Field_ID=5657 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=160,IsDisplayedGrid='Y' WHERE AD_Field_ID=5661 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=170,IsDisplayedGrid='Y' WHERE AD_Field_ID=5654 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=180,IsDisplayedGrid='Y' WHERE AD_Field_ID=5658 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=190,IsDisplayedGrid='Y' WHERE AD_Field_ID=50179 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=200,IsDisplayedGrid='Y' WHERE AD_Field_ID=202368 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=210,IsDisplayedGrid='Y' WHERE AD_Field_ID=52009 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=220,IsDisplayedGrid='Y' WHERE AD_Field_ID=5660 +; + +-- Aug 1, 2013 12:37:49 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNoGrid=230,IsDisplayedGrid='Y' WHERE AD_Field_ID=52008 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=202367 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=5666 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=10,IsDisplayed='Y' WHERE AD_Field_ID=5662 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=20,IsDisplayed='Y' WHERE AD_Field_ID=5664 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=30,IsDisplayed='Y' WHERE AD_Field_ID=5659 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=40,IsDisplayed='Y' WHERE AD_Field_ID=5665 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=50,IsDisplayed='Y' WHERE AD_Field_ID=5652 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=60,IsDisplayed='Y' WHERE AD_Field_ID=8291 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=70,IsDisplayed='Y' WHERE AD_Field_ID=5655 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=5744 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=5656 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=5651 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=5663 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=5653 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=5762 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y' WHERE AD_Field_ID=6503 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y' WHERE AD_Field_ID=5657 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y' WHERE AD_Field_ID=5661 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y' WHERE AD_Field_ID=5654 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=180,IsDisplayed='Y' WHERE AD_Field_ID=5658 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y' WHERE AD_Field_ID=50179 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=202368 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y' WHERE AD_Field_ID=52009 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y' WHERE AD_Field_ID=5660 +; + +-- Aug 1, 2013 12:37:56 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=52008 +; + +-- Aug 1, 2013 12:38:10 PM SGT +-- IDEMPIERE-1229 Purchase Order print format needs to be removed from SO window +UPDATE AD_Field SET IsSameLine='Y', XPosition=4,Updated=TO_TIMESTAMP('2013-08-01 12:38:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202368 +; + +SELECT register_migration_script('201308051548_IDEMPIERE-1229.sql') FROM dual +; \ No newline at end of file diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_PrintFormat.java b/org.adempiere.base/src/org/compiere/model/I_AD_PrintFormat.java index d5f2079b91..f8238a3281 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_PrintFormat.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_PrintFormat.java @@ -174,6 +174,21 @@ public interface I_AD_PrintFormat public org.compiere.model.I_AD_Table getAD_Table() throws RuntimeException; + /** Column name AD_Window_ID */ + public static final String COLUMNNAME_AD_Window_ID = "AD_Window_ID"; + + /** Set Window. + * Data entry or display window + */ + public void setAD_Window_ID (int AD_Window_ID); + + /** Get Window. + * Data entry or display window + */ + public int getAD_Window_ID(); + + public org.compiere.model.I_AD_Window getAD_Window() throws RuntimeException; + /** Column name Args */ public static final String COLUMNNAME_Args = "Args"; diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_PrintFormat.java b/org.adempiere.base/src/org/compiere/model/X_AD_PrintFormat.java index c8647d8b5a..342e1f6786 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_PrintFormat.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_PrintFormat.java @@ -30,7 +30,7 @@ public class X_AD_PrintFormat extends PO implements I_AD_PrintFormat, I_Persiste /** * */ - private static final long serialVersionUID = 20130626L; + private static final long serialVersionUID = 20130801L; /** Standard Constructor */ public X_AD_PrintFormat (Properties ctx, int AD_PrintFormat_ID, String trxName) @@ -289,6 +289,34 @@ public class X_AD_PrintFormat extends PO implements I_AD_PrintFormat, I_Persiste return ii.intValue(); } + public org.compiere.model.I_AD_Window getAD_Window() throws RuntimeException + { + return (org.compiere.model.I_AD_Window)MTable.get(getCtx(), org.compiere.model.I_AD_Window.Table_Name) + .getPO(getAD_Window_ID(), get_TrxName()); } + + /** Set Window. + @param AD_Window_ID + Data entry or display window + */ + public void setAD_Window_ID (int AD_Window_ID) + { + if (AD_Window_ID < 1) + set_Value (COLUMNNAME_AD_Window_ID, null); + else + set_Value (COLUMNNAME_AD_Window_ID, Integer.valueOf(AD_Window_ID)); + } + + /** Get Window. + @return Data entry or display window + */ + public int getAD_Window_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_Window_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + /** Set Args. @param Args Args */ public void setArgs (String Args) diff --git a/org.adempiere.base/src/org/compiere/print/MPrintFormat.java b/org.adempiere.base/src/org/compiere/print/MPrintFormat.java index 546311b9f3..c6ea706dac 100644 --- a/org.adempiere.base/src/org/compiere/print/MPrintFormat.java +++ b/org.adempiere.base/src/org/compiere/print/MPrintFormat.java @@ -61,7 +61,7 @@ public class MPrintFormat extends X_AD_PrintFormat /** * */ - private static final long serialVersionUID = -1378114118642378625L; + private static final long serialVersionUID = -4515887660012047223L; /** * Public Constructor. @@ -1159,19 +1159,20 @@ public class MPrintFormat extends X_AD_PrintFormat /** * @param AD_Table_ID + * @param AD_Window_ID * @param AD_Client_ID use -1 to retrieve from all client * @param trxName */ - public static RowSet getAccessiblePrintFormats (int AD_Table_ID, int AD_Client_ID, String trxName) + public static RowSet getAccessiblePrintFormats (int AD_Table_ID, int AD_Window_ID, int AD_Client_ID, String trxName) { RowSet rowSet = null; String sql = "SELECT AD_PrintFormat_ID, Name, AD_Client_ID " + "FROM AD_PrintFormat " + "WHERE AD_Table_ID=? AND IsTableBased='Y' "; + if (AD_Window_ID > 0) + sql += "AND (AD_Window_ID=? OR AD_Window_ID IS NULL) "; if (AD_Client_ID >= 0) - { - sql = sql + " AND AD_Client_ID = ? "; - } + sql += " AND AD_Client_ID = ? "; sql = sql + "ORDER BY AD_Client_ID DESC, IsDefault DESC, Name"; // Own First // sql = MRole.getDefault().addAccessSQL ( @@ -1180,9 +1181,12 @@ public class MPrintFormat extends X_AD_PrintFormat try { pstmt = DB.prepareStatement(sql, trxName); - pstmt.setInt(1, AD_Table_ID); + int count = 1; + pstmt.setInt(count++, AD_Table_ID); + if (AD_Window_ID > 0) + pstmt.setInt(count++, AD_Window_ID); if (AD_Client_ID >= 0) - pstmt.setInt(2, AD_Client_ID); + pstmt.setInt(count++, AD_Client_ID); rowSet = pstmt.getRowSet(); } catch (SQLException e) diff --git a/org.adempiere.base/src/org/compiere/util/Env.java b/org.adempiere.base/src/org/compiere/util/Env.java index f4a4e26ee4..359fe48646 100644 --- a/org.adempiere.base/src/org/compiere/util/Env.java +++ b/org.adempiere.base/src/org/compiere/util/Env.java @@ -56,8 +56,11 @@ import org.compiere.model.I_AD_Window; import org.compiere.model.MClient; import org.compiere.model.MColumn; import org.compiere.model.MLookupCache; +import org.compiere.model.MQuery; import org.compiere.model.MRole; import org.compiere.model.MSession; +import org.compiere.model.MTable; +import org.compiere.model.MZoomCondition; import org.compiere.model.PO; import org.compiere.process.ProcessInfo; import org.compiere.process.SvrProcess; @@ -1789,6 +1792,83 @@ public final class Env return Util.isEmpty(s) ? Adempiere.ADEMPIERE_R : s; } + public static int getZoomWindowID(MQuery query) + { + int AD_Window_ID = MZoomCondition.findZoomWindow(query); + if (AD_Window_ID <= 0) + { + String TableName = query.getTableName(); + int PO_Window_ID = 0; + String sql = "SELECT AD_Window_ID, PO_Window_ID FROM AD_Table WHERE TableName=?"; + PreparedStatement pstmt = null; + ResultSet rs = null; + try + { + pstmt = DB.prepareStatement(sql, null); + pstmt.setString(1, TableName); + rs = pstmt.executeQuery(); + if (rs.next()) + { + AD_Window_ID = rs.getInt(1); + PO_Window_ID = rs.getInt(2); + } + } + catch (SQLException e) + { + log.log(Level.SEVERE, sql, e); + } + finally + { + DB.close(rs, pstmt); + rs = null; + pstmt = null; + } + // Nothing to Zoom to + if (AD_Window_ID == 0) + return AD_Window_ID; + + // PO Zoom ? + boolean isSOTrx = true; + if (PO_Window_ID != 0) + { + isSOTrx = DB.isSOTrx(TableName, query.getWhereClause(false)); + if (!isSOTrx) + AD_Window_ID = PO_Window_ID; + } + + if (log.isLoggable(Level.CONFIG)) log.config(query + " (IsSOTrx=" + isSOTrx + ")"); + } + return AD_Window_ID; + } + + public static int getZoomWindowID(int AD_Table_ID, int Record_ID) + { + int AD_Window_ID = MZoomCondition.findZoomWindowByTableId(AD_Table_ID, Record_ID); + MTable table = MTable.get(Env.getCtx(), AD_Table_ID); + if (AD_Window_ID <= 0) + { + AD_Window_ID = table.getAD_Window_ID(); + // Nothing to Zoom to + if (AD_Window_ID == 0) + return AD_Window_ID; + + // PO Zoom ? + boolean isSOTrx = true; + if (table.getPO_Window_ID() != 0) + { + String whereClause = table.getTableName() + "_ID=" + Record_ID; + isSOTrx = DB.isSOTrx(table.getTableName(), whereClause); + if (!isSOTrx) + AD_Window_ID = table.getPO_Window_ID(); + } + + if (log.isLoggable(Level.CONFIG)) log.config(table.getTableName() + " - Record_ID=" + Record_ID + " (IsSOTrx=" + isSOTrx + ")"); + } + return AD_Window_ID; + } + + + /************************************************************************** * Static Variables */ 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 f75289a482..35c99fbd79 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/AEnv.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/AEnv.java @@ -31,7 +31,6 @@ import java.awt.Window; import java.awt.event.ActionListener; import java.sql.PreparedStatement; import java.sql.ResultSet; -import java.sql.SQLException; import java.util.ArrayList; import java.util.HashSet; import java.util.Set; @@ -55,7 +54,6 @@ import org.compiere.model.MMenu; import org.compiere.model.MQuery; import org.compiere.model.MRole; import org.compiere.model.MTable; -import org.compiere.model.MZoomCondition; import org.compiere.process.DocumentEngine; import org.compiere.swing.CButton; import org.compiere.swing.CFrame; @@ -635,27 +633,12 @@ public final class AEnv */ public static void zoom (int AD_Table_ID, int Record_ID) { - int AD_Window_ID = MZoomCondition.findZoomWindowByTableId(AD_Table_ID, Record_ID); + int AD_Window_ID = Env.getZoomWindowID(AD_Table_ID, Record_ID); + // Nothing to Zoom to + if (AD_Window_ID == 0) + return; + MTable table = MTable.get(Env.getCtx(), AD_Table_ID); - if (AD_Window_ID <= 0) - { - AD_Window_ID = table.getAD_Window_ID(); - // Nothing to Zoom to - if (AD_Window_ID == 0) - return; - - // PO Zoom ? - boolean isSOTrx = true; - if (table.getPO_Window_ID() != 0) - { - String whereClause = table.getTableName() + "_ID=" + Record_ID; - isSOTrx = DB.isSOTrx(table.getTableName(), whereClause); - if (!isSOTrx) - AD_Window_ID = table.getPO_Window_ID(); - } - - if (log.isLoggable(Level.CONFIG)) log.config(table.getTableName() + " - Record_ID=" + Record_ID + " (IsSOTrx=" + isSOTrx + ")"); - } AWindow frame = new AWindow(null); if (!frame.initWindow(AD_Window_ID, MQuery.getEqualQuery(table.getTableName() + "_ID", Record_ID))) @@ -681,50 +664,11 @@ public final class AEnv if (query == null || query.getTableName() == null || query.getTableName().length() == 0) return; - int AD_Window_ID = MZoomCondition.findZoomWindow(query); - if (AD_Window_ID <= 0) - { - String TableName = query.getTableName(); - int PO_Window_ID = 0; - String sql = "SELECT AD_Window_ID, PO_Window_ID FROM AD_Table WHERE TableName=?"; - PreparedStatement pstmt = null; - ResultSet rs = null; - try - { - pstmt = DB.prepareStatement(sql, null); - pstmt.setString(1, TableName); - rs = pstmt.executeQuery(); - if (rs.next()) - { - AD_Window_ID = rs.getInt(1); - PO_Window_ID = rs.getInt(2); - } - } - catch (SQLException e) - { - log.log(Level.SEVERE, sql, e); - } - finally - { - DB.close(rs, pstmt); - rs = null; - pstmt = null; - } - // Nothing to Zoom to - if (AD_Window_ID == 0) - return; - - // PO Zoom ? - boolean isSOTrx = true; - if (PO_Window_ID != 0) - { - isSOTrx = DB.isSOTrx(TableName, query.getWhereClause(false)); - if (!isSOTrx) - AD_Window_ID = PO_Window_ID; - } - - if (log.isLoggable(Level.CONFIG)) log.config(query + " (IsSOTrx=" + isSOTrx + ")"); - } + int AD_Window_ID = Env.getZoomWindowID(query); + // Nothing to Zoom to + if (AD_Window_ID == 0) + return; + AWindow frame = new AWindow(null); if (!frame.initWindow(AD_Window_ID, query)) return; diff --git a/org.adempiere.ui.swing/src/org/compiere/print/AReport.java b/org.adempiere.ui.swing/src/org/compiere/print/AReport.java index a187425eda..27e39c2850 100644 --- a/org.adempiere.ui.swing/src/org/compiere/print/AReport.java +++ b/org.adempiere.ui.swing/src/org/compiere/print/AReport.java @@ -85,9 +85,13 @@ public class AReport implements ActionListener m_query = query; this.parent = parent; this.WindowNo = WindowNo; + + int AD_Window_ID = Env.getContextAsInt(Env.getCtx(), WindowNo, "_WinInfo_AD_Window_ID", true); + if (AD_Window_ID == 0) + AD_Window_ID = Env.getZoomWindowID(query); // See What is there - getPrintFormats (AD_Table_ID, invoker); + getPrintFormats (AD_Table_ID, AD_Window_ID, invoker); } // AReport /** @@ -115,9 +119,13 @@ public class AReport implements ActionListener this.parent = parent; this.WindowNo = WindowNo; this.m_whereExtended = whereExtended; + + int AD_Window_ID = Env.getContextAsInt(Env.getCtx(), WindowNo, "_WinInfo_AD_Window_ID", true); + if (AD_Window_ID == 0) + AD_Window_ID = Env.getZoomWindowID(query); // See What is there - getPrintFormats (AD_Table_ID, invoker); + getPrintFormats (AD_Table_ID, AD_Window_ID, invoker); } // AReport /** The Query */ @@ -141,10 +149,10 @@ public class AReport implements ActionListener * @param AD_Table_ID table * @param invoker component to display popup (optional) */ - private void getPrintFormats (int AD_Table_ID, JComponent invoker) + private void getPrintFormats (int AD_Table_ID, int AD_Window_ID, JComponent invoker) { int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx()); - RowSet rowSet = MPrintFormat.getAccessiblePrintFormats(AD_Table_ID, -1, null); + RowSet rowSet = MPrintFormat.getAccessiblePrintFormats(AD_Table_ID, AD_Window_ID, -1, null); KeyNamePair pp = null; try { 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 5642a18435..e9f265b7a4 100644 --- a/org.adempiere.ui.swing/src/org/compiere/print/Viewer.java +++ b/org.adempiere.ui.swing/src/org/compiere/print/Viewer.java @@ -429,6 +429,10 @@ public class Viewer extends CFrame comboReport.removeActionListener(this); comboReport.removeAllItems(); KeyNamePair selectValue = null; + + int AD_Window_ID = Env.getContextAsInt(Env.getCtx(), m_reportEngine.getWindowNo(), "_WinInfo_AD_Window_ID", true); + if (AD_Window_ID == 0) + AD_Window_ID = Env.getZoomWindowID(m_reportEngine.getQuery()); // fill Report Options String sql = MRole.getDefault().addAccessSQL( "SELECT AD_PrintFormat_ID, Name, Description " @@ -437,6 +441,7 @@ public class Viewer extends CFrame //Added Lines by Armen + "AND IsActive='Y' " //End of Added Lines + + (AD_Window_ID > 0 ? "AND (AD_Window_ID=? OR AD_Window_ID IS NULL) " : "") + "ORDER BY Name", "AD_PrintFormat", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO); int AD_Table_ID = m_reportEngine.getPrintFormat().getAD_Table_ID(); @@ -446,6 +451,8 @@ public class Viewer extends CFrame { pstmt = DB.prepareStatement(sql, null); pstmt.setInt(1, AD_Table_ID); + if (AD_Window_ID > 0) + pstmt.setInt(2, AD_Window_ID); rs = pstmt.executeQuery(); while (rs.next()) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java index 8cb085b765..cb106f9f4f 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java @@ -24,9 +24,6 @@ import java.io.IOException; import java.lang.ref.WeakReference; import java.net.URI; import java.net.URISyntaxException; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; import java.util.Enumeration; import java.util.HashMap; import java.util.List; @@ -155,24 +152,11 @@ public final class AEnv */ public static void zoom (int AD_Table_ID, int Record_ID) { - int AD_Window_ID = MZoomCondition.findZoomWindowByTableId(AD_Table_ID, Record_ID); + int AD_Window_ID = Env.getZoomWindowID(AD_Table_ID, Record_ID); + // Nothing to Zoom to + if (AD_Window_ID == 0) + return; MTable table = MTable.get(Env.getCtx(), AD_Table_ID); - if (AD_Window_ID <= 0) - { - - AD_Window_ID = table.getAD_Window_ID(); - // PO Zoom ? - boolean isSOTrx = true; - if (table.getPO_Window_ID() != 0) - { - String whereClause = table.getTableName() + "_ID=" + Record_ID; - isSOTrx = DB.isSOTrx(table.getTableName(), whereClause); - if (!isSOTrx) - AD_Window_ID = table.getPO_Window_ID(); - } - - if (log.isLoggable(Level.CONFIG)) log.config(table.getTableName() + " - Record_ID=" + Record_ID + " (IsSOTrx=" + isSOTrx + ")"); - } zoom(AD_Window_ID, MQuery.getEqualQuery(table.getKeyColumns()[0], Record_ID)); } // zoom @@ -431,56 +415,15 @@ public final class AEnv { if (query == null || query.getTableName() == null || query.getTableName().length() == 0) return; - int AD_Window_ID = MZoomCondition.findZoomWindow(query); - if (AD_Window_ID <= 0) - { - String TableName = query.getTableName(); - int PO_Window_ID = 0; - String sql = "SELECT AD_Window_ID, PO_Window_ID FROM AD_Table WHERE TableName=?"; - PreparedStatement pstmt = null; - ResultSet rs = null; - try - { - pstmt = DB.prepareStatement(sql, null); - pstmt.setString(1, TableName); - rs = pstmt.executeQuery(); - if (rs.next()) - { - AD_Window_ID = rs.getInt(1); - PO_Window_ID = rs.getInt(2); - } - } - catch (SQLException e) - { - log.log(Level.SEVERE, sql, e); - } - finally - { - DB.close(rs, pstmt); - rs = null; - pstmt = null; - } - // Nothing to Zoom to - if (AD_Window_ID == 0) - return; - - // PO Zoom ? - boolean isSOTrx = true; - if (PO_Window_ID != 0) - { - isSOTrx = DB.isSOTrx(TableName, query.getWhereClause(false)); - if (!isSOTrx) - AD_Window_ID = PO_Window_ID; - } - - if (log.isLoggable(Level.CONFIG)) log.config(query + " (IsSOTrx=" + isSOTrx + ")"); - } + int AD_Window_ID = Env.getZoomWindowID(query); + // Nothing to Zoom to + if (AD_Window_ID == 0) + return; zoom(AD_Window_ID, query); } - /** * Get ImageIcon. * diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WReport.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WReport.java index 752ebdd123..33006cd8d7 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WReport.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/WReport.java @@ -100,8 +100,12 @@ public class WReport implements EventListener { this.WindowNo = WindowNo; this.whereExtended = whereExtended; + int AD_Window_ID = Env.getContextAsInt(Env.getCtx(), WindowNo, "_WinInfo_AD_Window_ID", true); + if (AD_Window_ID == 0) + AD_Window_ID = Env.getZoomWindowID(query); + // See What is there - getPrintFormats (AD_Table_ID); + getPrintFormats (AD_Table_ID, AD_Window_ID); } // AReport /** The Query */ @@ -124,10 +128,10 @@ public class WReport implements EventListener { * @param AD_Table_ID table * @param invoker component to display popup (optional) */ - private void getPrintFormats (int AD_Table_ID) + private void getPrintFormats (int AD_Table_ID, int AD_Window_ID) { int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx()); - RowSet rowSet = MPrintFormat.getAccessiblePrintFormats(AD_Table_ID, -1, null); + RowSet rowSet = MPrintFormat.getAccessiblePrintFormats(AD_Table_ID, AD_Window_ID, -1, null); KeyNamePair pp = null; try { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java index e673269b9a..89b0254e0c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java @@ -89,7 +89,7 @@ public class ReportAction implements EventListener public ReportAction(AbstractADWindowContent panel) { this.panel = panel; - getPrintFormats(panel.getActiveGridTab().getAD_Table_ID()); + getPrintFormats(panel.getActiveGridTab().getAD_Table_ID(), panel.getActiveGridTab().getAD_Window_ID()); } public void show() @@ -447,12 +447,12 @@ public class ReportAction implements EventListener } } - private void getPrintFormats(int AD_Table_ID) + private void getPrintFormats(int AD_Table_ID, int AD_Window_ID) { printFormatList.clear(); int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx()); - RowSet rowSet = MPrintFormat.getAccessiblePrintFormats(AD_Table_ID, -1, null); + RowSet rowSet = MPrintFormat.getAccessiblePrintFormats(AD_Table_ID, AD_Window_ID, -1, null); KeyNamePair pp = null; try { 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 02904c466b..2480fb4e38 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 @@ -360,6 +360,8 @@ public class ZkReportViewer extends Window implements EventListener, ITab south.appendChild(linkDiv); //m_WindowNo int AD_Window_ID = Env.getContextAsInt(Env.getCtx(), m_reportEngine.getWindowNo(), "_WinInfo_AD_Window_ID", true); + if (AD_Window_ID == 0) + AD_Window_ID = Env.getZoomWindowID(m_reportEngine.getQuery()); int AD_Process_ID = m_reportEngine.getPrintInfo() != null ? m_reportEngine.getPrintInfo().getAD_Process_ID() : 0; updateToolbarAccess(AD_Window_ID, AD_Process_ID); @@ -596,6 +598,11 @@ public class ZkReportViewer extends Window implements EventListener, ITab comboReport.removeEventListener(Events.ON_SELECT, this); comboReport.getItems().clear(); KeyNamePair selectValue = null; + + int AD_Window_ID = Env.getContextAsInt(Env.getCtx(), m_reportEngine.getWindowNo(), "_WinInfo_AD_Window_ID", true); + if (AD_Window_ID == 0) + AD_Window_ID = Env.getZoomWindowID(m_reportEngine.getQuery()); + // fill Report Options String sql = MRole.getDefault().addAccessSQL( "SELECT AD_PrintFormat_ID, Name, Description " @@ -604,6 +611,7 @@ public class ZkReportViewer extends Window implements EventListener, ITab //Added Lines by Armen + "AND IsActive='Y' " //End of Added Lines + + (AD_Window_ID > 0 ? "AND (AD_Window_ID=? OR AD_Window_ID IS NULL) " : "") + "ORDER BY Name", "AD_PrintFormat", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO); int AD_Table_ID = m_reportEngine.getPrintFormat().getAD_Table_ID(); @@ -613,6 +621,8 @@ public class ZkReportViewer extends Window implements EventListener, ITab { pstmt = DB.prepareStatement(sql, null); pstmt.setInt(1, AD_Table_ID); + if (AD_Window_ID > 0) + pstmt.setInt(2, AD_Window_ID); rs = pstmt.executeQuery(); while (rs.next()) { diff --git a/org.adempiere.ui/src/org/compiere/print/ReportCtl.java b/org.adempiere.ui/src/org/compiere/print/ReportCtl.java index 08e75c5b20..f23ede203c 100644 --- a/org.adempiere.ui/src/org/compiere/print/ReportCtl.java +++ b/org.adempiere.ui/src/org/compiere/print/ReportCtl.java @@ -155,11 +155,11 @@ public class ReportCtl return startDocumentPrint(ReportEngine.DUNNING, pi.getRecord_ID(), parent, WindowNo, !pi.isPrintPreview()); else if (pi.getAD_Process_ID() == PROCESS_RPT_FINREPORT // Financial Report || pi.getAD_Process_ID() == PROCESS_RPT_FINSTATEMENT) // Financial Statement - return startFinReport (pi); + return startFinReport (pi, WindowNo); /******************** * Standard Report *******************/ - return startStandardReport (pi); + return startStandardReport (pi, WindowNo); } // create /************************************************************************** @@ -169,10 +169,10 @@ public class ReportCtl * @param IsDirectPrint if true, prints directly - otherwise View * @return true if OK */ - static public boolean startStandardReport (ProcessInfo pi, boolean IsDirectPrint) + static public boolean startStandardReport (ProcessInfo pi, int WindowNo, boolean IsDirectPrint) { pi.setPrintPreview(!IsDirectPrint); - return startStandardReport(pi); + return startStandardReport(pi, WindowNo); } /************************************************************************** @@ -187,7 +187,7 @@ public class ReportCtl * @param IsDirectPrint if true, prints directly - otherwise View * @return true if OK */ - static public boolean startStandardReport (ProcessInfo pi) + static public boolean startStandardReport (ProcessInfo pi, int WindowNo) { ReportEngine re = null; // @@ -202,6 +202,7 @@ public class ReportCtl MQuery query = MQuery.get (ctx, pi.getAD_PInstance_ID(), TableName); PrintInfo info = new PrintInfo(pi); re = new ReportEngine(ctx, format, query, info); + re.setWindowNo(WindowNo); createOutput(re, pi.isPrintPreview(), null); return true; } @@ -214,6 +215,7 @@ public class ReportCtl pi.setSummary("No ReportEngine"); return false; } + re.setWindowNo(WindowNo); } createOutput(re, pi.isPrintPreview(), null); @@ -225,7 +227,7 @@ public class ReportCtl * @param pi Process Info * @return true if OK */ - static public boolean startFinReport (ProcessInfo pi) + static public boolean startFinReport (ProcessInfo pi, int WindowNo) { @SuppressWarnings("unused") int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx()); @@ -246,6 +248,7 @@ public class ReportCtl PrintInfo info = new PrintInfo(pi); ReportEngine re = new ReportEngine(Env.getCtx(), format, query, info); + re.setWindowNo(WindowNo); createOutput(re, pi.isPrintPreview(), null); return true; } // startFinReport @@ -311,6 +314,7 @@ public class ReportCtl { throw new AdempiereException("NoDocPrintFormat"); } + re.setWindowNo(WindowNo); if (customPrintFormat!=null) { // Use custom print format if available re.setPrintFormat(customPrintFormat);