From d7d60d004b869a212b57f1287c822bc5c1efe0b6 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Wed, 18 Jul 2018 01:41:59 -0400 Subject: [PATCH] 7-retrieve-patron-fails-to-load-patron-record give the user_request.view permission some parity with VIEW_USER And some defensive programming if trying to create a request in the user already known context without adequate permission Signed-off-by: Jason Etheridge --- Open-ILS/examples/fm_IDL.xml | 4 +- .../js/ui/default/staff/acq/services/requests.js | 46 +++++++++++----------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index d8e77e2145..de5ddab489 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -3506,7 +3506,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - + @@ -6669,7 +6669,7 @@ SELECT usr, - + diff --git a/Open-ILS/web/js/ui/default/staff/acq/services/requests.js b/Open-ILS/web/js/ui/default/staff/acq/services/requests.js index a9fbbdc4fe..f44e9d9d71 100644 --- a/Open-ILS/web/js/ui/default/staff/acq/services/requests.js +++ b/Open-ILS/web/js/ui/default/staff/acq/services/requests.js @@ -342,30 +342,32 @@ function($uibModal , $q , egCore , egOrg , ngToast) { }, { atomic : true } ).then(function(users) { - var usr = egCore.idl.toHash(users[0]); - aur_obj.usr = usr.id; - aur_obj.pickup_lib = egCore.idl.toHash( - egOrg.get(usr.home_ou.id) - ); - aur_obj.phone_notify = usr.day_phone; - angular.forEach(usr.settings, function(s) { - if (s.name == 'opac.hold_notify') { - if (s.value.match('phone')) { - extra.phone_notify = true; + if (users.length > 0) { + var usr = egCore.idl.toHash(users[0]); + aur_obj.usr = usr.id; + aur_obj.pickup_lib = egCore.idl.toHash( + egOrg.get(usr.home_ou.id) + ); + aur_obj.phone_notify = usr.day_phone; + angular.forEach(usr.settings, function(s) { + if (s.name == 'opac.hold_notify') { + if (s.value.match('phone')) { + extra.phone_notify = true; + } + if (s.value.match('email')) { + aur_obj.email_notify = true; + } } - if (s.value.match('email')) { - aur_obj.email_notify = true; + if (s.name == 'opac.default_phone') { + aur_obj.phone_notify = s.value.replace(/^"/,'').replace(/"$/,''); } - } - if (s.name == 'opac.default_phone') { - aur_obj.phone_notify = s.value.replace(/^"/,'').replace(/"$/,''); - } - if (s.name == 'opac.default_pickup_location') { - aur_obj.pickup_lib = egCore.idl.toHash( - egOrg.get(s.value) - ); - } - }); + if (s.name == 'opac.default_pickup_location') { + aur_obj.pickup_lib = egCore.idl.toHash( + egOrg.get(s.value) + ); + } + }); + } return { 'request' : aur_obj, 'extra' : extra }; }); } else { -- 2.11.0