[open-ils-commits] [GIT] Evergreen ILS branch rel_2_2 updated. b3ef0085bcdf7eb64f1098f930614781f52652cd

Evergreen Git git at git.evergreen-ils.org
Thu May 10 10:10:23 EDT 2012


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, rel_2_2 has been updated
       via  b3ef0085bcdf7eb64f1098f930614781f52652cd (commit)
       via  6bbd80935eb8c973e2b70301723cfca665ea4584 (commit)
       via  6da6518478c447015c946742524908d7d4a11a68 (commit)
       via  4604b1cf21eecf7ab3ffb500235fb0182a335e1e (commit)
      from  69dc5150c697e525f3c2ff41b3f578e5912e2b16 (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 b3ef0085bcdf7eb64f1098f930614781f52652cd
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Mon May 7 14:13:17 2012 -0400

    Nearest Hold: Look at 100 instead of 10 holds
    
    At the suggestion of Mike Rylander.
    
    Because DB-wise the extra 90 IDs isn't a big deal, and this way we get more
    chances to capture (or block renewal, etc).
    
    Jeff Godin claims they have done this and it has produced no issues for them.
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

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 b110658..9fddeeb 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
@@ -2904,7 +2904,7 @@ sub find_nearest_permitted_hold {
 	# search for what should be the best holds for this copy to fulfill
 	my $best_holds = $U->storagereq(
         "open-ils.storage.action.hold_request.nearest_hold.atomic", 
-		$user->ws_ou, $copy->id, 10, $hold_stall_interval, $fifo );
+		$user->ws_ou, $copy->id, 100, $hold_stall_interval, $fifo );
 
 	# Add any pre-targeted holds to the list too? Unless they are already there, anyway.
 	if ($old_holds) {

commit 6bbd80935eb8c973e2b70301723cfca665ea4584
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Mon May 7 11:59:10 2012 -0400

    Hold Capture: Run permit tests on "old" holds
    
    Because we shouldn't be trusting that the copies are still valid.
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

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 097dc69..b110658 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
@@ -2906,13 +2906,15 @@ sub find_nearest_permitted_hold {
         "open-ils.storage.action.hold_request.nearest_hold.atomic", 
 		$user->ws_ou, $copy->id, 10, $hold_stall_interval, $fifo );
 
-	unless(@$best_holds) {
-
-		if( my $hold = $$old_holds[0] ) {
-			$logger->info("circulator: using existing pre-targeted hold ".$hold->id." in hold search");
-			return ($hold);
+	# Add any pre-targeted holds to the list too? Unless they are already there, anyway.
+	if ($old_holds) {
+		for my $holdid (@$old_holds) {
+			next unless $holdid;
+			push(@$best_holds, $holdid) unless ( grep { ''.$holdid eq ''.$_ } @$best_holds );
 		}
+	}
 
+	unless(@$best_holds) {
 		$logger->info("circulator: no suitable holds found for copy $bc");
 		return (undef, $evt);
 	}
@@ -2954,11 +2956,6 @@ sub find_nearest_permitted_hold {
 
 
 	unless( $best_hold ) { # no "good" permitted holds were found
-		if( my $hold = $$old_holds[0] ) { # can we return a pre-targeted hold?
-			$logger->info("circulator: using existing pre-targeted hold ".$hold->id." in hold search");
-			return ($hold);
-		}
-
 		# we got nuthin
 		$logger->info("circulator: no suitable holds found for copy $bc");
 		return (undef, $evt);

commit 6da6518478c447015c946742524908d7d4a11a68
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Mon May 7 11:40:41 2012 -0400

    Hold Editing: Retarget on some changes
    
    The main thing to cover is pickup library, but check a few other things too.
    
    Note that most of what is being checked likely doesn't change in any normal
    workflows or interfaces, but it looks like they could anyway later.
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

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 906ec53..097dc69 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
@@ -883,11 +883,23 @@ sub batch_update_hold {
 sub update_hold_impl {
     my($self, $e, $hold, $values) = @_;
     my $hold_status;
+    my $need_retarget = 0;
 
     unless($hold) {
         $hold = $e->retrieve_action_hold_request($values->{id})
             or return $e->die_event;
         for my $k (keys %$values) {
+            # Outside of pickup_lib (covered by the first regex) I don't know when these would currently change.
+            # But hey, why not cover things that may happen later?
+            if ($k =~ '_(lib|ou)$' || $k eq 'target' || $k eq 'hold_type' || $k eq 'requestor' || $k eq 'selection_depth' || $k eq 'holdable_formats') {
+                if (defined $values->{$k} && defined $hold->$k() && $values->{$k} ne $hold->$k()) {
+                    # Value changed? RETARGET!
+                    $need_retarget = 1;
+                } elsif (defined $hold->$k() != defined $values->{$k}) {
+                    # Value being set or cleared? RETARGET!
+                    $need_retarget = 1;
+                }
+            }
             if (defined $values->{$k}) {
                 $hold->$k($values->{$k});
             } else {
@@ -993,6 +1005,9 @@ sub update_hold_impl {
     # a change to mint-condition changes the set of potential copies, so retarget the hold;
     if($U->is_true($hold->mint_condition) and !$U->is_true($orig_hold->mint_condition)) {
         _reset_hold($self, $e->requestor, $hold) 
+    } elsif($need_retarget && !defined $hold->capture_time()) { # If needed, retarget the hold due to changes
+        $U->storagereq(
+    		'open-ils.storage.action.hold_request.copy_targeter', undef, $hold->id );
     }
 
     return $hold->id;

commit 4604b1cf21eecf7ab3ffb500235fb0182a335e1e
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Mon May 7 11:00:14 2012 -0400

    Hold Targeter: Ensure old best still valid
    
    Re-using a now invalid copy is a bad idea for various reasons.
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

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 0f36c83..7c07e6f 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
@@ -1338,11 +1338,13 @@ sub new_hold_copy_targeter {
 			$log->debug("\t".scalar(@good_copies)." (non-current) copies available for targeting...");
 
 			my $old_best = $hold->current_copy;
+			my $old_best_still_valid = 0; # Assume no, but the next line says yes if it is still a potential.
+			$old_best_still_valid = 1 if ( $old_best && grep { ''.$old_best->id eq ''.$_->id } @$all_copies );
 			$hold->update({ current_copy => undef }) if ($old_best);
 	
 			if (!scalar(@good_copies)) {
 				$log->info("\tNo (non-current) copies eligible to fill the hold.");
-				if ( $old_best && grep { ''.$old_best->id eq ''.$_->id } @$all_copies ) {
+				if ( $old_best_still_valid ) {
 					# the old copy is still available
 					$log->debug("\tPushing current_copy back onto the targeting list");
 					push @good_copies, $old_best;
@@ -1488,14 +1490,25 @@ sub new_hold_copy_targeter {
 				$hold->update( { current_copy => ''.$best->id, prev_check_time => 'now' } );
 				$log->debug("\tUpdating hold [".$hold->id."] with new 'current_copy' [".$best->id."] for hold fulfillment.");
 			} elsif (
-				$old_best &&
+				$old_best_still_valid &&
 				!action::hold_request
 					->search_where(
 						{ current_copy => $old_best->id,
 						  fulfillment_time => undef,
 						  cancel_time => undef,
 						}       
-					)
+					) &&
+				( OpenILS::Utils::PermitHold::permit_copy_hold(
+					{ title => $old_best->call_number->record->to_fieldmapper,
+					  title_descriptor => $old_best->call_number->record->record_descriptor->next->to_fieldmapper,
+					  patron => $hold->usr->to_fieldmapper,
+					  copy => $old_best->to_fieldmapper,
+					  requestor => $hold->requestor->to_fieldmapper,
+					  request_lib => $hold->request_lib->to_fieldmapper,
+					  pickup_lib => $hold->pickup_lib->id,
+					  retarget => 1
+					}
+				))
 			) {     
 				$hold->update( { prev_check_time => 'now', current_copy => ''.$old_best->id } );
 				$log->debug( "\tRetargeting the previously targeted copy [".$old_best->id."]" );

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

Summary of changes:
 .../perlmods/lib/OpenILS/Application/Circ/Holds.pm |   34 +++++++++++++------
 .../Application/Storage/Publisher/action.pm        |   19 +++++++++--
 2 files changed, 39 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list