[open-ils-commits] [GIT] Evergreen ILS branch master updated. 2b64c85a9979cd6743f7a03504ae8c580b8f4445

Evergreen Git git at git.evergreen-ils.org
Wed Jul 27 16:23:43 EDT 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  2b64c85a9979cd6743f7a03504ae8c580b8f4445 (commit)
       via  35178764ca1fc824bcb670be65d15bd7a930abf0 (commit)
       via  17b59ca81aa55dfc30faba285c55794e1e9a91f1 (commit)
       via  b269c7ea26fda42693bf7cdab8fcd9d3b9956bd6 (commit)
      from  93d5b4e7ddf2e4f70f29ee495e3d499696c2dcea (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 2b64c85a9979cd6743f7a03504ae8c580b8f4445
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Thu Jul 14 16:49:14 2011 -0400

    SIP2 support for checkin local holds as transits
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>

diff --git a/Open-ILS/examples/oils_sip.xml.example b/Open-ILS/examples/oils_sip.xml.example
index 8adecf8..fa1e19d 100644
--- a/Open-ILS/examples/oils_sip.xml.example
+++ b/Open-ILS/examples/oils_sip.xml.example
@@ -118,6 +118,11 @@
                     <event>COPY_ALERT_MESSAGE</event>
                 </checkout_override>
 
+                <!-- If uncommented, SIP2 checkins will capture local holds as transits, instead of marking as ready for pickup. -->
+                <!--
+                <checkin_hold_as_transit>1</checkin_hold_as_transit>
+                -->
+
                 <!-- If uncommented, overrides the legacy_script_support value in opensrf.xml for SIP. -->
                 <!--
                 <legacy_script_support>false</legacy_script_support>
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/Checkin.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/Checkin.pm
index 42a689c..cee4fc5 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/Checkin.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/Checkin.pm
@@ -29,6 +29,8 @@ my %fields = (
 #   hold             => undef,
 );
 
+my $hold_as_transit = 0;
+
 sub new {
     my $class = shift;;
     my $self = $class->SUPER::new(@_);              # start with an Transaction object
@@ -41,6 +43,8 @@ sub new {
 
     $self->load_override_events;
 
+    $hold_as_transit = OpenILS::SIP->config->{implementation_config}->{checkin_hold_as_transit};
+
     return bless $self, $class;
 }
 
@@ -77,6 +81,7 @@ sub do_checkin {
     my $phys_location = $sip_handler->{login_session}->ws_ou;
 
     my $args = {barcode => $self->{item}->id};
+    $args->{hold_as_transit} = 1 if $hold_as_transit;
 
     if($return_date) {
         # SIP date format is YYYYMMDD.  Translate to ISO8601

commit 35178764ca1fc824bcb670be65d15bd7a930abf0
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Thu Jul 14 16:49:08 2011 -0400

    Capture local holds as transits checkin modifier
    
    Capture holds (not already on hold shelf) as transits instead.
    
    Use cases may include:
    
    New material being cataloged before it is "released". If captured normally
    before release the shelf expire time would start ticking and notices would go
    out.
    
    Checking items in on a closed day. Can capture holds to avoid them being on a
    pull list and set them aside to avoid "ready for pickup" notices and ticking
    shelf expire clock.
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>

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 dd114b1..b569ffd 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
@@ -537,6 +537,7 @@ my @AUTOLOAD_FIELDS = qw/
     generate_lost_overdue
     clear_expired
     retarget_mode
+    hold_as_transit
 /;
 
 
@@ -2286,6 +2287,9 @@ sub check_transit_checkin_interval {
         )->[0]
     ); 
 
+    # transit from X to X for whatever reason has no min interval
+    return if $self->transit->source == $self->transit->dest;
+
     my $seconds = OpenSRF::Utils->interval_to_seconds($interval);
     my $t_start = DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($self->transit->source_send_time));
     my $horizon = $t_start->add(seconds => $seconds);
@@ -2539,7 +2543,7 @@ sub do_checkin {
     
             $logger->debug("circulator: circlib=$circ_lib, workstation=".$self->circ_lib);
     
-            if( $circ_lib == $self->circ_lib) {
+            if( $circ_lib == $self->circ_lib and not ($self->hold_as_transit and $self->remote_hold) ) {
                 # copy is where it needs to be, either for hold or reshelving
     
                 $self->checkin_handle_precat();
@@ -2701,7 +2705,7 @@ sub checkin_check_holds_shelf {
     $logger->info("circulator: we found a captured, un-fulfilled hold [".
         $hold->id. "] for copy ".$self->copy->barcode);
 
-    if( $hold->pickup_lib == $self->circ_lib ) {
+    if( $hold->pickup_lib == $self->circ_lib and not $self->hold_as_transit ) {
         $logger->info("circulator: hold is for here .. we're done: ".$self->copy->barcode);
         return 1;
     }
@@ -2841,7 +2845,7 @@ sub attempt_checkin_hold_capture {
 
     return 0 if $self->bail_out;
 
-    if( $hold->pickup_lib == $self->circ_lib ) {
+    if( $hold->pickup_lib == $self->circ_lib && not $self->hold_as_transit ) {
 
         # This hold was captured in the correct location
         $copy->status(OILS_COPY_STATUS_ON_HOLDS_SHELF);
@@ -3009,8 +3013,9 @@ sub process_received_transit {
 
     my $transit = $self->transit;
 
-    if( $transit->dest != $self->circ_lib ) {
+    if( $transit->dest != $self->circ_lib or ($self->hold_as_transit && $transit->copy_status == OILS_COPY_STATUS_ON_HOLDS_SHELF) ) {
         # - this item is in-transit to a different location
+        # - Or we are capturing holds as transits, so why create a new transit?
 
         my $tid = $transit->id; 
         my $loc = $self->circ_lib;
diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd
index 822311f..f9549b8 100644
--- a/Open-ILS/web/opac/locale/en-US/lang.dtd
+++ b/Open-ILS/web/opac/locale/en-US/lang.dtd
@@ -2222,6 +2222,8 @@
 <!ENTITY staff.circ.checkin_overlay.checkin_auto_retarget_all.label "Retarget All Statuses">
 <!ENTITY staff.circ.checkin_overlay.checkin_auto_retarget_all.accesskey "e">
 <!ENTITY staff.circ.checkin_overlay.checkin_auto_retarget_all_ind.label "Always Retarget Local Holds">
+<!ENTITY staff.circ.checkin_overlay.checkin_local_hold_as_transit.label "Capture Local Holds as Transits">
+<!ENTITY staff.circ.checkin_overlay.checkin_local_hold_as_transit.accesskey "L">
 <!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">
diff --git a/Open-ILS/xul/staff_client/server/circ/checkin.js b/Open-ILS/xul/staff_client/server/circ/checkin.js
index 6984150..d967d5a 100644
--- a/Open-ILS/xul/staff_client/server/circ/checkin.js
+++ b/Open-ILS/xul/staff_client/server/circ/checkin.js
@@ -448,6 +448,18 @@ circ.checkin.prototype = {
                         }
                         document.getElementById('checkin_barcode_entry_textbox').focus();
                         return true;
+                    } ],
+                    'cmd_checkin_local_hold_as_transit' : [ ['command'], function(ev) {
+                        dump('in cmd_checkin_local_hold_as_transit\n');
+                        var bg = document.getElementById('background');
+                        var cb = document.getElementById('checkin_local_hold_as_transit');
+                        var ind = document.getElementById('checkin_local_hold_as_transit_indicator');
+                        var cn = 'checkin_screen_checkin_local_hold_as_transit';
+                        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;
+
                     } ]
                 }
             }
@@ -618,6 +630,9 @@ circ.checkin.prototype = {
                 if (retarget_all) params.retarget_mode = 'retarget.all';
                 else params.retarget_mode = 'retarget';
             }
+            var hold_as_transit = document.getElementById('checkin_local_hold_as_transit');
+            if (hold_as_transit) hold_as_transit = hold_as_transit.getAttribute('checked') == 'true';
+            if (hold_as_transit) params.hold_as_transit = 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 18dff0e..f72fcff 100644
--- a/Open-ILS/xul/staff_client/server/circ/checkin_overlay.xul
+++ b/Open-ILS/xul/staff_client/server/circ/checkin_overlay.xul
@@ -37,6 +37,7 @@
     <command id="cmd_checkin_auto_print_slips" />
     <command id="cmd_checkin_clear_shelf_expired" />
     <command id="cmd_checkin_auto_retarget" />
+    <command id="cmd_checkin_local_hold_as_transit" />
 </commandset>
 
 
@@ -79,6 +80,7 @@
                 <description id="checkin_clear_shelf_expired_indicator" hidden="true">&staff.circ.checkin_overlay.checkin_clear_shelf_expired.label;</description>
                 <description id="checkin_auto_retarget_indicator" hidden="true">&staff.circ.checkin_overlay.checkin_auto_retarget.label;</description>
                 <description id="checkin_auto_retarget_all_indicator" hidden="true">&staff.circ.checkin_overlay.checkin_auto_retarget_all_ind.label;</description>
+                <description id="checkin_local_hold_as_transit_indicator" hidden="true">&staff.circ.checkin_overlay.checkin_local_hold_as_transit.label;</description>
             </vbox>
         </vbox>
         <spacer flex="1"/>
@@ -184,6 +186,8 @@
                 label="&staff.circ.checkin_overlay.checkin_auto_retarget.label;" accesskey="&staff.circ.checkin_overlay.checkin_auto_retarget.accesskey;"/>
             <menuitem type="checkbox" id="checkin_auto_retarget_all" oils_persist="checked" command="cmd_checkin_auto_retarget"
                 label="&staff.circ.checkin_overlay.checkin_auto_retarget_all.label;" accesskey="&staff.circ.checkin_overlay.checkin_auto_retarget_all.accesskey;"/>
+            <menuitem type="checkbox" id="checkin_local_hold_as_transit" oils_persist="checked" command="cmd_checkin_local_hold_as_transit"
+                label="&staff.circ.checkin_overlay.checkin_local_hold_as_transit.label;" accesskey="&staff.circ.checkin_overlay.checkin_local_hold_as_transit;"/>
         </menupopup>
     </button>
 </hbox>
diff --git a/Open-ILS/xul/staff_client/server/skin/circ.css b/Open-ILS/xul/staff_client/server/skin/circ.css
index d73071f..3472515 100644
--- a/Open-ILS/xul/staff_client/server/skin/circ.css
+++ b/Open-ILS/xul/staff_client/server/skin/circ.css
@@ -48,6 +48,7 @@ treechildren::-moz-tree-row(backdate_failed,selected) {
 .checkin_screen_checkin_clear_shelf_expired { }
 .checkin_screen_checkin_auto_retarget { }
 .checkin_screen_checkin_auto_retarget_all { }
+.checkin_screen_checkin_local_hold_as_transit { }
 
 #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; }
@@ -57,6 +58,7 @@ treechildren::-moz-tree-row(backdate_failed,selected) {
 #checkin_clear_shelf_expired_indicator { background-color: -moz-dialog; color: -moz-dialog-text; font-size: large; font-weight: bold; }
 #checkin_auto_retarget_indicator { background-color: -moz-dialog; color: -moz-dialog-text; font-size: large; font-weight: bold; }
 #checkin_auto_retarget_all_indicator { background-color: -moz-dialog; color: -moz-dialog-text; font-size: large; font-weight: bold; }
+#checkin_local_hold_as_transit_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; }

commit 17b59ca81aa55dfc30faba285c55794e1e9a91f1
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Thu Jul 14 16:49:05 2011 -0400

    Auto-retarget local holds on "new" copy checkin
    
    When a new item is checked in local holds will be searched and re-targeted.
    
    The search and retarget stops when a hold is found locally that the item can fill.
    
    Already-captured holds will not be retargeted.
    
    "New" is (currently) defined as "In progress" at checkin
    
    Retarget occurs:
    Only if the copy's circ library is the checkin library
    Only if the checkin is an actual checkin (not a renewal)
    Only if the checkin is capturing holds and transits
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>

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 41f90e2..dd114b1 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
@@ -536,6 +536,7 @@ my @AUTOLOAD_FIELDS = qw/
     use_booking
     generate_lost_overdue
     clear_expired
+    retarget_mode
 /;
 
 
@@ -2294,6 +2295,73 @@ sub check_transit_checkin_interval {
         if $horizon > DateTime->now;
 }
 
+# Retarget local holds at checkin
+sub checkin_retarget {
+    my $self = shift;
+    return unless $self->retarget_mode =~ m/retarget/; # Retargeting?
+    return unless $self->is_checkin; # Renewals need not be checked
+    return if $self->capture eq 'nocapture'; # Not capturing holds anyway? Move on.
+    return if $self->is_precat; # No holds for precats
+    return unless $self->circ_lib == $self->copy->circ_lib; # Item isn't "home"? Don't check.
+    return unless $self->copy->holdable; # Not holdable, shouldn't capture holds.
+    # Specifically target items that are likely new (by status ID)
+    unless ($self->retarget_mode =~ m/\.all/) {
+        my $status = $U->copy_status($self->copy->status)->id;
+        return unless $status == OILS_COPY_STATUS_IN_PROCESS;
+    }
+
+    # Fetch holds for the bib
+    my ($result) = $holdcode->method_lookup('open-ils.circ.holds.retrieve_all_from_title')->run(
+                    $self->editor->authtoken,
+                    $self->title->id,
+                    {
+                        capture_time => undef, # No touching captured holds
+                        frozen => 'f', # Don't bother with frozen holds
+                        pickup_lib => $self->circ_lib # Only holds actually here
+                    }); 
+
+    # Error? Skip the step.
+    return if exists $result->{"ilsevent"};
+
+    # Assemble holds
+    my $holds = [];
+    foreach my $holdlist (keys %{$result}) {
+        push @$holds, @{$result->{$holdlist}};
+    }
+
+    return if scalar(@$holds) == 0; # No holds, no retargeting
+
+    # Loop over holds in request-ish order
+    # Stage 1: Get them into request-ish order
+    # Also grab type and target for skipping low hanging ones
+    $result = $self->editor->json_query({
+        "select" => { "ahr" => ["id", "hold_type", "target"] },
+        "from" => { "ahr" => { "au" => { "fkey" => "usr",  "join" => "pgt"} } },
+        "where" => { "id" => $holds },
+        "order_by" => [
+            { "class" => "pgt", "field" => "hold_priority"},
+            { "class" => "ahr", "field" => "cut_in_line", "direction" => "desc", "transform" => "coalesce", "params" => ['f']},
+            { "class" => "ahr", "field" => "selection_depth", "direction" => "desc"},
+            { "class" => "ahr", "field" => "request_time"}
+        ]
+    });
+
+    # Stage 2: Loop!
+    if (ref $result eq "ARRAY" and scalar @$result) {
+        foreach (@{$result}) {
+            # Copy level, but not this copy?
+            next if ($_->{hold_type} eq 'C' or $_->{hold_type} eq 'R' or $_->{hold_type} eq 'F'
+                and $_->{target} != $self->copy->id);
+            # Volume level, but not this volume?
+            next if ($_->{hold_type} eq 'V' and $_->{target} != $self->volume->id);
+            # So much for easy stuff, attempt a retarget!
+            my $tresult = $U->storagereq('open-ils.storage.action.hold_request.copy_targeter', undef, $_->{id}, $self->copy->id);
+            if(ref $tresult eq "ARRAY" and scalar @$tresult) {
+                last if(exists $tresult->[0]->{found_copy} and $tresult->[0]->{found_copy});
+            }
+        }
+    }
+}
 
 sub do_checkin {
     my $self = shift;
@@ -2304,6 +2372,7 @@ sub do_checkin {
         unless $self->copy;
 
     $self->check_transit_checkin_interval;
+    $self->checkin_retarget;
 
     # the renew code and mk_env should have already found our circulation object
     unless( $self->circ ) {
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
index 23717a7..d54575d 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
@@ -1042,6 +1042,7 @@ sub new_hold_copy_targeter {
 	my $client = shift;
 	my $check_expire = shift;
 	my $one_hold = shift;
+    my $find_copy = shift;
 
 	local $OpenILS::Application::Storage::WRITE = 1;
 
@@ -1288,6 +1289,8 @@ sub new_hold_copy_targeter {
 			}
 
 			my $copy_count = @$all_copies;
+            my $found_copy = undef;
+            $found_copy = 1 if($find_copy and grep $_ == $find_copy, @$all_copies);
 
 			# map the potentials, so that we can pick up checkins
 			# XXX Loop-based targeting may require that /only/ copies from this loop should be added to
@@ -1489,7 +1492,8 @@ sub new_hold_copy_targeter {
 				{ hold => $hold->id,
 				  old_target => ($old_best ? $old_best->id : undef),
 				  eligible_copies => $copy_count,
-				  target => ($best ? $best->id : undef) };
+				  target => ($best ? $best->id : undef),
+                  found_copy => $found_copy };
 
 		} otherwise {
 			my $e = shift;
diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd
index 5be57e4..822311f 100644
--- a/Open-ILS/web/opac/locale/en-US/lang.dtd
+++ b/Open-ILS/web/opac/locale/en-US/lang.dtd
@@ -2217,6 +2217,11 @@
 <!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.checkin_overlay.checkin_auto_retarget.label "Retarget Local Holds">
+<!ENTITY staff.circ.checkin_overlay.checkin_auto_retarget.accesskey "R">
+<!ENTITY staff.circ.checkin_overlay.checkin_auto_retarget_all.label "Retarget All Statuses">
+<!ENTITY staff.circ.checkin_overlay.checkin_auto_retarget_all.accesskey "e">
+<!ENTITY staff.circ.checkin_overlay.checkin_auto_retarget_all_ind.label "Always Retarget Local Holds">
 <!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">
diff --git a/Open-ILS/xul/staff_client/server/circ/checkin.js b/Open-ILS/xul/staff_client/server/circ/checkin.js
index 9241083..6984150 100644
--- a/Open-ILS/xul/staff_client/server/circ/checkin.js
+++ b/Open-ILS/xul/staff_client/server/circ/checkin.js
@@ -418,6 +418,36 @@ circ.checkin.prototype = {
                         ind.hidden = cb.getAttribute('checked') != 'true'; 
                         document.getElementById('checkin_barcode_entry_textbox').focus();
                         return true;
+                    } ],
+                    'cmd_checkin_auto_retarget' : [ ['command'], function(ev) {
+                        dump('in cmd_checkin_auto_retarget\n');
+                        var bg = document.getElementById('background');
+                        var cb = document.getElementById('checkin_auto_retarget');
+                        var cb2 = document.getElementById('checkin_auto_retarget_all');
+                        var ind = document.getElementById('checkin_auto_retarget_indicator');
+                        var ind2 = document.getElementById('checkin_auto_retarget_all_indicator');
+                        var cn = 'checkin_screen_checkin_auto_retarget';
+                        var cn2 = 'checkin_screen_checkin_auto_retarget_all';
+                        if (cb.getAttribute('checked') == 'true') {
+                            if(cb2.getAttribute('checked') == 'true') {
+                                removeCSSClass(bg,cn);
+                                addCSSClass(bg,cn2);
+                                ind.hidden = true;
+                                ind2.hidden = false;
+                            } else {
+                                addCSSClass(bg,cn);
+                                removeCSSClass(bg,cn2);
+                                ind.hidden = false;
+                                ind2.hidden = true;
+                            }
+                        } else {
+                            removeCSSClass(bg,cn);
+                            removeCSSClass(bg,cn2);
+                            ind.hidden = true;
+                            ind2.hidden = true;
+                        }
+                        document.getElementById('checkin_barcode_entry_textbox').focus();
+                        return true;
                     } ]
                 }
             }
@@ -580,6 +610,14 @@ circ.checkin.prototype = {
             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;
+            var auto_retarget = document.getElementById('checkin_auto_retarget');
+            if (auto_retarget) auto_retarget = auto_retarget.getAttribute('checked') == 'true';
+            if (auto_retarget) {
+                var retarget_all = document.getElementById('checkin_auto_retarget_all');
+                if (retarget_all) retarget_all = retarget_all.getAttribute('checked') == 'true';
+                if (retarget_all) params.retarget_mode = 'retarget.all';
+                else params.retarget_mode = 'retarget';
+            }
             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 4ea1a74..18dff0e 100644
--- a/Open-ILS/xul/staff_client/server/circ/checkin_overlay.xul
+++ b/Open-ILS/xul/staff_client/server/circ/checkin_overlay.xul
@@ -36,6 +36,7 @@
     <command id="cmd_amnesty_mode" />
     <command id="cmd_checkin_auto_print_slips" />
     <command id="cmd_checkin_clear_shelf_expired" />
+    <command id="cmd_checkin_auto_retarget" />
 </commandset>
 
 
@@ -76,6 +77,8 @@
                 <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>
+                <description id="checkin_auto_retarget_indicator" hidden="true">&staff.circ.checkin_overlay.checkin_auto_retarget.label;</description>
+                <description id="checkin_auto_retarget_all_indicator" hidden="true">&staff.circ.checkin_overlay.checkin_auto_retarget_all_ind.label;</description>
             </vbox>
         </vbox>
         <spacer flex="1"/>
@@ -177,6 +180,10 @@
                 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;"/>
+            <menuitem type="checkbox" id="checkin_auto_retarget" oils_persist="checked" command="cmd_checkin_auto_retarget"
+                label="&staff.circ.checkin_overlay.checkin_auto_retarget.label;" accesskey="&staff.circ.checkin_overlay.checkin_auto_retarget.accesskey;"/>
+            <menuitem type="checkbox" id="checkin_auto_retarget_all" oils_persist="checked" command="cmd_checkin_auto_retarget"
+                label="&staff.circ.checkin_overlay.checkin_auto_retarget_all.label;" accesskey="&staff.circ.checkin_overlay.checkin_auto_retarget_all.accesskey;"/>
         </menupopup>
     </button>
 </hbox>
diff --git a/Open-ILS/xul/staff_client/server/skin/circ.css b/Open-ILS/xul/staff_client/server/skin/circ.css
index 049e4fb..d73071f 100644
--- a/Open-ILS/xul/staff_client/server/skin/circ.css
+++ b/Open-ILS/xul/staff_client/server/skin/circ.css
@@ -46,6 +46,8 @@ treechildren::-moz-tree-row(backdate_failed,selected) {
 .checkin_screen_amnesty_mode { }
 .checkin_screen_checkin_auto_print_slips { }
 .checkin_screen_checkin_clear_shelf_expired { }
+.checkin_screen_checkin_auto_retarget { }
+.checkin_screen_checkin_auto_retarget_all { }
 
 #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; }
@@ -53,6 +55,8 @@ treechildren::-moz-tree-row(backdate_failed,selected) {
 #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; }
+#checkin_auto_retarget_indicator { background-color: -moz-dialog; color: -moz-dialog-text; font-size: large; font-weight: bold; }
+#checkin_auto_retarget_all_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; }

commit b269c7ea26fda42693bf7cdab8fcd9d3b9956bd6
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Thu Jul 14 16:48:56 2011 -0400

    Clear Shelf Expired Hold on Checkin
    
    Only if modifier is set and at the pickup library.
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>

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 d61f75e..41f90e2 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 b100ca3..cab3edd 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 ce4252e..5be57e4 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 @@
 <!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">
diff --git a/Open-ILS/xul/staff_client/server/circ/checkin.js b/Open-ILS/xul/staff_client/server/circ/checkin.js
index de95ecb..9241083 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 522a740..4ea1a74 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 @@
     <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"/>
@@ -173,6 +175,8 @@
                 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>
diff --git a/Open-ILS/xul/staff_client/server/skin/circ.css b/Open-ILS/xul/staff_client/server/skin/circ.css
index 7369275..049e4fb 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; }

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/examples/oils_sip.xml.example             |    5 +
 .../lib/OpenILS/Application/Circ/Circulate.pm      |   87 +++++++++++++++++++-
 .../perlmods/lib/OpenILS/Application/Circ/Holds.pm |    9 ++-
 .../Application/Storage/Publisher/action.pm        |    6 +-
 .../lib/OpenILS/SIP/Transaction/Checkin.pm         |    5 +
 Open-ILS/web/opac/locale/en-US/lang.dtd            |    9 ++
 Open-ILS/xul/staff_client/server/circ/checkin.js   |   67 +++++++++++++++
 .../staff_client/server/circ/checkin_overlay.xul   |   15 ++++
 Open-ILS/xul/staff_client/server/skin/circ.css     |    8 ++
 9 files changed, 203 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list