Fix bug in hold targeter introduced with Calculated Proximity Adjustments
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Thu, 28 Mar 2013 19:08:37 +0000 (15:08 -0400)
committerMike Rylander <mrylander@gmail.com>
Mon, 1 Apr 2013 21:02:39 +0000 (17:02 -0400)
The Calculated Proximity Adjustments feature introduced a bug in the
hold targeter where holds would not discount those copies from the
potentials list that aren't in either the Available or Reshelving
status.

This commit should restore the earlier, correct behavior.

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm

index abe4c46..9e09d19 100644 (file)
@@ -1578,8 +1578,13 @@ sub new_hold_copy_targeter {
                        }
 
                        # reset prox list after trimming good copies
-                       $prox_list = create_prox_list( $self, $pu_lib, \@good_copies, $hold );
+                       $prox_list = create_prox_list(
+                               $self, $pu_lib,
+                               [ grep { ''.$_->circ_lib eq $pu_lib && ( $_->status == 0 || $_->status == 7 ) } @good_copies ],
+                               $hold
+                       );
 
+                       $all_copies = [ grep { ''.$_->circ_lib ne $pu_lib && ( $_->status == 0 || $_->status == 7 ) } @good_copies ];
 
                        my $min_prox = [ sort keys %$prox_list ]->[0];
                        my $best;
@@ -1589,11 +1594,6 @@ sub new_hold_copy_targeter {
                                $best = choose_nearest_copy($hold, { $min_prox => delete($$prox_list{$min_prox}) });
                        }
 
-                       $all_copies = [];
-                       for my $prox (keys %$prox_list) {
-                               push @$all_copies, @{$$prox_list{$prox}};
-                       }
-       
                        $client->status( new OpenSRF::DomainObject::oilsContinueStatus );
 
                        if (!$best) {