[open-ils-commits] r9085 - in trunk/Open-ILS/src/perlmods/OpenILS:
. Application/Circ
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Mar 19 12:26:11 EDT 2008
Author: erickson
Date: 2008-03-19 11:51:51 -0400 (Wed, 19 Mar 2008)
New Revision: 9085
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
trunk/Open-ILS/src/perlmods/OpenILS/Const.pm
Log:
changed terminology (ceiling to boundary) for clarity. updated logic to try soft boundary first if it is greater then hard boundary, up to the hard boundary
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm 2008-03-19 15:51:20 UTC (rev 9084)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm 2008-03-19 15:51:51 UTC (rev 9085)
@@ -967,15 +967,6 @@
}
}
-sub find_hold_ceilings {
- my $org = shift;
- return (
- $U->ou_ancestor_setting_value($org, OILS_SETTING_HOLD_SOFT_CEILING),
- $U->ou_ancestor_setting_value($org, OILS_SETTING_HOLD_HARD_CEILING)
- );
-}
-
-
__PACKAGE__->register_method(
method => "check_title_hold",
api_name => "open-ils.circ.title_hold.is_possible",
@@ -1018,31 +1009,40 @@
my $request_lib = $e->retrieve_actor_org_unit($e->requestor->ws_ou)
or return $e->event;
- my($soft_ceiling, $hard_ceiling) = find_hold_ceilings($selection_ou);
+ my $soft_boundary = $U->ou_ancestor_setting_value($selection_ou, OILS_SETTING_HOLD_SOFT_BOUNDARY);
+ my $hard_boundary = $U->ou_ancestor_setting_value($selection_ou, OILS_SETTING_HOLD_HARD_BOUNDARY);
- if(defined $hard_ceiling and $$params{depth} < $hard_ceiling) {
- $logger->info("performing hold possibility check with hard ceiling $hard_ceiling");
- if(do_possibility_checks($e, $patron, $request_lib, $hard_ceiling, %params)) {
- return {success => 1, depth => $hard_ceiling}
- } else {
- return {success => 0};
- }
+ if(defined $soft_boundary and $$params{depth} < $soft_boundary) {
+ # work up the tree and as soon as we find a potential copy, use that depth
+ # also, make sure we don't go past the hard boundary if it exists
- } elsif(defined $soft_ceiling and $$params{depth} < $soft_ceiling) {
- my $depth = $soft_ceiling;
- # work up the tree and as soon as we find a potential copy, use that depth
- while($depth >= $$params{depth}) {
- $logger->info("performing hold possibility check with soft ceiling $depth");
+ # our min boundary is the greater of user-specified boundary or hard boundary
+ my $min_depth = (defined $hard_boundary and $hard_boundary > $$params{depth}) ?
+ $hard_boundary : $$params{depth};
+
+ my $depth = $soft_boundary;
+ while($depth >= $min_depth) {
+ $logger->info("performing hold possibility check with soft boundary $depth");
return {success => 1, depth => $depth}
if do_possibility_checks($e, $patron, $request_lib, $depth, %params);
$depth--;
}
return {success => 0};
+ } elsif(defined $hard_boundary and $$params{depth} < $hard_boundary) {
+ # there is no soft boundary, enforce the hard boundary if it exists
+ $logger->info("performing hold possibility check with hard boundary $hard_boundary");
+ if(do_possibility_checks($e, $patron, $request_lib, $hard_boundary, %params)) {
+ return {success => 1, depth => $hard_boundary}
+ } else {
+ return {success => 0};
+ }
+
} else {
- $logger->info("performing hold possibility check with no ceiling");
+ # no boundaries defined, fall back to user specifed boundary or no boundary
+ $logger->info("performing hold possibility check with no boundary");
if(do_possibility_checks($e, $patron, $request_lib, $params{depth}, %params)) {
- return {success => 1, depth => $hard_ceiling};
+ return {success => 1, depth => $hard_boundary};
} else {
return {success => 0};
}
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Const.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Const.pm 2008-03-19 15:51:20 UTC (rev 9084)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Const.pm 2008-03-19 15:51:51 UTC (rev 9085)
@@ -79,8 +79,8 @@
econst OILS_SETTING_VOID_OVERDUE_ON_LOST => 'circ.void_overdue_on_lost';
econst OILS_SETTING_HOLD_SOFT_STALL => 'circ.hold_stalling.soft';
econst OILS_SETTING_HOLD_HARD_STALL => 'circ.hold_stalling.hard';
-econst OILS_SETTING_HOLD_SOFT_CEILING => 'circ.hold_ceiling.soft';
-econst OILS_SETTING_HOLD_HARD_CEILING => 'circ.hold_ceiling.hard';
+econst OILS_SETTING_HOLD_SOFT_BOUNDARY => 'circ.hold_boundary.soft';
+econst OILS_SETTING_HOLD_HARD_BOUNDARY => 'circ.hold_boundary.hard';
More information about the open-ils-commits
mailing list