return true;
}
function staff_hold_usr_barcode_changed(isload) {
+
+ if (!document.getElementById('place_hold_submit')) {
+ // in some cases, the submit button is not present.
+ // exit early to avoid needless JS errors
+ return;
+ }
+
if(typeof xulG != 'undefined' && xulG.get_barcode_and_settings) {
var cur_hold_barcode = undefined;
var barcode = isload;
// barcode if clicked. This is needed when the patron barcode
// is manually entered (i.e. the staff client does not provide one).
var adv_link = document.getElementById('advanced_hold_link');
- var href = adv_link.getAttribute('href').replace(
- /;staff_barcode=[^;\&]+|$/,
- ';staff_barcode=' + encodeURIComponent(cur_hold_barcode));
- adv_link.setAttribute('href', href);
+ if (adv_link) { // not present on MR hold pages
+ var href = adv_link.getAttribute('href').replace(
+ /;staff_barcode=[^;\&]+|$/,
+ ';staff_barcode=' + encodeURIComponent(cur_hold_barcode));
+ adv_link.setAttribute('href', href);
+ }
// Ok, now we can allow submitting again, unless this is a "true" load, in which case we likely have a blank barcode box active
if (isload !== true)