<label for="hold_usr_is_requestor_not">
[% l("Place hold for patron by barcode:") %]
</label>
- <input type="text" name="hold_usr" id="hold_usr_input" onchange="staff_hold_usr_barcode_changed();" onkeypress="return no_hold_submit(event)" /><br />
+ <input type="text" name="hold_usr" id="hold_usr_input" onchange="staff_hold_usr_barcode_changed();" onkeypress="return no_hold_submit(event)" /> <span id="patron_name"></span><br />
<input type="hidden" id="staff_barcode" value="[% ctx.staff_recipient.card.barcode | html %]"/>
<span>
<input type="radio" id="hold_usr_is_requestor"
[% END %]
</blockquote>
</p>
- <input type="submit" name="submit" value="[% l('Submit') %]" title="[% l('Submit') %]"
+ <input id="place_hold_submit" type="submit" name="submit" value="[% l('Submit') %]" title="[% l('Submit') %]"
alt="[% l('Submit') %]" class="opac-button" />
<input type="reset" name="cancel" onclick="javascript:history.go(-1);"
if(barcode && barcode != '' && !document.getElementById('hold_usr_is_requestor_not').checked)
document.getElementById('hold_usr_is_requestor_not').checked = 'checked';
}
- if(barcode == undefined || barcode == '' || barcode == cur_hold_barcode)
+ if(barcode == undefined || barcode == '') {
+ document.getElementById('patron_name').innerHTML = '';
return;
+ }
+ if(barcode == cur_hold_barcode)
+ return;
+ // No submitting until we think the barcode is valid
+ document.getElementById('place_hold_submit').disabled = true;
var load_info = xulG.get_barcode_and_settings(window, barcode, only_settings);
- if(load_info == false || load_info == undefined)
+ if(load_info == false || load_info == undefined) {
+ document.getElementById('patron_name').innerHTML = '';
return;
+ }
cur_hold_barcode = load_info.barcode;
if(!only_settings || (isload && isload !== true)) document.getElementById('hold_usr_input').value = load_info.barcode; // Safe at this point as we already set cur_hold_barcode
if(load_info.settings['opac.default_pickup_location'])
}
update_elements = document.getElementsByName('email_address');
for(var i in update_elements) update_elements[i].textContent = load_info.user_email;
+ if(!document.getElementById('hold_usr_is_requestor').checked && !only_settings) {
+ document.getElementById('patron_name').innerHTML = load_info.patron_name;
+ }
+ // Ok, now we can allow submitting again
+ document.getElementById('place_hold_submit').disabled = false;
}
}
window.onload = function() {
}
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, "user_email" : user.email()};
+ // Taken from patron/util.js format_name
+ var patron_name = ( user.prefix() ? user.prefix() + ' ' : '') +
+ user.family_name() + ', ' +
+ user.first_given_name() + ' ' +
+ ( user.second_given_name() ? user.second_given_name() + ' ' : '' ) +
+ ( user.suffix() ? user.suffix() : '');
+ return {"barcode": barcode, "settings" : settings, "user_email" : user.email(), "patron_name" : patron_name};
},
'sort_menu' : function(menu, recurse) {