From a6e708bb63c1f605dc42f6c2f3699fbfbdca7ac8 Mon Sep 17 00:00:00 2001 From: Jeff Godin Date: Wed, 30 Oct 2013 13:20:28 -0400 Subject: [PATCH] Skip dup username check when username unchanged Changing a username, then changing back to the user's current username results in a duplicate username detection -- a false positive due to the API call finding a user with that username -- the current user. This prevents you from saving any other changes you may have made to the user. This can be prevented by skipping the duplicate username check if the user is not new and the username in the field matches the username stored in the in-memory Javascript representation of the user. There's still a potential corner case which could be avoided by using a new/modified API call to either accept an "except this au.id" argument or to return the au.id of the found user, but I don't see a need for that at this point. Signed-off-by: Jeff Godin --- Open-ILS/web/js/ui/default/actor/user/register.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Open-ILS/web/js/ui/default/actor/user/register.js b/Open-ILS/web/js/ui/default/actor/user/register.js index 4932d7b463..90faafa0da 100644 --- a/Open-ILS/web/js/ui/default/actor/user/register.js +++ b/Open-ILS/web/js/ui/default/actor/user/register.js @@ -1306,7 +1306,9 @@ function attachWidgetEvents(fmcls, fmfield, widget) { var input = findWidget('au', 'usrname'); var usrname = input.widget.attr('value'); - if(!usrname) { + // Skip username check if the value is not yet present, or if this + // is a patron which already existed and the usrname value is unchanged + if(!usrname || (!patron.isnew() && usrname == patron.usrname())) { dupeUsrname = false; dojo.addClass(dojo.byId('uedit-dupe-username-warning'), 'hidden'); return; -- 2.11.0