CAT-72 Claims return dialog sanity checks
authorBill Erickson <berickxx@gmail.com>
Mon, 5 Dec 2016 19:06:57 +0000 (14:06 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Avoid the following error when editing hold shelf expire time:

timestamp.js, handle_apply(): TypeError:
    document.getElementById("newRadio1") is null

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/xul/staff_client/chrome/content/util/timestamp.js

index 408f94b..4ae7232 100644 (file)
@@ -135,7 +135,11 @@ function gen_handle_apply(params) {
 
                 var dp = $('datepicker');
                 var tp = $('timepicker');
-                var radio1On = document.getElementById("newRadio1").getAttribute("selected");
+
+                // newRadio1 is not always present in the DOM.
+                var radioDom = document.getElementById("newRadio1");
+                var radio1On = 
+                    radioDom ? radioDom.getAttribute("selected") : false;
 
                 var check = check_date( dp.value );
                 if ( ! check.allowed ) { alert( check.reason ); $('apply_btn').disabled = true; return; }