Clear Shelf Expired Hold on Checkin
authorThomas Berezansky <tsbere@mvlc.org>
Thu, 14 Jul 2011 20:48:56 +0000 (16:48 -0400)
committerJason Etheridge <jason@esilibrary.com>
Wed, 27 Jul 2011 20:36:33 +0000 (16:36 -0400)
Only if modifier is set and at the pickup library.

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Jason Etheridge <jason@esilibrary.com>

Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/xul/staff_client/server/circ/checkin.js
Open-ILS/xul/staff_client/server/circ/checkin_overlay.xul
Open-ILS/xul/staff_client/server/skin/circ.css

index d61f75e..41f90e2 100644 (file)
@@ -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(
         { 
index b100ca3..cab3edd 100644 (file)
@@ -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
 
index ce4252e..5be57e4 100644 (file)
 <!ENTITY staff.circ.checkin_overlay.checkin_auto_print_slips.accesskey "P">
 <!ENTITY staff.circ.checkin_overlay.checkin_modifiers_btn.label "Checkin Modifiers">
 <!ENTITY staff.circ.checkin_overlay.checkin_modifiers_btn.accesskey "M">
+<!ENTITY staff.circ.checkin_overlay.checkin_clear_shelf_expired.label "Clear Shelf-Expired Holds">
+<!ENTITY staff.circ.checkin_overlay.checkin_clear_shelf_expired.accesskey "C">
 <!ENTITY staff.circ.renew_overlay.background_text "Renew Item">
 <!ENTITY staff.circ.renew_overlay.sel_clip.label "Copy to Clipboard">
 <!ENTITY staff.circ.renew_overlay.sel_clip.accesskey "C">
index de95ecb..9241083 100644 (file)
@@ -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,
index 522a740..4ea1a74 100644 (file)
@@ -35,6 +35,7 @@
     <command id="cmd_suppress_holds_and_transits" />
     <command id="cmd_amnesty_mode" />
     <command id="cmd_checkin_auto_print_slips" />
+    <command id="cmd_checkin_clear_shelf_expired" />
 </commandset>
 
 
@@ -74,6 +75,7 @@
                 <description id="suppress_holds_and_transits_indicator" hidden="true">&staff.circ.checkin_overlay.suppress_holds_and_transits.label;</description>
                 <description id="amnesty_mode_indicator" hidden="true">&staff.circ.checkin_overlay.amnesty_mode.label;</description>
                 <description id="checkin_auto_print_slips_indicator" hidden="true">&staff.circ.checkin_overlay.checkin_auto_print_slips.label;</description>
+                <description id="checkin_clear_shelf_expired_indicator" hidden="true">&staff.circ.checkin_overlay.checkin_clear_shelf_expired.label;</description>
             </vbox>
         </vbox>
         <spacer flex="1"/>
                 label="&staff.circ.checkin_overlay.amnesty_mode.label;" accesskey="&staff.circ.checkin_overlay.amnesty_mode.accesskey;"/>
             <menuitem type="checkbox" id="checkin_auto_print_slips" oils_persist="checked" command="cmd_checkin_auto_print_slips"
                 label="&staff.circ.checkin_overlay.checkin_auto_print_slips.label;" accesskey="&staff.circ.checkin_overlay.checkin_auto_print_slips.accesskey;"/>
+            <menuitem type="checkbox" id="checkin_clear_shelf_expired" oils_persist="checked" command="cmd_checkin_clear_shelf_expired"
+                label="&staff.circ.checkin_overlay.checkin_clear_shelf_expired.label;" accesskey="&staff.circ.checkin_overlay.checkin_clear_shelf_expired.accesskey;"/>
         </menupopup>
     </button>
 </hbox>
index 7369275..049e4fb 100644 (file)
@@ -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; }