[OPEN-ILS-DEV] PATCH: respect patron hold notification prefs for staff-placed holds
Jeff Godin
jeff at tcnet.org
Thu Oct 22 13:49:08 EDT 2009
Greetings-
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.
Feedback welcome, DCO attached, etc.
Thanks!
-jeff
-------------- next part --------------
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 <jeff at tcnet.org>
-------------- next part --------------
Index: Open-ILS/web/opac/skin/default/js/holds.js
===================================================================
--- Open-ILS/web/opac/skin/default/js/holds.js (revision 14563)
+++ Open-ILS/web/opac/skin/default/js/holds.js (working copy)
@@ -56,6 +56,8 @@
return
}
+ grabUserPrefs(user);
+
holdArgs.recipient = user;
holdsDrawEditor();
}
@@ -445,15 +447,21 @@
$('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;
}
}
Index: Open-ILS/web/opac/common/js/opac_utils.js
===================================================================
--- Open-ILS/web/opac/common/js/opac_utils.js (revision 14563)
+++ Open-ILS/web/opac/common/js/opac_utils.js (working copy)
@@ -583,7 +583,7 @@
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;
More information about the Open-ils-dev
mailing list