From: Bill Erickson Date: Thu, 24 Mar 2016 01:21:12 +0000 (-0400) Subject: LP#1564685 Avoid dupe usrname warning on matching patron X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=01dbcf059439d6d5a5ee86c6944799b56988f063;p=evergreen%2Fmasslnc.git LP#1564685 Avoid dupe usrname warning on matching patron Do not treat usernames as duplicates when they belong to the patron being edited. Signed-off-by: Bill Erickson Signed-off-by: Kathy Lussier Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js index ae7838ed50..c68a20dae5 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js @@ -125,6 +125,16 @@ angular.module('egCoreMod') } service.check_dupe_username = function(usrname) { + + // empty usernames can't be dupes + if (!usrname) return $q.when(false); + + // avoid dupe check if username matches the originally loaded usrname + if (service.existing_patron) { + if (usrname == service.existing_patron.usrname()) + return $q.when(false); + } + return egCore.net.request( 'open-ils.actor', 'open-ils.actor.username.exists', @@ -573,6 +583,8 @@ angular.module('egCoreMod') */ service.init_existing_patron = function(current) { + service.existing_patron = current; + var patron = egCore.idl.toHash(current); patron.home_ou = egCore.org.get(patron.home_ou.id);