From feb3a34fe9c317f5f480ee6cf2f7dc5454f99b72 Mon Sep 17 00:00:00 2001
From: Arthur Suzuki <arthur.suzuki@biblibre.com>
Date: Wed, 19 Mar 2025 14:09:57 +0000
Subject: [PATCH] Bug 32702: (follow-up) add cache mechanism

status "missing_itemtype", "notforloan", "itemlost" and "withdrawn" added by this bug were missing the cache mechanism in there return value handling.
This patch is a followup to solve this.
---
 C4/Reserves.pm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/C4/Reserves.pm b/C4/Reserves.pm
index 87042320e02..ee280ada2e5 100644
--- a/C4/Reserves.pm
+++ b/C4/Reserves.pm
@@ -491,13 +491,13 @@ sub CanItemBeReserved {
     #         or something similar - need to be
     #         consolidated
     my $itemtype = $item->effective_itemtype;
-    return { status => 'missing_itemtype' }
+    return _cache { status => 'missing_itemtype' }
         unless defined $itemtype;
     my $notforloan_per_itemtype = Koha::ItemTypes->find($itemtype)->notforloan;
 
-    return { status => 'notforloan' } if ( $item->notforloan > 0 || $notforloan_per_itemtype );
-    return { status => 'itemlost' }   if $item->itemlost;
-    return { status => 'withdrawn' }  if $item->withdrawn;
+    return _cache { status => 'notforloan' } if ( $item->notforloan > 0 || $notforloan_per_itemtype );
+    return _cache { status => 'itemlost' }   if $item->itemlost;
+    return _cache { status => 'withdrawn' }  if $item->withdrawn;
 
     # If an item is damaged and we don't allow holds on damaged items, we can stop right here
     return _cache { status => 'damaged' }
-- 
2.39.5