IDEMPIERE-2089 Print format window ID is hardcoded in ZKReportViewer

This commit is contained in:
Carlos Ruiz 2014-11-05 08:59:55 -05:00
parent 5bbeae195b
commit ffc5bec7ad
5 changed files with 18 additions and 15 deletions

View File

@ -145,7 +145,6 @@ public class SystemIDs
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 final static int WINDOW_RETURNTOVENDOR = 53098;

View File

@ -29,6 +29,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
import org.adempiere.model.MTabCustomization;
import org.compiere.model.GridField;
import org.compiere.model.GridTab;
@ -58,7 +59,7 @@ public class MPrintFormat extends X_AD_PrintFormat
/**
*
*/
private static final long serialVersionUID = 2826550741107576964L;
private static final long serialVersionUID = 5563074831750686572L;
/**
* Public Constructor.
@ -1239,6 +1240,11 @@ public class MPrintFormat extends X_AD_PrintFormat
return clone;
}
public static int getZoomWindowID(int AD_PrintFormat_ID) {
int pfAD_Window_ID = Env.getZoomWindowID(Table_ID, AD_PrintFormat_ID);
return pfAD_Window_ID;
}
/**************************************************************************
* Test
* @param args arga

View File

@ -18,8 +18,6 @@
*****************************************************************************/
package org.compiere.print;
import static org.compiere.model.SystemIDs.WINDOW_PRINTFORMAT;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Cursor;
@ -473,8 +471,9 @@ public class Viewer extends CFrame
pstmt = null;
}
// IDEMPIERE-297 - Check for Table Access and Window Access for New Report
int pfAD_Window_ID = MPrintFormat.getZoomWindowID(AD_PrintFormat_ID);
if ( MRole.getDefault().isTableAccess(MPrintFormat.Table_ID, false)
&& (Boolean.TRUE.equals(MRole.getDefault().getWindowAccess(WINDOW_PRINTFORMAT))))
&& (Boolean.TRUE.equals(MRole.getDefault().getWindowAccess(pfAD_Window_ID))))
{
StringBuffer sb = new StringBuffer("** ").append(Msg.getMsg(m_ctx, "NewReport")).append(" **");
KeyNamePair pp = new KeyNamePair(-1, sb.toString());
@ -1221,8 +1220,8 @@ public class Viewer extends CFrame
{
AWindow win = new AWindow (getGraphicsConfiguration());
new AWindowListener (win, this); // forwards Window Events
int AD_Window_ID = WINDOW_PRINTFORMAT; // hardcoded
int AD_PrintFormat_ID = m_reportEngine.getPrintFormat().get_ID();
int AD_Window_ID = MPrintFormat.getZoomWindowID(AD_PrintFormat_ID);
boolean loadedOK = win.initWindow(AD_Window_ID, MQuery.getEqualQuery("AD_PrintFormat_ID", AD_PrintFormat_ID));
if (loadedOK)
{

View File

@ -15,14 +15,13 @@
package org.adempiere.webui.panel.action;
import static org.compiere.model.SystemIDs.WINDOW_PRINTFORMAT;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.adwindow.AbstractADWindowContent;
import org.adempiere.webui.apps.WProcessCtl;
@ -450,7 +449,8 @@ public class ReportAction implements EventListener<Event>
printFormatList = MPrintFormat.getAccessiblePrintFormats(AD_Table_ID, AD_Window_ID, null, false);
if (MRole.getDefault().isTableAccess(MPrintFormat.Table_ID, false) && Boolean.TRUE.equals(MRole.getDefault().getWindowAccess(WINDOW_PRINTFORMAT)))
int pfAD_Window_ID = MPrintFormat.getZoomWindowID(-1);
if (MRole.getDefault().isTableAccess(MPrintFormat.Table_ID, false) && Boolean.TRUE.equals(MRole.getDefault().getWindowAccess(pfAD_Window_ID)))
{
StringBuffer sb = new StringBuffer("** ").append(Msg.getMsg(Env.getCtx(), "NewReport")).append(" **");
KeyNamePair pp = new KeyNamePair(-1, sb.toString());

View File

@ -16,8 +16,6 @@
*****************************************************************************/
package org.adempiere.webui.window;
import static org.compiere.model.SystemIDs.WINDOW_PRINTFORMAT;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.StringWriter;
@ -648,8 +646,9 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
pstmt = null;
}
// IDEMPIERE-297 - Check for Table Access and Window Access for New Report
int pfAD_Window_ID = MPrintFormat.getZoomWindowID(AD_PrintFormat_ID);
if ( MRole.getDefault().isTableAccess(MPrintFormat.Table_ID, false)
&& Boolean.TRUE.equals(MRole.getDefault().getWindowAccess(WINDOW_PRINTFORMAT)))
&& Boolean.TRUE.equals(MRole.getDefault().getWindowAccess(pfAD_Window_ID)))
{
StringBuffer sb = new StringBuffer("** ").append(Msg.getMsg(Env.getCtx(), "NewReport")).append(" **");
KeyNamePair pp = new KeyNamePair(-1, sb.toString());
@ -1162,9 +1161,9 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
*/
private void cmd_customize()
{
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));
int pfAD_Window_ID = MPrintFormat.getZoomWindowID(AD_PrintFormat_ID);
AEnv.zoom(pfAD_Window_ID, MQuery.getEqualQuery("AD_PrintFormat_ID", AD_PrintFormat_ID));
} // cmd_customize
/*IDEMPIERE -379*/