IDEMPIERE-970 Role with the can Export option deselected would actually be able to export / jasper / peer review

This commit is contained in:
Carlos Ruiz 2013-05-29 19:12:45 -05:00
parent 3a0d154c52
commit b2d9e0ba88
4 changed files with 34 additions and 28 deletions

View File

@ -1,6 +1,6 @@
-- May 29, 2013 12:13:00 PM COT
-- IDEMPIERE-970 Role with the "can Export" option deselected would actually be able to export
INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,Description,AD_SysConfig_UU,Created,Updated,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType) VALUES (200030,'S','HTML','Sets default jasper output type','7dbe0a07-d566-419e-9f81-003cf0be6b52',TO_DATE('2013-05-29 12:13:00','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2013-05-29 12:13:00','YYYY-MM-DD HH24:MI:SS'),0,100,'Y',100,'ZK_REPORT_JASPER_OUTPUT_TYPE',0,'D')
INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,Description,AD_SysConfig_UU,Created,Updated,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType) VALUES (200030,'O','PDF','Sets default jasper output type','7dbe0a07-d566-419e-9f81-003cf0be6b52',TO_DATE('2013-05-29 12:13:00','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2013-05-29 12:13:00','YYYY-MM-DD HH24:MI:SS'),0,100,'Y',100,'ZK_REPORT_JASPER_OUTPUT_TYPE',0,'D')
;
SELECT register_migration_script('20130529121300_IDEMPIERE-970.sql') FROM dual

View File

@ -1,6 +1,6 @@
-- May 29, 2013 12:13:00 PM COT
-- IDEMPIERE-970 Role with the "can Export" option deselected would actually be able to export
INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,Description,AD_SysConfig_UU,Created,Updated,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType) VALUES (200030,'S','HTML','Sets default jasper output type','7dbe0a07-d566-419e-9f81-003cf0be6b52',TO_TIMESTAMP('2013-05-29 12:13:00','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2013-05-29 12:13:00','YYYY-MM-DD HH24:MI:SS'),0,100,'Y',100,'ZK_REPORT_JASPER_OUTPUT_TYPE',0,'D')
INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,Description,AD_SysConfig_UU,Created,Updated,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType) VALUES (200030,'O','PDF','Sets default jasper output type','7dbe0a07-d566-419e-9f81-003cf0be6b52',TO_TIMESTAMP('2013-05-29 12:13:00','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2013-05-29 12:13:00','YYYY-MM-DD HH24:MI:SS'),0,100,'Y',100,'ZK_REPORT_JASPER_OUTPUT_TYPE',0,'D')
;
SELECT register_migration_script('20130529121300_IDEMPIERE-970.sql') FROM dual

View File

@ -42,7 +42,7 @@ public class MSysConfig extends X_AD_SysConfig
/**
*
*/
private static final long serialVersionUID = -3368661022903012786L;
private static final long serialVersionUID = 1880114058462268002L;
public final static String PDF_FONT_DIR = "PDF_FONT_DIR";
public final static String TWOPACK_HANDLE_TRANSLATIONS = "2PACK_HANDLE_TRANSLATIONS";
@ -117,8 +117,7 @@ public class MSysConfig extends X_AD_SysConfig
public static final String DOCACTIONBUTTON_SHOWACTIONNAME = "DOCACTIONBUTTON_SHOWACTIONNAME";
public static final String ZK_MAX_UPLOAD_SIZE = "ZK_MAX_UPLOAD_SIZE";
public static final String CALENDAR_ALTERNATE_TIMEZONE = "CALENDAR_ALTERNATE_TIMEZONE";
public static final String ZK_REPORT_JASPER_OUTPUT_TYPE="ZK_REPORT_JASPER_OUTPUT_TYPE";
public static final String ZK_REPORT_JASPER_OUTPUT_TYPE = "ZK_REPORT_JASPER_OUTPUT_TYPE";
/**
* Standard Constructor

View File

@ -1,5 +1,7 @@
package org.adempiere.webui.window;
import static org.compiere.model.MSysConfig.ZK_REPORT_JASPER_OUTPUT_TYPE;
import java.io.File;
import java.io.FileOutputStream;
import java.util.logging.Level;
@ -18,8 +20,6 @@ import net.sf.jasperreports.engine.export.JRXlsExporter;
import net.sf.jasperreports.engine.export.JRXlsExporterParameter;
import net.sf.jasperreports.engine.util.LocalJasperReportsContext;
import ognl.DefaultTypeConverter;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.Tabpanel;
@ -71,7 +71,8 @@ public class ZkJRViewer extends Window implements EventListener<Event>, ITabOnCl
private void init() {
final boolean isCanExport=MRole.getDefault().isCanExport();
defaultType=MSysConfig.getValue(MSysConfig.ZK_REPORT_JASPER_OUTPUT_TYPE);//It gets default Jasper output type
defaultType = MSysConfig.getValue(ZK_REPORT_JASPER_OUTPUT_TYPE, "PDF",
Env.getAD_Client_ID(Env.getCtx()), Env.getAD_Org_ID(Env.getCtx()));//It gets default Jasper output type
Borderlayout layout = new Borderlayout();
layout.setStyle("position: absolute; height: 99%; width: 99%");
@ -82,32 +83,38 @@ public class ZkJRViewer extends Window implements EventListener<Event>, ITabOnCl
toolbar.setHeight("26px");
previewType.setMold("select");
if( isCanExport ){
previewType.appendItem("HTML", "HTML");
if (isCanExport) {
previewType.appendItem("PDF", "PDF");
previewType.appendItem("HTML", "HTML");
previewType.appendItem("Excel", "XLS");
previewType.appendItem("CSV", "CSV");
if( "HTML".equals(defaultType) ){
if ("PDF".equals(defaultType)) {
previewType.setSelectedIndex(0);
} else if( "PDF".equals(defaultType) ){
} else if ("HTML".equals(defaultType)) {
previewType.setSelectedIndex(1);
} else if( "XLS".equals(defaultType) ){
} else if ("XLS".equals(defaultType)) {
previewType.setSelectedIndex(2);
} else if( "CSV".equals(defaultType) ){
} else if ("CSV".equals(defaultType)) {
previewType.setSelectedIndex(3);
} else {
previewType.setSelectedIndex(1);
previewType.setSelectedIndex(0);
log.info("Format not Valid: "+defaultType);
}
}else{
previewType.appendItem("HTML", "HTML");
} else {
previewType.appendItem("PDF", "PDF");
if( "XLS".equals(defaultType) || "CSV".equals(defaultType) ){
defaultType="PDF";
}else if("HTML".equals(defaultType) || "PDF".equals(defaultType)){}
else log.info("Format not Valid: "+defaultType);
previewType.appendItem("HTML", "HTML");
if ("PDF".equals(defaultType)) {
previewType.setSelectedIndex(0);
} else if ("HTML".equals(defaultType)) {
previewType.setSelectedIndex(1);
} else if ("XLS".equals(defaultType)) {
previewType.setSelectedIndex(0); // default to PDF if cannot export
} else if ("CSV".equals(defaultType)) {
previewType.setSelectedIndex(0); // default to PDF if cannot export
} else {
previewType.setSelectedIndex(0);
log.info("Format not Valid: "+defaultType);
}
}
toolbar.appendChild(previewType);