IDEMPIERE-2334 (Allow zoom from URL) colliding with IDEMPIERE-3000 (Automatic opening of menu entries at login) - automatic opening must not happen when the URL is an Action URL

This commit is contained in:
Carlos Ruiz 2017-10-24 20:46:26 +02:00
parent 4008e59986
commit 1237e22db7
1 changed files with 17 additions and 1 deletions

View File

@ -24,6 +24,8 @@ import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.adempiere.base.event.EventManager;
import org.adempiere.base.event.IEventManager;
@ -925,6 +927,8 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
return AD_Tree_ID;
}
private void automaticOpen(Properties ctx) {
if (isActionURL()) // IDEMPIERE-2334 vs IDEMPIERE-3000 - do not open windows when coming from an action URL
return;
StringBuilder sql = new StringBuilder("SELECT m.Action, COALESCE(m.AD_Window_ID, m.AD_Process_ID, m.AD_Form_ID, m.AD_Workflow_ID, m.AD_Task_ID, AD_InfoWindow_ID) ")
.append(" FROM AD_TreeBar tb")
@ -973,5 +977,17 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
}
}
}
}
}
private boolean isActionURL() {
ConcurrentMap<String, String[]> parameters = new ConcurrentHashMap<String, String[]>(Executions.getCurrent().getParameterMap());
String action = "";
if (parameters != null) {
String[] strs = parameters.get("Action");
if (strs != null && strs.length == 1 && strs[0] != null)
action = strs[0];
}
return ! Util.isEmpty(action);
}
}