From 8bcc1ba8a3e3639599e6ff6248bf8df9018fbcd0 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Wed, 3 Jun 2020 11:44:53 -0400
Subject: [PATCH] Apply is_holdable setting more consistently.

---
 module/VuFind/src/VuFind/ILS/Logic/Holds.php | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/module/VuFind/src/VuFind/ILS/Logic/Holds.php b/module/VuFind/src/VuFind/ILS/Logic/Holds.php
index 54f4524a8ad..507fd5d1256 100644
--- a/module/VuFind/src/VuFind/ILS/Logic/Holds.php
+++ b/module/VuFind/src/VuFind/ILS/Logic/Holds.php
@@ -281,7 +281,8 @@ class Holds
                     if ($holdConfig) {
                         // Is this copy holdable / linkable
                         if (!$requestsBlocked
-                            && isset($copy['addLink']) && $copy['addLink']
+                            && ($copy['addLink'] ?? false)
+                            && ($copy['is_holdable'] ?? true)
                         ) {
                             $copy['link'] = $this->getRequestDetails(
                                 $copy, $holdConfig['HMACKeys'], 'Hold'
@@ -363,10 +364,7 @@ class Holds
                         }
                         // If a valid holdable status has been set, use it to
                         // determine if a hold link is created
-                        $addlink = isset($copy['is_holdable'])
-                            ? ($addlink && $copy['is_holdable']) : $addlink;
-
-                        if ($addlink) {
+                        if ($addlink && ($copy['is_holdable'] ?? true)) {
                             if ($holdConfig['function'] == "getHoldLink") {
                                 /* Build opac link */
                                 $holdings[$location_key][$copy_key]['link']
-- 
GitLab