The absence of holds-triggered recall rules should not break hold targeting
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 22 Nov 2010 04:46:49 +0000 (04:46 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 22 Nov 2010 04:46:49 +0000 (04:46 +0000)
Thanks to Galen Charlton for pointing out that if rules were not set for
holds-triggered recalls, then all hold targeting would break because of
an assumption the code made that one could invoke the ->{value} member
of the OU settings. But of course the return value for an unset OU setting
is undef, not an object with an undef ->{value} member.

This should unbreak that code path.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@18816 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm

index fa98899..25f9cd0 100644 (file)
@@ -1487,27 +1487,35 @@ sub process_recall {
     my ($actor, $log, $hold, $good_copies) = @_;
 
     # Bail early if we don't have required settings to avoid spurious requests
-    my $recall_threshold = $actor->request(
+    my ($recall_threshold, $return_interval, $fine_rules);
+
+    my $rv = $actor->request(
         'open-ils.actor.ou_setting.ancestor_default', ''.$hold->pickup_lib, 'circ.holds.recall_threshold'
-    )->gather(1)->{value};
+    )->gather(1);
 
-    if (!$recall_threshold) {
+    if (!$rv) {
         $log->info("Recall threshold was not set; bailing out on hold ".$hold->id." processing.");
         return;
     }
+    $recall_threshold = $rv->{value};
 
-    my $return_interval = $actor->request(
+    $rv = $actor->request(
         'open-ils.actor.ou_setting.ancestor_default', ''.$hold->pickup_lib, 'circ.holds.recall_return_interval'
-    )->gather(1)->{value};
+    )->gather(1);
 
-    if (!$return_interval) {
+    if (!$rv) {
         $log->info("Recall return interval was not set; bailing out on hold ".$hold->id." processing.");
         return;
     }
+    $return_interval = $rv->{value};
 
-    my $fine_rules = $actor->request(
+    $rv = $actor->request(
         'open-ils.actor.ou_setting.ancestor_default', ''.$hold->pickup_lib, 'circ.holds.recall_fine_rules'
-    )->gather(1)->{value};
+    )->gather(1);
+
+    if ($rv) {
+        $fine_rules = $rv->{value};
+    }
 
     $log->info("Recall threshold: $recall_threshold; return interval: $return_interval");