'CHECKOUT_PERMIT' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.checkout.permit' },
'CHECKOUT_RENEW' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.renew' },
'CIRC_MODIFIER_LIST' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.circ_modifier.retrieve.all' },
+ 'CLEAR_HOLD_SHELF' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.clear_shelf.process', 'secure' : false },
'FM_ACN_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.callnumber.retrieve', 'secure' : false },
'FM_ACN_RETRIEVE.authoritative' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.callnumber.retrieve.authoritative', 'secure' : false },
'FM_ACN_TREE_UPDATE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.asset.volume.fleshed.batch.update' },
'FM_AHR_ID_LIST_PULL_LIST' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold_pull_list.id_list.retrieve', 'secure' : false },
'FM_AHR_ONSHELF_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.captured_holds.on_shelf.retrieve' },
'FM_AHR_ID_LIST_ONSHELF_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.captured_holds.id_list.on_shelf.retrieve', 'secure' : false },
+ 'FM_AHR_ID_LIST_EXPIRED_ONSHELF_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.captured_holds.id_list.expired_on_shelf.retrieve', 'secure' : false },
'FM_AHR_COUNT_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.hold_requests.count', 'cacheable' : true, 'ttl' : 60000 },
'FM_AHR_COUNT_RETRIEVE.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.hold_requests.count.authoritative', 'cacheable' : true, 'ttl' : 60000 },
'FM_AHR_CANCEL' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.cancel' },
'filter_lib' : null,
+ 'expired' : false,
+ 'post_clear_shelf_hold_action_map' : {},
+
'retrieve_ids' : [],
'holds_map' : {},
'notify_count' : { 'hidden' : false },
'cancel_cause' : { 'hidden' : ! ( obj.data.hash.aous['circ.holds.canceled.display_count'] || obj.data.hash.aous['circ.holds.canceled.display_age'] ) },
'cancel_note' : { 'hidden' : ! ( obj.data.hash.aous['circ.holds.canceled.display_count'] || obj.data.hash.aous['circ.holds.canceled.display_age'] ) },
- 'cancel_time' : { 'hidden' : ! ( obj.data.hash.aous['circ.holds.canceled.display_count'] || obj.data.hash.aous['circ.holds.canceled.display_age'] ) }
+ 'cancel_time' : { 'hidden' : ! ( obj.data.hash.aous['circ.holds.canceled.display_count'] || obj.data.hash.aous['circ.holds.canceled.display_age'] ) },
+ 'post_clear_shelf_action' : { 'hidden' : obj.shelf ? false : true }
}
);
params.row_node.setAttribute('retrieve_id',
js2JSON({
'copy_id':copy_id,
- 'barcode':row.my.acp ? row.my.acp.barcode() : null,
+ 'barcode':row.my.acp ? row.my.acp.barcode() : null,
'id':row.my.ahr.id(),
'type':row.my.ahr.hold_type(),
'target':row.my.ahr.target(),
ev.target.setAttribute('checked',ev.target.checked);
}
],
+ 'cmd_view_expired_onshelf_holds' : [
+ ['command'],
+ function(ev) {
+ var x = document.getElementById('expired_checkbox'); // can't trust ev.explicitOriginalTarget, sometimes gives a "button"
+ obj.expired = x.checked;
+ obj.controller.view.cmd_clear_expired_onshelf_holds.setAttribute('disabled', !obj.expired);
+ obj.clear_and_retrieve();
+ }
+ ],
+ 'cmd_clear_expired_onshelf_holds' : [
+ ['command'],
+ function(ev) {
+ try {
+ // I could put this with the "retrieval" methods, but since it has side effects, seems cleaner to invoke it here
+ var robj = obj.network.simple_request( 'CLEAR_HOLD_SHELF', [ ses(), obj.filter_lib || obj.data.list.au[0].ws_ou() ] );
+ if (robj == null) { robj = []; }
+ if (typeof robj.ilsevent != 'undefined') { throw(robj); }
+ if (typeof robj.length == 'undefined') { robj = [ robj ]; }
+
+ // Disable anything such as filters that can have us accidentally lose these non-repeatable results
+ var x_lib_filter_checkbox = document.getElementById('lib_filter_checkbox');
+ if (x_lib_filter_checkbox) { x_lib_filter_checkbox.checked = false; }
+ var x_lib_type_menu = document.getElementById('lib_type_menu');
+ if (x_lib_type_menu) { x_lib_type_menu.disabled = true; }
+ var x_lib_menu_placeholder = document.getElementById('lib_menu_placeholder');
+ if (x_lib_menu_placeholder) { x_lib_menu_placeholder.firstChild.disabled = true; }
+ obj.controller.view.cmd_view_expired_onshelf_holds.setAttribute('disabled', 'true');
+ obj.controller.view.cmd_clear_expired_onshelf_holds.setAttribute('disabled', 'true');
+
+ // id's in xulG.holds will prevent the normal retrieval method from firing
+ JSAN.use('util.functional');
+ xulG.holds = util.functional.map_list(
+ robj.sort(function(a,b) {
+ if (a.action > b.action) { return 1; }
+ if (a.action < b.action) { return -1; }
+ return 0;
+ }),
+ function (element, idx) {
+ obj.post_clear_shelf_hold_action_map[ element.hold_id ] = element.action; // necessary side-effect
+ return element.hold_id;
+ }
+ );
+ obj.clear_and_retrieve();
+ } catch(E) {
+ if (E.ilsevent == 5000 /* PERM_FAILURE */ ) { return; /* handled by network.js */ }
+ obj.error.standard_unexpected_error_alert('Error in holds.js, cmd_clear_expired_onshelf_holds', E);
+ }
+ }
+ ],
+
'cmd_search_opac' : [
['command'],
function(ev) {
var x_lib_menu_placeholder = document.getElementById('lib_menu_placeholder');
var x_lib_filter_checkbox = document.getElementById('lib_filter_checkbox');
var x_show_cancelled_deck = document.getElementById('show_cancelled_deck');
+ var x_clear_shelf_widgets = document.getElementById('clear_shelf_widgets');
+ var x_expired_checkbox = document.getElementById('expired_checkbox');
switch(obj.hold_interface_type) {
case 'shelf':
obj.render_lib_menus({'pickup_lib':true});
if (x_lib_filter_checkbox) x_lib_filter_checkbox.checked = true;
if (x_lib_type_menu) x_lib_type_menu.hidden = false;
if (x_lib_menu_placeholder) x_lib_menu_placeholder.hidden = false;
+ if (x_clear_shelf_widgets) x_clear_shelf_widgets.hidden = false;
break;
case 'pull' :
if (x_fetch_more) x_fetch_more.hidden = false;
obj.controller.view.cmd_retrieve_patron.setAttribute('hidden','false');
break;
case 'shelf' :
- method = 'FM_AHR_ID_LIST_ONSHELF_RETRIEVE';
+ if (obj.expired) {
+ method = 'FM_AHR_ID_LIST_EXPIRED_ONSHELF_RETRIEVE';
+ } else {
+ method = 'FM_AHR_ID_LIST_ONSHELF_RETRIEVE';
+ }
params.push( obj.filter_lib || obj.data.list.au[0].ws_ou() );
obj.controller.view.cmd_retrieve_patron.setAttribute('hidden','false');
break;
{
'row' : {
'my' : {
- 'hold_id' : hold_id
+ 'hold_id' : hold_id,
+ 'post_clear_shelf_action' : obj.post_clear_shelf_hold_action_map[ hold_id ]
}
}
}
<command id="cmd_alt_view" />
<command id="cmd_cancelled_holds_view" />
<command id="cmd_uncancelled_holds_view" />
+ <command id="cmd_view_expired_onshelf_holds"
+ label="&staff.circ.holds.view_expired_onshelf_holds.label;"
+ accesskey="&staff.circ.holds.view_expired_onshelf_holds.accesskey;" />
+ <command id="cmd_clear_expired_onshelf_holds" disabled="true"
+ label="&staff.circ.holds.clear_expired_onshelf_holds.label;"
+ accesskey="&staff.circ.holds.clear_expired_onshelf_holds.accesskey;" />
</commandset>
<popupset id="holds_popupset">
</menupopup>
</menulist>
<vbox id="lib_menu_placeholder" hidden="true"/>
+ <hbox id="clear_shelf_widgets" hidden="true">
+ <checkbox id="expired_checkbox" command="cmd_view_expired_onshelf_holds" />
+ <button id="clear_expired_btn" command="cmd_clear_expired_onshelf_holds" />
+ </hbox>
<deck id="show_cancelled_deck" hidden="true">
<button command="cmd_cancelled_holds_view" label="&staff.patron.holds_overlay.show_cancelled_holds.label;" accesskey="&staff.patron.holds_overlay.show_cancelled_holds.accesskey;"/>
<button command="cmd_uncancelled_holds_view" label="&staff.patron.holds_overlay.show_uncancelled_holds.label;" accesskey="&staff.patron.holds_overlay.show_uncancelled_holds.accesskey;"/>