[open-ils-commits] r17969 - branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher (gmc)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Sep 24 14:57:10 EDT 2010
Author: gmc
Date: 2010-09-24 14:57:06 -0400 (Fri, 24 Sep 2010)
New Revision: 17969
Modified:
branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm
Log:
improve hold targetting
* all potential capturable copies are now checked (up to the first
one that is permitted for the request), instead of a small random
subset of them
* don't do redundant permission checks
Signed-off-by: Galen Charlton <gmc at esilibrary.com>
Modified: branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm
===================================================================
--- branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm 2010-09-24 18:43:50 UTC (rev 17968)
+++ branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm 2010-09-24 18:57:06 UTC (rev 17969)
@@ -1446,17 +1446,19 @@
next unless (@capturable);
my $rand = int(rand(scalar(@capturable)));
- while (my ($c) = splice(@capturable,$rand)) {
- return $c if ( OpenILS::Utils::PermitHold::permit_copy_hold(
+ my %seen = ();
+ while (my ($c) = splice(@capturable, $rand, 1)) {
+ return $c if !exists($seen{$c->id}) && ( OpenILS::Utils::PermitHold::permit_copy_hold(
{ title => $c->call_number->record->to_fieldmapper,
title_descriptor => $c->call_number->record->record_descriptor->next->to_fieldmapper,
patron => $hold->usr->to_fieldmapper,
copy => $c->to_fieldmapper,
requestor => $hold->requestor->to_fieldmapper,
request_lib => $hold->request_lib->to_fieldmapper,
- pickup_lib => $hold->pickup_lib->id,
+ pickup_lib => $hold->pickup_lib->id,
}
));
+ $seen{$c->id}++;
last unless(@capturable);
$rand = int(rand(scalar(@capturable)));
More information about the open-ils-commits
mailing list