diff --git a/migration/iD10/oracle/202210261110_IDEMPIERE-5460.sql b/migration/iD10/oracle/202210261110_IDEMPIERE-5460.sql new file mode 100644 index 0000000000..71e0f3e6fd --- /dev/null +++ b/migration/iD10/oracle/202210261110_IDEMPIERE-5460.sql @@ -0,0 +1,42 @@ +-- IDEMPIERE-5460 +SELECT register_migration_script('202210261110_IDEMPIERE-5460.sql') FROM dual; + +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Oct 26, 2022, 11:10:42 AM CEST +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (207405,'Report Type',663,211830,'Y',0,130,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-10-26 11:10:42','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-10-26 11:10:42','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','93d34f06-05a8-469a-a012-b0f61763dd58','Y',130,1,1,1,'N','N','N','N') +; + +-- Oct 26, 2022, 11:11:13 AM CEST +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (207406,'Print Format','Data Print Format','The print format determines how data is rendered for print.',663,211834,'Y',0,140,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-10-26 11:11:12','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-10-26 11:11:12','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','b7932bde-bef5-4233-8135-e82add84805d','Y',140,1,1,1,'N','N','N','N') +; + +-- Oct 26, 2022, 11:11:32 AM CEST +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (207407,'Language ID',663,211868,'Y',0,150,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-10-26 11:11:32','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-10-26 11:11:32','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','01b827e1-545d-4fa7-a9c3-070e1e9af97d','Y',150,1,1,1,'N','N','N','N') +; + +-- Oct 26, 2022, 11:12:29 AM CEST +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (207408,'Summary Level','This is a summary entity','A summary entity represents a branch in a tree rather than an end-node. Summary entities are used for reporting and do not have own values.',663,211837,'Y',0,160,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-10-26 11:12:29','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-10-26 11:12:29','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','00fa8185-63ee-4f49-914d-0d18ed342cc9','Y',160,1,1,1,'N','N','N','N') +; + +-- Oct 26, 2022, 11:13:49 AM CEST +INSERT INTO AD_FieldGroup (AD_FieldGroup_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,EntityType,FieldGroupType,IsCollapsedByDefault,AD_FieldGroup_UU) VALUES (200030,0,0,'Y',TO_TIMESTAMP('2022-10-26 11:13:49','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-10-26 11:13:49','YYYY-MM-DD HH24:MI:SS'),100,'Printing','D','C','N','1f19e42f-dfb1-4375-b8ff-783947b37944') +; + +-- Oct 26, 2022, 11:15:00 AM CEST +UPDATE AD_Field SET SeqNo=130, AD_FieldGroup_ID=200030, ColumnSpan=2,Updated=TO_TIMESTAMP('2022-10-26 11:15:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207405 +; + +-- Oct 26, 2022, 11:15:00 AM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=140, XPosition=4, ColumnSpan=2,Updated=TO_TIMESTAMP('2022-10-26 11:15:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207407 +; + +-- Oct 26, 2022, 11:15:00 AM CEST +UPDATE AD_Field SET SeqNo=150, ColumnSpan=2,Updated=TO_TIMESTAMP('2022-10-26 11:15:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207406 +; + +-- Oct 26, 2022, 11:15:00 AM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=160, XPosition=5,Updated=TO_TIMESTAMP('2022-10-26 11:15:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207408 +; + diff --git a/migration/iD10/postgresql/202210261110_IDEMPIERE-5460.sql b/migration/iD10/postgresql/202210261110_IDEMPIERE-5460.sql new file mode 100644 index 0000000000..fff9e9ab77 --- /dev/null +++ b/migration/iD10/postgresql/202210261110_IDEMPIERE-5460.sql @@ -0,0 +1,39 @@ +-- IDEMPIERE-5460 +SELECT register_migration_script('202210261110_IDEMPIERE-5460.sql') FROM dual; + +-- Oct 26, 2022, 11:10:42 AM CEST +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (207405,'Report Type',663,211830,'Y',0,130,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-10-26 11:10:42','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-10-26 11:10:42','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','93d34f06-05a8-469a-a012-b0f61763dd58','Y',130,1,1,1,'N','N','N','N') +; + +-- Oct 26, 2022, 11:11:13 AM CEST +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (207406,'Print Format','Data Print Format','The print format determines how data is rendered for print.',663,211834,'Y',0,140,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-10-26 11:11:12','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-10-26 11:11:12','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','b7932bde-bef5-4233-8135-e82add84805d','Y',140,1,1,1,'N','N','N','N') +; + +-- Oct 26, 2022, 11:11:32 AM CEST +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (207407,'Language ID',663,211868,'Y',0,150,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-10-26 11:11:32','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-10-26 11:11:32','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','01b827e1-545d-4fa7-a9c3-070e1e9af97d','Y',150,1,1,1,'N','N','N','N') +; + +-- Oct 26, 2022, 11:12:29 AM CEST +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField,IsQuickForm) VALUES (207408,'Summary Level','This is a summary entity','A summary entity represents a branch in a tree rather than an end-node. Summary entities are used for reporting and do not have own values.',663,211837,'Y',0,160,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-10-26 11:12:29','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-10-26 11:12:29','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','00fa8185-63ee-4f49-914d-0d18ed342cc9','Y',160,1,1,1,'N','N','N','N') +; + +-- Oct 26, 2022, 11:13:49 AM CEST +INSERT INTO AD_FieldGroup (AD_FieldGroup_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,EntityType,FieldGroupType,IsCollapsedByDefault,AD_FieldGroup_UU) VALUES (200030,0,0,'Y',TO_TIMESTAMP('2022-10-26 11:13:49','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-10-26 11:13:49','YYYY-MM-DD HH24:MI:SS'),100,'Printing','D','C','N','1f19e42f-dfb1-4375-b8ff-783947b37944') +; + +-- Oct 26, 2022, 11:15:00 AM CEST +UPDATE AD_Field SET SeqNo=130, AD_FieldGroup_ID=200030, ColumnSpan=2,Updated=TO_TIMESTAMP('2022-10-26 11:15:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207405 +; + +-- Oct 26, 2022, 11:15:00 AM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=140, XPosition=4, ColumnSpan=2,Updated=TO_TIMESTAMP('2022-10-26 11:15:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207407 +; + +-- Oct 26, 2022, 11:15:00 AM CEST +UPDATE AD_Field SET SeqNo=150, ColumnSpan=2,Updated=TO_TIMESTAMP('2022-10-26 11:15:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207406 +; + +-- Oct 26, 2022, 11:15:00 AM CEST +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=160, XPosition=5,Updated=TO_TIMESTAMP('2022-10-26 11:15:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=207408 +; + diff --git a/org.adempiere.base/src/org/compiere/print/ReportEngine.java b/org.adempiere.base/src/org/compiere/print/ReportEngine.java index c55cf32ec8..01580c7037 100644 --- a/org.adempiere.base/src/org/compiere/print/ReportEngine.java +++ b/org.adempiere.base/src/org/compiere/print/ReportEngine.java @@ -82,6 +82,7 @@ import org.compiere.model.MInventory; import org.compiere.model.MInvoice; import org.compiere.model.MMovement; import org.compiere.model.MOrder; +import org.compiere.model.MPInstance; import org.compiere.model.MPaySelectionCheck; import org.compiere.model.MProcess; import org.compiere.model.MProject; @@ -1838,6 +1839,8 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) int AD_PrintFormat_ID = 0; boolean IsForm = false; int Client_ID = -1; + + MPInstance instance = null; // Get AD_Table_ID and TableName StringBuilder sql = new StringBuilder("SELECT rv.AD_ReportView_ID,rv.WhereClause,") @@ -1867,6 +1870,10 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) AD_PrintFormat_ID = rs.getInt(5); // required IsForm = "Y".equals(rs.getString(6)); // required Client_ID = rs.getInt(7); + instance = new MPInstance(ctx, pi.getAD_PInstance_ID(), null); + instance.setAD_PrintFormat_ID(AD_PrintFormat_ID); + setDefaultReportTypeToPInstance(ctx, instance, AD_PrintFormat_ID); + instance.saveEx(); } } catch (SQLException e1) @@ -1899,6 +1906,7 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) AD_PrintFormat_ID = rs.getInt(3); // required IsForm = "Y".equals(rs.getString(4)); // required Client_ID = AD_Client_ID; + instance = new MPInstance(ctx, pi.getAD_PInstance_ID(), null); } } catch (SQLException e1) @@ -1915,6 +1923,12 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) + ",AD_Client_ID=" + AD_Client_ID); return null; } + else if(instance != null) + { + instance.setAD_PrintFormat_ID(AD_PrintFormat_ID); + setDefaultReportTypeToPInstance(ctx, instance, AD_PrintFormat_ID); + instance.saveEx(); + } } // Create Query from Parameters @@ -2733,4 +2747,15 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) return src; } } + + public static void setDefaultReportTypeToPInstance(Properties ctx, MPInstance instance, int printFormatID) { + if(Util.isEmpty(instance.getReportType())) { + MPrintFormat pf = new MPrintFormat(ctx, printFormatID, null); + String type = pf.isForm() + // a42niem - provide explicit default and check on client/org specifics + ? MSysConfig.getValue(MSysConfig.ZK_REPORT_FORM_OUTPUT_TYPE,"PDF",Env.getAD_Client_ID(ctx),Env.getAD_Org_ID(ctx)) + : MSysConfig.getValue(MSysConfig.ZK_REPORT_TABLE_OUTPUT_TYPE,"PDF",Env.getAD_Client_ID(ctx),Env.getAD_Org_ID(ctx)); + instance.setReportType(type); + } + } } // ReportEngine diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AbstractProcessDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AbstractProcessDialog.java index d4b3700ca1..3936c7a873 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AbstractProcessDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AbstractProcessDialog.java @@ -644,8 +644,10 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI } getProcessInfo().setIsSummary(chbIsSummary.isChecked()); - if (fLanguageType != null) + if (fLanguageType != null && fLanguageType.getValue() != null) getProcessInfo().setLanguageID(fLanguageType.getValue() == null?0:(int)fLanguageType.getValue()); + else + getProcessInfo().setLanguageID(MLanguage.get(getCtx(), Env.getLanguage(getCtx())).getAD_Language_ID()); } protected void autoStart() diff --git a/org.adempiere.ui/src/org/compiere/print/ReportCtl.java b/org.adempiere.ui/src/org/compiere/print/ReportCtl.java index 0715a29e97..5d688a5670 100644 --- a/org.adempiere.ui/src/org/compiere/print/ReportCtl.java +++ b/org.adempiere.ui/src/org/compiere/print/ReportCtl.java @@ -130,10 +130,14 @@ public class ReportCtl MPInstance instance = new MPInstance(Env.getCtx(), pi.getAD_PInstance_ID(), null); - if (pi.getReportType() != null) - instance.setReportType(pi.getReportType()); if (pi.getSerializableObject() != null) instance.setAD_PrintFormat_ID(((MPrintFormat)pi.getSerializableObject()).getAD_PrintFormat_ID()); + + if (pi.getReportType() != null) + instance.setReportType(pi.getReportType()); + else if(instance.getAD_PrintFormat_ID() > 0) + ReportEngine.setDefaultReportTypeToPInstance(Env.getCtx(), instance, instance.getAD_PrintFormat_ID()); + instance.setIsSummary(pi.isSummary()); instance.setAD_Language_ID(pi.getLanguageID()); instance.setIsProcessing(true);