diff --git a/migration/i4.1/oracle/201707041543_IDEMPIERE-3411.sql b/migration/i4.1/oracle/201707041543_IDEMPIERE-3411.sql new file mode 100644 index 0000000000..6413c24481 --- /dev/null +++ b/migration/i4.1/oracle/201707041543_IDEMPIERE-3411.sql @@ -0,0 +1,10 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3411 : When lauching a report based on a report view, available print formats are not filtered +-- Jul 4, 2017 3:42:50 PM CEST +INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200104,0,0,TO_DATE('2017-07-04 15:42:49','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2017-07-04 15:42:49','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ZK_REPORT_ONLY_PRINTFORMAT_LINKEDTO_REPORTVIEW','N','If set to Yes, print formats will be filtered according to the current report view','U','C','18e6758b-db72-480e-b832-72080c8f2268') +; + +SELECT register_migration_script('201707041543_IDEMPIERE-3411.sql') FROM dual +; \ No newline at end of file diff --git a/migration/i4.1/postgresql/201707041543_IDEMPIERE-3411.sql b/migration/i4.1/postgresql/201707041543_IDEMPIERE-3411.sql new file mode 100644 index 0000000000..6328842b6e --- /dev/null +++ b/migration/i4.1/postgresql/201707041543_IDEMPIERE-3411.sql @@ -0,0 +1,7 @@ +-- IDEMPIERE-3411 : When lauching a report based on a report view, available print formats are not filtered +-- Jul 4, 2017 3:42:50 PM CEST +INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200104,0,0,TO_TIMESTAMP('2017-07-04 15:42:49','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2017-07-04 15:42:49','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ZK_REPORT_ONLY_PRINTFORMAT_LINKEDTO_REPORTVIEW','N','If set to Yes, print formats will be filtered according to the current report view','U','C','18e6758b-db72-480e-b832-72080c8f2268') +; + +SELECT register_migration_script('201707041543_IDEMPIERE-3411.sql') FROM dual +; \ No newline at end of file diff --git a/org.adempiere.base/src/org/compiere/model/MSysConfig.java b/org.adempiere.base/src/org/compiere/model/MSysConfig.java index 8b9ebda7cc..da1c198cfb 100644 --- a/org.adempiere.base/src/org/compiere/model/MSysConfig.java +++ b/org.adempiere.base/src/org/compiere/model/MSysConfig.java @@ -42,7 +42,7 @@ public class MSysConfig extends X_AD_SysConfig /** * */ - private static final long serialVersionUID = -1378971388226313818L; + private static final long serialVersionUID = -7805174199114873428L; public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION"; public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS"; @@ -168,6 +168,7 @@ public class MSysConfig extends X_AD_SysConfig public static final String ZK_PAGING_SIZE = "ZK_PAGING_SIZE"; public static final String ZK_REPORT_FORM_OUTPUT_TYPE = "ZK_REPORT_FORM_OUTPUT_TYPE"; public static final String ZK_REPORT_JASPER_OUTPUT_TYPE = "ZK_REPORT_JASPER_OUTPUT_TYPE"; + public static final String ZK_REPORT_ONLY_PRINTFORMAT_LINKEDTO_REPORTVIEW = "ZK_REPORT_ONLY_PRINTFORMAT_LINKEDTO_REPORTVIEW"; public static final String ZK_REPORT_TABLE_OUTPUT_TYPE = "ZK_REPORT_TABLE_OUTPUT_TYPE"; public static final String ZK_ROOT_FOLDER_BROWSER = "ZK_ROOT_FOLDER_BROWSER"; public static final String ZK_SEQ_DEFAULT_VALUE_PANEL = "ZK_SEQ_DEFAULT_VALUE_PANEL"; 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 99dea34eb2..2537c89b17 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 @@ -103,7 +103,7 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI /** * */ - private static final long serialVersionUID = -4807787318205732697L; + private static final long serialVersionUID = 8307953279095577359L; private static final String ON_COMPLETE = "onComplete"; private static final String ON_STATUS_UPDATE = "onStatusUpdate"; @@ -510,16 +510,23 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI MPrintFormat format = new MPrintFormat(m_ctx, pr.getAD_PrintFormat_ID(), null); table_ID = format.getAD_Table_ID(); } - String valCode = null; + StringBuilder valCode = new StringBuilder(); if (table_ID > 0) { - valCode = "AD_PrintFormat.AD_Table_ID=" + table_ID; + valCode.append("AD_PrintFormat.AD_Table_ID=").append(table_ID); m_isCanExport = MRole.getDefault().isCanExport(table_ID); } + + if (pr.getAD_ReportView_ID() > 0 && MSysConfig.getBooleanValue(MSysConfig.ZK_REPORT_ONLY_PRINTFORMAT_LINKEDTO_REPORTVIEW, false, client.getAD_Client_ID())) { + if (valCode.length() > 0) + valCode.append(" AND "); + valCode.append("AD_PrintFormat.AD_ReportView_ID=").append(pr.getAD_ReportView_ID()); + } + Lookup lookup = MLookupFactory.get (Env.getCtx(), m_WindowNo, AD_Column_ID, DisplayType.TableDir, Env.getLanguage(Env.getCtx()), "AD_PrintFormat_ID", 0, false, - valCode); + valCode.toString()); fPrintFormat = new WTableDirEditor("AD_PrintFormat_ID", false, false, true, lookup);