Refs #9674 - window UUID from quickInfo zoom ( IDEMPIERE-3978 )

This commit is contained in:
Murilo Habermann Torquato 2019-06-03 16:31:38 -03:00
parent 4251777150
commit c0b4da403d
5 changed files with 55 additions and 2 deletions

View File

@ -383,6 +383,19 @@ public class MQuery implements Serializable
private Object m_zoomValue;
private int m_zoomWindow_ID;
public int getM_zoomWindow_ID() {
return m_zoomWindow_ID;
}
public void setM_zoomWindow_ID(int m_zoomWindow_ID) {
this.m_zoomWindow_ID = m_zoomWindow_ID;
}
/**
* Get Record Count
* @return count - default 999999

View File

@ -27,6 +27,7 @@ import java.util.logging.Level;
import org.compiere.util.CCache;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.wf.MWFNode;
/**
@ -240,4 +241,26 @@ public class MWindow extends X_AD_Window
}
//end vpj-cd e-evolution
/**
* get Window ID by UU
* @param uu
* @return
*/
public static int findByUU(String uu)
{
int retValue = 0;
final String whereClause = MWindow.COLUMNNAME_AD_Window_UU + "=?";
MWindow window = new Query(Env.getCtx(), MWindow.Table_Name, whereClause, null)
.setParameters(uu)
.setOnlyActiveRecords(true)
.first();
if (window != null)
retValue = window.get_ID();
return retValue;
}
} // M_Window

View File

@ -462,7 +462,11 @@ public final class AEnv
if (query == null || query.getTableName() == null || query.getTableName().length() == 0)
return;
int AD_Window_ID = Env.getZoomWindowID(query);
int AD_Window_ID = query.getM_zoomWindow_ID();
if (AD_Window_ID <= 0)
AD_Window_ID = Env.getZoomWindowID(query);
// Nothing to Zoom to
if (AD_Window_ID == 0)
return;

View File

@ -17,6 +17,7 @@ import java.util.Map;
import org.adempiere.webui.event.ZoomEvent;
import org.compiere.model.MQuery;
import org.compiere.model.MWindow;
import org.zkoss.json.JSONArray;
import org.zkoss.lang.Objects;
import org.zkoss.zk.au.AuRequest;
@ -54,6 +55,7 @@ public class ZoomCommand implements AuService {
String columnName = (String) data.get(0);
String tableName = MQuery.getZoomTableName(columnName);
Object code = null;
int windowID = 0;
if (columnName.endsWith("_ID"))
{
try {
@ -66,6 +68,12 @@ public class ZoomCommand implements AuService {
{
code = data.get(1);
}
if (data.size() > 3)
{
String windowUU = (String) data.get(3);
windowID = MWindow.findByUU(windowUU);
}
//
MQuery query = new MQuery(tableName);
query.addRestriction(columnName, MQuery.EQUAL, code);
@ -73,6 +81,7 @@ public class ZoomCommand implements AuService {
query.setZoomTableName(tableName);
query.setZoomColumnName(columnName);
query.setZoomValue(code);
query.setM_zoomWindow_ID(windowID);
Events.postEvent(new ZoomEvent(comp, query));

View File

@ -1,7 +1,11 @@
function zoom(cmpid, column, value){
zoomWindow(cmpid, column, value, null)
}
function zoomWindow(cmpid, column, value, windowuu){
zAu.cmd0.showBusy(null);
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, 'AD_Window_UU', windowuu]}, {toServer: true});
zAu.send(event);
}