LP#1939426 Traditional Catalog Holds: Patron Info Not Populating
authorDan Briem <dbriem@wlsmail.org>
Sat, 20 Nov 2021 20:14:36 +0000 (15:14 -0500)
committerMike Rylander <mrylander@gmail.com>
Tue, 15 Mar 2022 16:20:46 +0000 (12:20 -0400)
When no hold groups exist, its interface isn't present. When
placing volume holds, the advanced link isn't present.

This checks that those elements exist before accessing their
attributes and adds a missing name attribute to the Bootstrap
catalog to display the email address.

Signed-off-by: Dan Briem <dbriem@wlsmail.org>
Signed-off-by: Michele Morgan <mmorgan@noblenet.org>
Signed-off-by: Mike Rylander <mrylander@gmail.com>

Open-ILS/src/templates-bootstrap/opac/parts/place_hold.tt2
Open-ILS/web/js/ui/default/opac/staff.js

index b4dc99b..7af5d42 100755 (executable)
@@ -242,7 +242,7 @@ function maybeToggleNumCopies(obj) {
                 <label class="form-check-label" for="email_notify">
                    [% l('Yes, by Email') %]
 
-                     [% IF !ctx.user.email and !ctx.is_staff; l('<br>No configured Email address. See "My Account" for setting your Email address.'); ELSE; %] : <span id="email_address"><b>[% ctx.user.email %]</b></span>[% END %]
+                     [% IF !ctx.user.email and !ctx.is_staff; l('<br>No configured Email address. See "My Account" for setting your Email address.'); ELSE; %] : <span id="email_address"><b name="email_address">[% ctx.user.email %]</b></span>[% END %]
                 </label>
             </div>
 
index f0679df..f54127b 100644 (file)
@@ -57,10 +57,12 @@ function no_hold_submit(event) {
 function toggleMROptions(on) {
     var anchor = document.getElementById("advanced_hold_link");
     // Check for not equal to block so it works on first click.
-    if (on) {
-        anchor.style.display = "inline";
-    } else {
-        anchor.style.display = "none";
+    if (anchor) {
+        if (on) {
+            anchor.style.display = "inline";
+        } else {
+            anchor.style.display = "none";
+        }
     }
 }
 
@@ -91,13 +93,14 @@ function staff_hold_usr_barcode_changed(isload) {
 
     if (!window.xulG) return;
  
+    var sub_el = document.getElementById('hold_usr_is_subscription');
     var adv_link = document.getElementById('advanced_hold_link');
     if (adv_link) {
         adv_link.setAttribute('href', adv_link.getAttribute('href').replace(/&?is_requestor=[012]/,''));
         var is_requestor = 0;
         if (document.getElementById('hold_usr_is_requestor').checked) {
             is_requestor = 1;
-        } else if (document.getElementById('hold_usr_is_subscription').checked) {
+        } else if (sub_el && sub_el.checked) {
             is_requestor = 2;
         }
         adv_link.setAttribute('href', adv_link.getAttribute('href') + '&is_requestor=' + is_requestor.toString());
@@ -107,7 +110,6 @@ function staff_hold_usr_barcode_changed(isload) {
     var barcode = isload;
     if(!barcode || barcode === true) barcode = document.getElementById('staff_barcode').value;
     var only_settings = true;
-    var sub_el = document.getElementById('hold_usr_is_subscription');
 
     toggleOnSubscription(false);
     if(sub_el && sub_el.checked) {
@@ -252,7 +254,10 @@ window.onload = function() {
             var is_req = is_req_match.exec(loc).toString();
             is_req = is_req.replace(/is_requestor=/, '');
             if (is_req == "2") {
-                document.getElementById('hold_usr_is_subscription').checked = 'checked';
+                var sub_el = document.getElementById('hold_usr_is_subscription');
+                if (sub_el) {
+                    sub_el.checked = 'checked';
+                }
                 document.getElementById('hold_usr_input').disabled = true;
             } else if (is_req == "1") {
                 document.getElementById('hold_usr_is_requestor').checked = 'checked';