From 8605e7d1460e4bdc0f0a51cda6b224bc08759ebe Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Sat, 2 Apr 2016 18:11:12 -0400 Subject: [PATCH] LP#1564685 Prevent linked address edit on reload Prevent editing of linked addresses when a user is loaded after the clone operation. Signed-off-by: Bill Erickson Signed-off-by: Kathy Lussier Signed-off-by: Galen Charlton --- .../js/ui/default/staff/circ/patron/regctl.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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 437c4019c2..69577d340e 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 @@ -67,6 +67,23 @@ angular.module('egCoreMod') }); } + // When editing a user with addresses linked to other users, fetch + // the linked user(s) so we can display their names and edit links. + service.get_linked_addr_users = function(addrs) { + angular.forEach(addrs, function(addr) { + if (addr.usr == service.existing_patron.id()) return; + egCore.pcrud.retrieve('au', addr.usr) + .then(function(usr) { + addr._linked_owner_id = usr.id(); + addr._linked_owner = service.format_name( + usr.family_name(), + usr.first_given_name(), + usr.second_given_name() + ); + }) + }); + } + service.apply_secondary_groups = function(user_id, group_ids) { return egCore.net.request( 'open-ils.actor', @@ -611,6 +628,8 @@ angular.module('egCoreMod') angular.forEach(patron.addresses, function(addr) { service.ingest_address(patron, addr) }); + service.get_linked_addr_users(patron.addresses); + // Remove stat cat entries that link to out-of-scope stat // cats. With this, we avoid unnecessarily updating (or worse, // modifying) stat cat values that are not ours to modify. -- 2.43.2