From af09729c89349ff84e901de905a396b78bd3e5e8 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 17 Sep 2012 08:48:26 -0400 Subject: [PATCH] Protect against fleshed circ_lib in legacy check_age_protect Retrieving org settings with an org unit object as the context org unit results in errors and dying. This affects legacy scripts only. Signed-off-by: Bill Erickson Signed-off-by: Michael Peters --- Open-ILS/src/perlmods/lib/OpenILS/Utils/PermitHold.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/PermitHold.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/PermitHold.pm index c80a5d5c14..c453019399 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/PermitHold.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/PermitHold.pm @@ -162,8 +162,10 @@ sub check_age_protect { { order_by => 'age' } ); + # circ_lib may be fleshed + my $context_org = ref $copy->circ_lib ? $copy->circ_lib->id : $copy->circ_lib; my $age_protect_date = $copy->create_date; - $age_protect_date = $copy->active_date if($U->ou_ancestor_setting_value($copy->circ_lib, 'circ.holds.age_protect.active_date')); + $age_protect_date = $copy->active_date if($U->ou_ancestor_setting_value($context_org, 'circ.holds.age_protect.active_date')); my $age = 0; my $age_protect_parsed; -- 2.11.0