[open-ils-commits] r9084 - in branches/rel_1_2/Open-ILS/src/perlmods/OpenILS: . Application/Circ

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Mar 19 12:25:41 EDT 2008


Author: erickson
Date: 2008-03-19 11:51:20 -0400 (Wed, 19 Mar 2008)
New Revision: 9084

Modified:
   branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
   branches/rel_1_2/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: branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
===================================================================
--- branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2008-03-19 15:35:07 UTC (rev 9083)
+++ branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2008-03-19 15:51:20 UTC (rev 9084)
@@ -966,15 +966,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",
@@ -1017,31 +1008,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: branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Const.pm
===================================================================
--- branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Const.pm	2008-03-19 15:35:07 UTC (rev 9083)
+++ branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Const.pm	2008-03-19 15:51:20 UTC (rev 9084)
@@ -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