From f452446ce6a64a887e3f5af80fa66133bbd47fce Mon Sep 17 00:00:00 2001 From: dbs Date: Tue, 3 Nov 2009 04:46:26 +0000 Subject: [PATCH] Patch from Jeff Godin to make holds placed by staff respect the patron's notification preferences. The attached patch should fix a bug which resulted in patron notification preferences (phone/email/both) being ignored in favor of the staff user's notification preferences when staff place a hold on behalf of another user. BUG: When staff place a hold for another user, the staff member's notification preferences (not the recipient user's) are consulted. This patch fixes that bug, as well as a bug where notification selections were not reset between canceled attempts to place holds for different recipients. There is also a minor change to grabUserPrefs() regarding which session variable to send as an auth token (now uses G.user.session, which seems to be an acceptable convention used elsewhere. This was needed, as the passed user does not always have a valid session. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. Signed-off-by: Jeff Godin git-svn-id: svn://svn.open-ils.org/ILS/trunk@14735 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/opac/common/js/opac_utils.js | 2 +- Open-ILS/web/opac/skin/default/js/holds.js | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Open-ILS/web/opac/common/js/opac_utils.js b/Open-ILS/web/opac/common/js/opac_utils.js index d587ea10b4..7d739f9cf2 100644 --- a/Open-ILS/web/opac/common/js/opac_utils.js +++ b/Open-ILS/web/opac/common/js/opac_utils.js @@ -583,7 +583,7 @@ function grabUser(ses, force) { function grabUserPrefs(user, force) { if(user == null) user = G.user; if(!force && user.prefs) return user.prefs; - var req = new Request(FETCH_USER_PREFS, user.session, user.id()); + var req = new Request(FETCH_USER_PREFS, G.user.session, user.id()); req.send(true); user.prefs = req.result(); return user.prefs; diff --git a/Open-ILS/web/opac/skin/default/js/holds.js b/Open-ILS/web/opac/skin/default/js/holds.js index d7730e5d78..cb24a80747 100644 --- a/Open-ILS/web/opac/skin/default/js/holds.js +++ b/Open-ILS/web/opac/skin/default/js/holds.js @@ -56,6 +56,8 @@ function _holdsHandleStaff() { return } + grabUserPrefs(user); + holdArgs.recipient = user; holdsDrawEditor(); } @@ -445,15 +447,21 @@ function __holdsDrawWindow() { $('holds_phone').value = holdArgs.recipient.day_phone(); appendClear( $('holds_email'), text(holdArgs.recipient.email())); - var pref = G.user.prefs[PREF_HOLD_NOTIFY]; + var pref = holdArgs.recipient.prefs[PREF_HOLD_NOTIFY]; if(pref) { - if( ! pref.match(/email/i) ) + if( ! pref.match(/email/i) ) { $('holds_enable_email').checked = false; + } else { + $('holds_enable_email').checked = true; + } if( ! pref.match(/phone/i) ) { $('holds_phone').disabled = true; $('holds_enable_phone').checked = false; + } else { + $('holds_phone').disabled = false; + $('holds_enable_phone').checked = true; } } -- 2.43.2