IDEMPIERE-4150 : Right click / New/Update not visible with duplicated windows (#50)

Also use ZoomConditions for Table/TableDirect editors
This commit is contained in:
Nicolas Micoud 2020-05-19 13:56:52 +02:00 committed by GitHub
parent 2e065e6e61
commit c5038a33ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 13 deletions

View File

@ -581,6 +581,11 @@ public class MLookupFactory
realSQL.append(" ORDER BY 3");
if (s_log.isLoggable(Level.FINEST)) s_log.finest("AD_Reference_Value_ID=" + AD_Reference_Value_ID + " - " + realSQL);
int zoomWinID = Env.getZoomWindowID(MTable.get(ctx, TableName).getAD_Table_ID(), 0, WindowNo);
if (zoomWinID > 0)
ZoomWindow = zoomWinID;
if (overrideZoomWindow > 0)
{
ZoomWindow = overrideZoomWindow;
@ -786,6 +791,10 @@ public class MLookupFactory
ZoomWindow = table.getAD_Window_ID();
ZoomWindowPO = table.getPO_Window_ID();
int zoomWinID = Env.getZoomWindowID(table.getAD_Table_ID(), 0, WindowNo);
if (zoomWinID > 0)
ZoomWindow = zoomWinID;
StringBuilder realSQL = new StringBuilder("SELECT ");
realSQL.append(TableName).append(".").append(KeyColumn).append(",NULL,");

View File

@ -141,23 +141,16 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
Boolean canAccessZoom = MRole.getDefault().getWindowAccess(zoomCondition.getAD_Window_ID());
if (canAccessZoom != null && canAccessZoom) {
this.zoomEnabled = true;
if (hasQuickEntryField(zoomCondition.getAD_Window_ID(), 0, tableName)) {
this.newEnabled = true;
this.updateEnabled = true;
}
break;
}
}
} else {
int cnt = DB.getSQLValueEx(null,
"SELECT COUNT(*) "
+ "FROM AD_Field f "
+ " JOIN AD_Tab t "
+ " ON ( t.AD_Tab_ID = f.AD_Tab_ID ) "
+ "WHERE t.AD_Window_ID IN (?,?) "
+ " AND f.IsActive = 'Y' "
+ " AND t.IsActive = 'Y' "
+ " AND f.IsQuickEntry = 'Y' "
+ " AND (t.TabLevel = 0 "
+ " AND t.AD_Table_ID IN (SELECT AD_Table_ID FROM AD_Table WHERE TableName = ? )) ",
winID,winIDPO,tableName);
if (cnt > 0) {
if (hasQuickEntryField(winID,winIDPO,tableName)) {
this.newEnabled = true;
this.updateEnabled = true;
} else {
@ -169,6 +162,21 @@ public class WEditorPopupMenu extends Menupopup implements EventListener<Event>
init();
}
boolean hasQuickEntryField(int winID, int winIDPO, String tableName) {
return DB.getSQLValueEx(null,
"SELECT COUNT(*) "
+ "FROM AD_Field f "
+ " JOIN AD_Tab t "
+ " ON ( t.AD_Tab_ID = f.AD_Tab_ID ) "
+ "WHERE t.AD_Window_ID IN (?,?) "
+ " AND f.IsActive = 'Y' "
+ " AND t.IsActive = 'Y' "
+ " AND f.IsQuickEntry = 'Y' "
+ " AND (t.TabLevel = 0 "
+ " AND t.AD_Table_ID IN (SELECT AD_Table_ID FROM AD_Table WHERE TableName = ? )) ",
winID,winIDPO,tableName) > 0;
}
public boolean isZoomEnabled() {
return zoomEnabled;
}