Accept member accounts of more than 3 characters length in "run as"

command.
This commit is contained in:
Purodha 2013-04-02 16:55:04 +01:00
parent b2b192833c
commit 325ae31e08

View File

@ -205,7 +205,7 @@ public class Transaction {
return ticketUser.equals(pacName); // pac-admin return ticketUser.equals(pacName); // pac-admin
} }
String memberAccountPrefix = Config.getInstance().getProperty("accountprefix.customer", "hsh00") + "-"; String memberAccountPrefix = Config.getInstance().getProperty("accountprefix.customer", "hsh00") + "-";
if (ticketUser != null && (ticketUser.length() == 3 || (ticketUser.length() == 9 && ticketUser.startsWith(memberAccountPrefix)))) { if (ticketUser != null && (ticketUser.length() == 3 || (ticketUser.length() >= 9 && ticketUser.startsWith(memberAccountPrefix)))) {
Query memberQuery = getEntityManager().createQuery("SELECT c FROM Customers c WHERE c.name = :membername"); Query memberQuery = getEntityManager().createQuery("SELECT c FROM Customers c WHERE c.name = :membername");
memberQuery.setParameter("membername", ticketUser.length() == 3 ? (memberAccountPrefix + ticketUser) : ticketUser); memberQuery.setParameter("membername", ticketUser.length() == 3 ? (memberAccountPrefix + ticketUser) : ticketUser);
Customer member = (Customer) memberQuery.getSingleResult(); Customer member = (Customer) memberQuery.getSingleResult();