IDEMPIERE-647 Error when drilling from idempiere table report.
This commit is contained in:
parent
cba45f139b
commit
a539fde713
|
@ -28,18 +28,14 @@ import java.util.concurrent.TimeUnit;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.adempiere.webui.apps.AEnv;
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.adempiere.webui.apps.WReport;
|
|
||||||
import org.adempiere.webui.apps.graph.WGraph;
|
import org.adempiere.webui.apps.graph.WGraph;
|
||||||
import org.adempiere.webui.apps.graph.WPerformanceDetail;
|
import org.adempiere.webui.apps.graph.WPerformanceDetail;
|
||||||
import org.adempiere.webui.component.ToolBarButton;
|
import org.adempiere.webui.component.ToolBarButton;
|
||||||
import org.adempiere.webui.dashboard.DashboardPanel;
|
import org.adempiere.webui.dashboard.DashboardPanel;
|
||||||
import org.adempiere.webui.dashboard.DashboardRunnable;
|
import org.adempiere.webui.dashboard.DashboardRunnable;
|
||||||
import org.adempiere.webui.event.DrillEvent;
|
|
||||||
import org.adempiere.webui.event.ZoomEvent;
|
|
||||||
import org.adempiere.webui.part.WindowContainer;
|
import org.adempiere.webui.part.WindowContainer;
|
||||||
import org.adempiere.webui.report.HTMLExtension;
|
import org.adempiere.webui.report.HTMLExtension;
|
||||||
import org.adempiere.webui.session.SessionManager;
|
import org.adempiere.webui.session.SessionManager;
|
||||||
import org.adempiere.webui.window.FDialog;
|
|
||||||
import org.adempiere.webui.window.ZkReportViewerProvider;
|
import org.adempiere.webui.window.ZkReportViewerProvider;
|
||||||
import org.compiere.Adempiere;
|
import org.compiere.Adempiere;
|
||||||
import org.compiere.model.I_AD_Menu;
|
import org.compiere.model.I_AD_Menu;
|
||||||
|
@ -50,10 +46,7 @@ import org.compiere.model.MMenu;
|
||||||
import org.compiere.model.MPInstance;
|
import org.compiere.model.MPInstance;
|
||||||
import org.compiere.model.MPInstancePara;
|
import org.compiere.model.MPInstancePara;
|
||||||
import org.compiere.model.MProcess;
|
import org.compiere.model.MProcess;
|
||||||
import org.compiere.model.MQuery;
|
|
||||||
import org.compiere.model.MRole;
|
|
||||||
import org.compiere.model.MSysConfig;
|
import org.compiere.model.MSysConfig;
|
||||||
import org.compiere.model.MTable;
|
|
||||||
import org.compiere.model.X_AD_CtxHelp;
|
import org.compiere.model.X_AD_CtxHelp;
|
||||||
import org.compiere.print.ReportEngine;
|
import org.compiere.print.ReportEngine;
|
||||||
import org.compiere.process.ProcessInfo;
|
import org.compiere.process.ProcessInfo;
|
||||||
|
@ -268,30 +261,6 @@ public class DashboardController implements EventListener<Event> {
|
||||||
{
|
{
|
||||||
String processParameters = dc.getProcessParameters();
|
String processParameters = dc.getProcessParameters();
|
||||||
embedReport(content, AD_Process_ID, processParameters);
|
embedReport(content, AD_Process_ID, processParameters);
|
||||||
content.addEventListener("onZoom", new EventListener<Event>() {
|
|
||||||
public void onEvent(Event event) throws Exception {
|
|
||||||
if (event instanceof ZoomEvent)
|
|
||||||
{
|
|
||||||
ZoomEvent ze = (ZoomEvent) event;
|
|
||||||
if (ze.getData() != null && ze.getData() instanceof MQuery) {
|
|
||||||
AEnv.zoom((MQuery) ze.getData());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
content.addEventListener(DrillEvent.ON_DRILL_DOWN, new EventListener<Event>() {
|
|
||||||
public void onEvent(Event event) throws Exception {
|
|
||||||
if (event instanceof DrillEvent)
|
|
||||||
{
|
|
||||||
DrillEvent de = (DrillEvent) event;
|
|
||||||
if (de.getData() != null && de.getData() instanceof MQuery) {
|
|
||||||
MQuery query = (MQuery) de.getData();
|
|
||||||
executeDrill(query);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Toolbar toolbar = new Toolbar();
|
Toolbar toolbar = new Toolbar();
|
||||||
content.appendChild(toolbar);
|
content.appendChild(toolbar);
|
||||||
|
@ -706,7 +675,8 @@ public class DashboardController implements EventListener<Event> {
|
||||||
Iframe iframe = new Iframe();
|
Iframe iframe = new Iframe();
|
||||||
iframe.setSclass("dashboard-report-iframe");
|
iframe.setSclass("dashboard-report-iframe");
|
||||||
File file = File.createTempFile(re.getName(), ".html");
|
File file = File.createTempFile(re.getName(), ".html");
|
||||||
re.createHTML(file, false, AEnv.getLanguage(Env.getCtx()), new HTMLExtension(Executions.getCurrent().getContextPath(), "rp", parent.getUuid()));
|
re.createHTML(file, false, AEnv.getLanguage(Env.getCtx()), new HTMLExtension(Executions.getCurrent().getContextPath(), "rp",
|
||||||
|
SessionManager.getAppDesktop().getComponent().getUuid()));
|
||||||
AMedia media = new AMedia(re.getName(), "html", "text/html", file, false);
|
AMedia media = new AMedia(re.getName(), "html", "text/html", file, false);
|
||||||
iframe.setContent(media);
|
iframe.setContent(media);
|
||||||
parent.appendChild(iframe);
|
parent.appendChild(iframe);
|
||||||
|
@ -717,22 +687,6 @@ public class DashboardController implements EventListener<Event> {
|
||||||
new ZkReportViewerProvider().openViewer(re);
|
new ZkReportViewerProvider().openViewer(re);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute Drill to Query
|
|
||||||
* @param query query
|
|
||||||
*/
|
|
||||||
public void executeDrill (MQuery query)
|
|
||||||
{
|
|
||||||
int AD_Table_ID = MTable.getTable_ID(query.getTableName());
|
|
||||||
if (!MRole.getDefault().isCanReport(AD_Table_ID))
|
|
||||||
{
|
|
||||||
FDialog.error(0, dashboardLayout.getParent(), "AccessCannotReport", query.getTableName());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (AD_Table_ID != 0)
|
|
||||||
new WReport(AD_Table_ID, query);
|
|
||||||
} // executeDrill
|
|
||||||
|
|
||||||
private void fillParameter(MPInstance pInstance, String parameters) {
|
private void fillParameter(MPInstance pInstance, String parameters) {
|
||||||
if (parameters != null && parameters.trim().length() > 0) {
|
if (parameters != null && parameters.trim().length() > 0) {
|
||||||
Map<String, String> paramMap = new HashMap<String, String>();
|
Map<String, String> paramMap = new HashMap<String, String>();
|
||||||
|
|
|
@ -29,10 +29,13 @@ import org.adempiere.util.ServerContext;
|
||||||
import org.adempiere.webui.apps.AEnv;
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.adempiere.webui.apps.BusyDialog;
|
import org.adempiere.webui.apps.BusyDialog;
|
||||||
import org.adempiere.webui.apps.ProcessDialog;
|
import org.adempiere.webui.apps.ProcessDialog;
|
||||||
|
import org.adempiere.webui.apps.WReport;
|
||||||
import org.adempiere.webui.component.Tabpanel;
|
import org.adempiere.webui.component.Tabpanel;
|
||||||
import org.adempiere.webui.component.ToolBarButton;
|
import org.adempiere.webui.component.ToolBarButton;
|
||||||
|
import org.adempiere.webui.event.DrillEvent;
|
||||||
import org.adempiere.webui.event.MenuListener;
|
import org.adempiere.webui.event.MenuListener;
|
||||||
import org.adempiere.webui.event.ZKBroadCastManager;
|
import org.adempiere.webui.event.ZKBroadCastManager;
|
||||||
|
import org.adempiere.webui.event.ZoomEvent;
|
||||||
import org.adempiere.webui.panel.ADForm;
|
import org.adempiere.webui.panel.ADForm;
|
||||||
import org.adempiere.webui.panel.BroadcastMessageWindow;
|
import org.adempiere.webui.panel.BroadcastMessageWindow;
|
||||||
import org.adempiere.webui.panel.HeaderPanel;
|
import org.adempiere.webui.panel.HeaderPanel;
|
||||||
|
@ -43,8 +46,12 @@ import org.adempiere.webui.session.SessionManager;
|
||||||
import org.adempiere.webui.util.IServerPushCallback;
|
import org.adempiere.webui.util.IServerPushCallback;
|
||||||
import org.adempiere.webui.util.ServerPushTemplate;
|
import org.adempiere.webui.util.ServerPushTemplate;
|
||||||
import org.adempiere.webui.util.UserPreference;
|
import org.adempiere.webui.util.UserPreference;
|
||||||
|
import org.adempiere.webui.window.FDialog;
|
||||||
import org.compiere.Adempiere;
|
import org.compiere.Adempiere;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
|
import org.compiere.model.MQuery;
|
||||||
|
import org.compiere.model.MRole;
|
||||||
|
import org.compiere.model.MTable;
|
||||||
import org.compiere.model.X_AD_CtxHelp;
|
import org.compiere.model.X_AD_CtxHelp;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
@ -150,6 +157,9 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
else
|
else
|
||||||
layout.setPage(page);
|
layout.setPage(page);
|
||||||
|
|
||||||
|
layout.addEventListener("onZoom", this);
|
||||||
|
layout.addEventListener(DrillEvent.ON_DRILL_DOWN, this);
|
||||||
|
|
||||||
North n = new North();
|
North n = new North();
|
||||||
layout.appendChild(n);
|
layout.appendChild(n);
|
||||||
n.setCollapsible(false);
|
n.setCollapsible(false);
|
||||||
|
@ -306,7 +316,41 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
||||||
if (change)
|
if (change)
|
||||||
updateUI();
|
updateUI();
|
||||||
}
|
}
|
||||||
|
else if (event instanceof ZoomEvent)
|
||||||
|
{
|
||||||
|
Clients.clearBusy();
|
||||||
|
ZoomEvent ze = (ZoomEvent) event;
|
||||||
|
if (ze.getData() != null && ze.getData() instanceof MQuery) {
|
||||||
|
AEnv.zoom((MQuery) ze.getData());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (event instanceof DrillEvent)
|
||||||
|
{
|
||||||
|
Clients.clearBusy();
|
||||||
|
DrillEvent de = (DrillEvent) event;
|
||||||
|
if (de.getData() != null && de.getData() instanceof MQuery) {
|
||||||
|
MQuery query = (MQuery) de.getData();
|
||||||
|
executeDrill(query);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute Drill to Query
|
||||||
|
* @param query query
|
||||||
|
*/
|
||||||
|
private void executeDrill (MQuery query)
|
||||||
|
{
|
||||||
|
int AD_Table_ID = MTable.getTable_ID(query.getTableName());
|
||||||
|
if (!MRole.getDefault().isCanReport(AD_Table_ID))
|
||||||
|
{
|
||||||
|
FDialog.error(0, null, "AccessCannotReport", query.getTableName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (AD_Table_ID != 0)
|
||||||
|
new WReport(AD_Table_ID, query);
|
||||||
|
} // executeDrill
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -76,10 +76,12 @@ import org.zkoss.util.media.AMedia;
|
||||||
import org.zkoss.util.media.Media;
|
import org.zkoss.util.media.Media;
|
||||||
import org.zkoss.zk.ui.Component;
|
import org.zkoss.zk.ui.Component;
|
||||||
import org.zkoss.zk.ui.Executions;
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.Page;
|
||||||
import org.zkoss.zk.ui.event.Event;
|
import org.zkoss.zk.ui.event.Event;
|
||||||
import org.zkoss.zk.ui.event.EventListener;
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
import org.zkoss.zk.ui.event.Events;
|
import org.zkoss.zk.ui.event.Events;
|
||||||
import org.zkoss.zk.ui.ext.render.DynamicMedia;
|
import org.zkoss.zk.ui.ext.render.DynamicMedia;
|
||||||
|
import org.zkoss.zk.ui.util.Clients;
|
||||||
import org.zkoss.zul.A;
|
import org.zkoss.zul.A;
|
||||||
import org.zkoss.zul.Borderlayout;
|
import org.zkoss.zul.Borderlayout;
|
||||||
import org.zkoss.zul.Center;
|
import org.zkoss.zul.Center;
|
||||||
|
@ -190,6 +192,16 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
|
||||||
this.onClose();
|
this.onClose();
|
||||||
}
|
}
|
||||||
m_isCanExport = MRole.getDefault().isCanExport(m_AD_Table_ID);
|
m_isCanExport = MRole.getDefault().isCanExport(m_AD_Table_ID);
|
||||||
|
|
||||||
|
setTitle(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Report") + ": " + m_reportEngine.getName() + " " + Env.getHeader(Env.getCtx(), 0)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageAttached(Page newpage, Page oldpage) {
|
||||||
|
super.onPageAttached(newpage, oldpage);
|
||||||
|
if (newpage != null) {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_ctx = m_reportEngine.getCtx();
|
m_ctx = m_reportEngine.getCtx();
|
||||||
|
@ -206,6 +218,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
|
||||||
this.onClose();
|
this.onClose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
Borderlayout layout = new Borderlayout();
|
Borderlayout layout = new Borderlayout();
|
||||||
|
@ -351,6 +364,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
|
||||||
|
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
if (event instanceof ZoomEvent) {
|
if (event instanceof ZoomEvent) {
|
||||||
|
Clients.clearBusy();
|
||||||
ZoomEvent ze = (ZoomEvent) event;
|
ZoomEvent ze = (ZoomEvent) event;
|
||||||
if (ze.getData() != null && ze.getData() instanceof MQuery) {
|
if (ze.getData() != null && ze.getData() instanceof MQuery) {
|
||||||
AEnv.zoom((MQuery) ze.getData());
|
AEnv.zoom((MQuery) ze.getData());
|
||||||
|
@ -364,6 +378,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
|
||||||
|
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
if (event instanceof DrillEvent) {
|
if (event instanceof DrillEvent) {
|
||||||
|
Clients.clearBusy();
|
||||||
DrillEvent de = (DrillEvent) event;
|
DrillEvent de = (DrillEvent) event;
|
||||||
if (de.getData() != null && de.getData() instanceof MQuery) {
|
if (de.getData() != null && de.getData() instanceof MQuery) {
|
||||||
MQuery query = (MQuery) de.getData();
|
MQuery query = (MQuery) de.getData();
|
||||||
|
@ -383,6 +398,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
|
||||||
|
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
if (event instanceof DrillEvent) {
|
if (event instanceof DrillEvent) {
|
||||||
|
Clients.clearBusy();
|
||||||
DrillEvent de = (DrillEvent) event;
|
DrillEvent de = (DrillEvent) event;
|
||||||
if (de.getData() != null && de.getData() instanceof MQuery) {
|
if (de.getData() != null && de.getData() instanceof MQuery) {
|
||||||
MQuery query = (MQuery) de.getData();
|
MQuery query = (MQuery) de.getData();
|
||||||
|
|
|
@ -1,16 +1,19 @@
|
||||||
function zoom(cmpid, column, value){
|
function zoom(cmpid, column, value){
|
||||||
|
zAu.cmd0.showBusy(null);
|
||||||
var widget = zk.Widget.$(cmpid);
|
var widget = zk.Widget.$(cmpid);
|
||||||
var event = new zk.Event(widget, 'onZoom', {data: [column, value]}, {toServer: true});
|
var event = new zk.Event(widget, 'onZoom', {data: [column, value]}, {toServer: true});
|
||||||
zAu.send(event);
|
zAu.send(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
function drillAcross(cmpid, column, value){
|
function drillAcross(cmpid, column, value){
|
||||||
|
zAu.cmd0.showBusy(null);
|
||||||
var widget = zk.Widget.$(cmpid);
|
var widget = zk.Widget.$(cmpid);
|
||||||
var event = new zk.Event(widget, 'onDrillAcross', {data: [column, value]}, {toServer: true});
|
var event = new zk.Event(widget, 'onDrillAcross', {data: [column, value]}, {toServer: true});
|
||||||
zAu.send(event);
|
zAu.send(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
function drillDown(cmpid, column, value){
|
function drillDown(cmpid, column, value){
|
||||||
|
zAu.cmd0.showBusy(null);
|
||||||
var widget = zk.Widget.$(cmpid);
|
var widget = zk.Widget.$(cmpid);
|
||||||
var event = new zk.Event(widget, 'onDrillDown', {data: [column, value]}, {toServer: true});
|
var event = new zk.Event(widget, 'onDrillDown', {data: [column, value]}, {toServer: true});
|
||||||
zAu.send(event);
|
zAu.send(event);
|
||||||
|
|
Loading…
Reference in New Issue