TPac: Show email address when placing hold
authorThomas Berezansky <tsbere@mvlc.org>
Fri, 17 Aug 2012 20:20:35 +0000 (16:20 -0400)
committerBill Erickson <berick@esilibrary.com>
Wed, 22 Aug 2012 18:03:04 +0000 (14:03 -0400)
Both for staff and patron benefit.

Also, we disable the checkbox if there is no email address on file.

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Ben Shum <bshum@biblio.org>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/opac/parts/place_hold.tt2
Open-ILS/web/js/ui/default/opac/staff.js
Open-ILS/xul/staff_client/chrome/content/main/menu.js

index ec979e3..730bc6f 100644 (file)
             [% l('Notify when hold is ready for pickup?') %]
             <blockquote>
                 <input type="checkbox" name="email_notify" value="t"
-                    [% IF ctx.default_email_notify %]checked="checked"[% END %]/>
+                    [% IF !ctx.user.email %]disabled="true"[% ELSIF ctx.default_email_notify %]checked="checked"[% END %]/>
                     [% l('Yes, by Email') %]<br/>
+                <blockquote>
+                    [% l('Email Address:') %] <span name="email_address">[% ctx.user.email %]</span>
+                </blockquote>
                 <input type="checkbox" name="phone_notify_checkbox"
                     [% IF ctx.default_phone_notify %]checked="checked"[% END %]/>
                     [% l('Yes, by Phone') %]<br/>
index 989f07c..1cb52f3 100644 (file)
@@ -62,6 +62,13 @@ function staff_hold_usr_barcode_changed(isload) {
         for(var i in update_elements) update_elements[i].value = load_info.settings['opac.default_sms_notify'];
         update_elements = document.getElementsByName('sms_carrier');
         for(var i in update_elements) update_elements[i].value = load_info.settings['opac.default_sms_carrier'];
+        update_elements = document.getElementsByName('email_notify');
+        for(var i in update_elements) {
+            update_elements[i].disabled = (load_info.user_email ? false : true);
+            if(update_elements[i].disabled) update_elements[i].checked = false;
+        }
+        update_elements = document.getElementsByName('email_address');
+        for(var i in update_elements) update_elements[i].textContent = load_info.user_email;
     }
 }
 window.onload = function() {
index c08bbe2..55a3682 100644 (file)
@@ -2624,7 +2624,7 @@ commands:
         }
         if(!settings['opac.default_phone'] && user.day_phone()) settings['opac.default_phone'] = user.day_phone();
         if(!settings['opac.hold_notify'] && settings['opac.hold_notify'] !== '') settings['opac.hold_notify'] = 'email:phone';
-        return {"barcode": barcode, "settings" : settings};
+        return {"barcode": barcode, "settings" : settings, "user_email" : user.email()};
     },
 
     'sort_menu' : function(menu, recurse) {