Fix bug with title hold in NCIP::ILS::Evergreen->place_hold.
authorJason Stephenson <jstephenson@mvlc.org>
Thu, 22 Oct 2015 13:13:39 +0000 (09:13 -0400)
committerJason Stephenson <jstephenson@mvlc.org>
Thu, 22 Oct 2015 13:29:03 +0000 (09:29 -0400)
Add the selection_ou and selection depth to the parameters when
checking if the title hold is possible.  This will prevent the
placement of holds that are basically unfillable.

TODO: There is quite a bit of code here that could be simplified
by using test and create instead of separate is possible and
create calls.

Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
lib/NCIP/ILS/Evergreen.pm

index 258d6b8..11f2488 100644 (file)
@@ -2329,7 +2329,11 @@ sub place_hold {
         $params->{titleid} = $item->id();
         if ($org_unit && ref($org_unit) eq 'Fieldmapper::actor::org_unit') {
             $hold->selection_ou($org_unit->id());
-            $hold->selection_depth($org_unit->ou_type->depth()) if (ref($org_unit->ou_type()));
+            $params->{selection_ou} = $org_unit->id();
+            if (ref($org_unit->ou_type())) {
+                $hold->selection_depth($org_unit->ou_type->depth());
+                $params->{depth} = $org_unit->ou_type->depth();
+            }
         }
     }