diff --git a/org.adempiere.base/src/org/compiere/model/MRole.java b/org.adempiere.base/src/org/compiere/model/MRole.java index 7734595927..2b0519649b 100644 --- a/org.adempiere.base/src/org/compiere/model/MRole.java +++ b/org.adempiere.base/src/org/compiere/model/MRole.java @@ -743,6 +743,9 @@ public final class MRole extends X_AD_Role */ private void loadOrgAccessUser(ArrayList list) { + if (getAD_User_ID() == -1) { + log.severe("Trying to load Org Access from User but user has not been set"); + } PreparedStatement pstmt = null; ResultSet rs = null; String sql = "SELECT * FROM AD_User_OrgAccess " @@ -2784,6 +2787,7 @@ public final class MRole extends X_AD_Role final int AD_User_ID = getAD_User_ID(); if (AD_User_ID < 0) { + log.severe("Trying to load Child Roles but user has not been set"); //throw new IllegalStateException("AD_User_ID is not set"); return ; } @@ -2819,6 +2823,7 @@ public final class MRole extends X_AD_Role final int AD_User_ID = getAD_User_ID(); if (AD_User_ID < 0) { + log.severe("Trying to load Substituted Roles but user has not been set"); //throw new IllegalStateException("AD_User_ID is not set"); return; } diff --git a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java index 6d7c5a80b5..f85ea2ba22 100644 --- a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java +++ b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java @@ -358,8 +358,8 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic String tableName = parameterName.substring(0, parameterName.length()-3); StringBuilder sql = new StringBuilder("SELECT "); sql.append(parameterName).append(" FROM ").append(tableName) - .append(" WHERE ").append(tableName).append("_UU=").append(DB.TO_STRING(string)); - return DB.getSQLValue(null, sql.toString()); + .append(" WHERE ").append(tableName).append("_UU=?"); + return DB.getSQLValue(null, sql.toString(), string); } Map requestCtx = getRequestCtx(); @@ -412,7 +412,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic // Validate parameters try { modelRunProcess.setADMenuID(validateParameter("AD_Menu_ID", modelRunProcess.getADMenuID())); - } catch(XmlValueOutOfRangeException e) { // Catch the exception when the Process ID is not an Integer + } catch(XmlValueOutOfRangeException e) { // Catch the exception when the Menu ID is not an Integer String menuUU = getUUIDValue(modelRunProcess.xgetADMenuID()); if (menuUU == null) { throw e; @@ -484,7 +484,15 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic int roleid = reqlogin.getRoleID(); // Validate parameters - modelGetList.setADReferenceID(validateParameter("AD_Reference_ID", modelGetList.getADReferenceID())); + try { + modelGetList.setADReferenceID(validateParameter("AD_Reference_ID", modelGetList.getADReferenceID())); + } catch(XmlValueOutOfRangeException e) { // Catch the exception when the Reference ID is not an Integer + String refUU = getUUIDValue(modelGetList.xgetADReferenceID()); + if (refUU == null) { + throw e; + } + modelGetList.setADReferenceID(validateParameter("AD_Reference_ID", 0, refUU)); + } modelGetList.setFilter(validateParameter("Filter", modelGetList.getFilter())); int ref_id = modelGetList.getADReferenceID(); @@ -543,7 +551,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic } else if (MReference.VALIDATIONTYPE_TableValidation.equals(ref.getValidationType())) { // Fill values from a reference table - MRole role = new MRole(ctx, roleid, null); + MRole role = MRole.get(ctx, roleid); MRefTable rt = MRefTable.get(ctx, ref_id); if (rt == null || rt.get_ID() == 0) throw new IdempiereServiceFault("Web service type " diff --git a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/Process.java b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/Process.java index f49b979afa..052a60cdf8 100644 --- a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/Process.java +++ b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/Process.java @@ -74,6 +74,12 @@ public class Process { private static final CLogger log = CLogger.getCLogger(Process.class); + /** + * @param cs + * @param req + * @return + * @deprecated - method not used - will be deleted in future versions + */ public static ProcessParamsDocument getProcessParams( CompiereService cs, GetProcessParamsDocument req ) { ProcessParamsDocument res = ProcessParamsDocument.Factory.newInstance(); @@ -193,11 +199,15 @@ public class Process { RunProcessResponse r= res.addNewRunProcessResponse(); RunProcess rp = req.getRunProcess(); + int AD_Menu_ID = rp.getADMenuID(); int AD_Process_ID = rp.getADProcessID(); int m_record_id = rp.getADRecordID(); - MProcess process = MProcess.get (m_cs.getCtx() , AD_Process_ID); - // need to check if Role can access + MProcess process = null; + if (AD_Menu_ID <= 0 && AD_Process_ID > 0) + process = MProcess.get(m_cs.getCtx(), AD_Process_ID); + else if (AD_Menu_ID > 0 && AD_Process_ID <= 0) + process = MProcess.getFromMenu(m_cs.getCtx(), AD_Menu_ID); if (process == null) { r.setError("Process not found");