From b269c7ea26fda42693bf7cdab8fcd9d3b9956bd6 Mon Sep 17 00:00:00 2001 From: Thomas Berezansky Date: Thu, 14 Jul 2011 16:48:56 -0400 Subject: [PATCH] Clear Shelf Expired Hold on Checkin Only if modifier is set and at the pickup library. Signed-off-by: Thomas Berezansky Signed-off-by: Jason Etheridge --- .../lib/OpenILS/Application/Circ/Circulate.pm | 5 +++++ .../perlmods/lib/OpenILS/Application/Circ/Holds.pm | 9 ++++++--- Open-ILS/web/opac/locale/en-US/lang.dtd | 2 ++ Open-ILS/xul/staff_client/server/circ/checkin.js | 14 ++++++++++++++ .../staff_client/server/circ/checkin_overlay.xul | 4 ++++ Open-ILS/xul/staff_client/server/skin/circ.css | 2 ++ 6 files changed, 33 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm index d61f75e3c0..41f90e2dd3 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm @@ -535,6 +535,7 @@ my @AUTOLOAD_FIELDS = qw/ skip_rental_fee use_booking generate_lost_overdue + clear_expired /; @@ -2606,6 +2607,10 @@ sub checkin_check_holds_shelf { $U->copy_status($self->copy->status)->id == OILS_COPY_STATUS_ON_HOLDS_SHELF; + # Attempt to clear shelf expired holds for this copy + $holdcode->method_lookup('open-ils.circ.hold.clear_shelf.process')->run($self->editor->authtoken, $self->circ_lib, $self->copy->id) + if($self->clear_expired); + # find the hold that put us on the holds shelf my $holds = $self->editor->search_action_hold_request( { diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm index b100ca3e99..cab3edda8b 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm @@ -3227,7 +3227,10 @@ __PACKAGE__->register_method( ); sub clear_shelf_process { - my($self, $client, $auth, $org_id) = @_; + my($self, $client, $auth, $org_id, $match_copy) = @_; + + my $current_copy = { '!=' => undef }; + $current_copy = { '=' => $match_copy } if $match_copy; my $e = new_editor(authtoken=>$auth, xact => 1); $e->checkauth or return $e->die_event; @@ -3246,7 +3249,7 @@ sub clear_shelf_process { fulfillment_time => undef, shelf_time => {'!=' => undef}, capture_time => {'!=' => undef}, - current_copy => {'!=' => undef}, + current_copy => $current_copy, }, { idlist => 1 } ); @@ -3297,7 +3300,7 @@ sub clear_shelf_process { my $copy = $hold->current_copy; my ($alt_hold) = __PACKAGE__->find_nearest_permitted_hold($e, $copy, $e->requestor, 1); - if($alt_hold) { + if($alt_hold and !$match_copy) { push(@{$cache_data{hold}}, $hold->id); # copy is needed for a hold diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index ce4252eb3a..5be57e4a89 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -2215,6 +2215,8 @@ + + diff --git a/Open-ILS/xul/staff_client/server/circ/checkin.js b/Open-ILS/xul/staff_client/server/circ/checkin.js index de95ecb32a..9241083806 100644 --- a/Open-ILS/xul/staff_client/server/circ/checkin.js +++ b/Open-ILS/xul/staff_client/server/circ/checkin.js @@ -407,6 +407,17 @@ circ.checkin.prototype = { ind.hidden = cb.getAttribute('checked') != 'true'; document.getElementById('checkin_barcode_entry_textbox').focus(); return true; + } ], + 'cmd_checkin_clear_shelf_expired' : [ ['command'], function(ev) { + dump('in cmd_checkin_clear_shelf_expired\n'); + var bg = document.getElementById('background'); + var cb = document.getElementById('checkin_clear_shelf_expired'); + var ind = document.getElementById('checkin_clear_shelf_expired_indicator'); + var cn = 'checkin_screen_checkin_clear_shelf_expired'; + if (cb.getAttribute('checked') == 'true') { addCSSClass(bg,cn); } else { removeCSSClass(bg,cn); } + ind.hidden = cb.getAttribute('checked') != 'true'; + document.getElementById('checkin_barcode_entry_textbox').focus(); + return true; } ] } } @@ -566,6 +577,9 @@ circ.checkin.prototype = { var amnesty_mode = document.getElementById('amnesty_mode'); if (amnesty_mode) amnesty_mode = amnesty_mode.getAttribute('checked') == 'true'; if (amnesty_mode) params.void_overdues = 1; + var clear_shelf_expired_holds = document.getElementById('checkin_clear_shelf_expired'); + if (clear_shelf_expired_holds) clear_shelf_expired_holds = clear_shelf_expired_holds.getAttribute('checked') == 'true'; + if (clear_shelf_expired_holds) params.clear_expired = 1; circ.util.checkin_via_barcode( ses(), params, diff --git a/Open-ILS/xul/staff_client/server/circ/checkin_overlay.xul b/Open-ILS/xul/staff_client/server/circ/checkin_overlay.xul index 522a740a1d..4ea1a74c6b 100644 --- a/Open-ILS/xul/staff_client/server/circ/checkin_overlay.xul +++ b/Open-ILS/xul/staff_client/server/circ/checkin_overlay.xul @@ -35,6 +35,7 @@ + @@ -74,6 +75,7 @@ + @@ -173,6 +175,8 @@ label="&staff.circ.checkin_overlay.amnesty_mode.label;" accesskey="&staff.circ.checkin_overlay.amnesty_mode.accesskey;"/> + diff --git a/Open-ILS/xul/staff_client/server/skin/circ.css b/Open-ILS/xul/staff_client/server/skin/circ.css index 7369275e50..049e4fbe55 100644 --- a/Open-ILS/xul/staff_client/server/skin/circ.css +++ b/Open-ILS/xul/staff_client/server/skin/circ.css @@ -45,12 +45,14 @@ treechildren::-moz-tree-row(backdate_failed,selected) { .checkin_screen_suppress_holds_and_transits { } .checkin_screen_amnesty_mode { } .checkin_screen_checkin_auto_print_slips { } +.checkin_screen_checkin_clear_shelf_expired { } #background-text { font-size: x-large; font-weight: bold; } #do_not_alert_on_precat_indicator { background-color: -moz-dialog; color: -moz-dialog-text; font-size: large; font-weight: bold; } #suppress_holds_and_transits_indicator { background-color: -moz-dialog; color: -moz-dialog-text; font-size: large; font-weight: bold; } #amnesty_mode_indicator { border: thick solid white; background-color: red; color: white; font-size: large; font-weight: bold; padding: 10px; padding-bottom: 25px; margin: 10px; } #checkin_auto_print_slips_indicator { background-color: -moz-dialog; color: -moz-dialog-text; font-size: large; font-weight: bold; } +#checkin_clear_shelf_expired_indicator { background-color: -moz-dialog; color: -moz-dialog-text; font-size: large; font-weight: bold; } .big_emphasis1 { font-weight: bold; font-size: x-large; } .big_emphasis2 { font-weight: bold; font-size: large; } -- 2.43.2