From 2db95c888a433612c33365a3ca5234cf6dea2a2c Mon Sep 17 00:00:00 2001
From: miker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Wed, 8 Sep 2010 22:34:16 +0000
Subject: [PATCH] Check for empty-ok after testing issuance copies in addition
 to when there are no copies to test

git-svn-id: svn://svn.open-ils.org/ILS/trunk@17529 dcc99617-32d9-48b4-a31d-7c20da2025e4
---
 Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
index 1d2817ed0f..d667164cf3 100644
--- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
+++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
@@ -2074,8 +2074,9 @@ sub _check_issuance_hold_is_possible {
 
     $logger->info("issuance possible found ".scalar(@$copies)." potential copies");
 
+    my $empty_ok;
     if (!@$copies) {
-        my $empty_ok = $e->retrieve_config_global_flag('circ.holds.empty_issuance_ok');
+        $empty_ok = $e->retrieve_config_global_flag('circ.holds.empty_issuance_ok');
         $empty_ok = ($empty_ok and $U->is_true($empty_ok->enabled));
 
         return (
@@ -2166,6 +2167,14 @@ sub _check_issuance_hold_is_possible {
       }
     }
 
+    if (!$status[0]) {
+        if (!defined($empty_ok)) {
+            $empty_ok = $e->retrieve_config_global_flag('circ.holds.empty_issuance_ok');
+            $empty_ok = ($empty_ok and $U->is_true($empty_ok->enabled));
+        }
+
+        return (1,0) if ($empty_ok);
+    }
     return @status;
 }
 
-- 
2.11.0