From a882c566d121fa639515f60862315122b2138a48 Mon Sep 17 00:00:00 2001 From: phib Date: Fri, 25 Mar 2011 23:43:01 -0500 Subject: [PATCH] Role data access/Personal lock sql where incorrect Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=3030369 --- .../src/org/compiere/model/MRole.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MRole.java b/org.adempiere.base/src/org/compiere/model/MRole.java index 83cbea199b..df2a3073cf 100644 --- a/org.adempiere.base/src/org/compiere/model/MRole.java +++ b/org.adempiere.base/src/org/compiere/model/MRole.java @@ -2023,10 +2023,14 @@ public final class MRole extends X_AD_Role } where.append(")"); } - else if (excludes.size() == 1) - where.append(whereColumnName).append("<>").append(excludes.get(0)); + else if (excludes.size() == 1) + { + where.append("(" + whereColumnName + " IS NULL OR "); + where.append(whereColumnName).append("<>").append(excludes.get(0)).append(")"); + } else if (excludes.size() > 1) - { + { + where.append("(" + whereColumnName + " IS NULL OR "); where.append(whereColumnName).append(" NOT IN ("); for (int ii = 0; ii < excludes.size(); ii++) { @@ -2034,7 +2038,7 @@ public final class MRole extends X_AD_Role where.append(","); where.append(excludes.get(ii)); } - where.append(")"); + where.append("))"); } log.finest(where.toString()); return where.toString(); @@ -2324,8 +2328,9 @@ public final class MRole extends X_AD_Role if (lockedIDs != null) { if (sb.length() > 0) - sb.append(" AND "); - sb.append(keyColumnName).append(lockedIDs); + sb.append(" AND "); + sb.append(" (" + keyColumnName + " IS NULL OR "); + sb.append(keyColumnName).append(lockedIDs).append(") "); } } //