Fix HoldIsAvailable validator
authorThomas Berezansky <tsbere@mvlc.org>
Wed, 1 Feb 2012 19:16:53 +0000 (14:16 -0500)
committerBill Erickson <berick@esilibrary.com>
Thu, 2 Feb 2012 14:54:00 +0000 (09:54 -0500)
Depending on the environment some things may be ids or references.

Comparisons should try and use the IDs only, so pull the IDs out.

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Validator.pm

index 57563e0..55c5742 100644 (file)
@@ -77,7 +77,8 @@ sub HoldIsAvailable {
         !$hold->cancel_time and
         !$hold->fulfillment_time and
         $hold->current_shelf_lib and
-        $hold->current_shelf_lib eq $hold->pickup_lib and
+        (ref $hold->current_shelf_lib ? $hold->current_shelf_lib->id : $hold->current_shelf_lib)
+            eq (ref $hold->pickup_lib ? $hold->pickup_lib->id : $hold->pickup_lib) and
         $hold->capture_time and # redundant
         $hold->current_copy and # redundant
         $hold->shelf_time and   # redundant