From 8f7ca5de38916384c2062a44f0da885e0b48dc6c Mon Sep 17 00:00:00 2001
From: Ian Hardy <ian.c.hardy@gmail.com>
Date: Tue, 30 Jun 2020 16:48:09 -0400
Subject: [PATCH] FOLIO: add check for item level suppression (#1660)

---
 module/VuFind/src/VuFind/ILS/Driver/Folio.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/module/VuFind/src/VuFind/ILS/Driver/Folio.php b/module/VuFind/src/VuFind/ILS/Driver/Folio.php
index b37fd6f002c..0cb009b4fec 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/Folio.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/Folio.php
@@ -458,9 +458,12 @@ class Folio extends AbstractAPI implements
             };
             for ($j = 0; $j < count($itemBody->items); $j++) {
                 $item = $itemBody->items[$j];
+                if ($item->discoverySuppress ?? false) {
+                    continue;
+                }
                 $items[] = [
                     'id' => $bibId,
-                    'item_id' => $itemBody->items[$j]->id,
+                    'item_id' => $item->id,
                     'holding_id' => $holding->id,
                     'number' => count($items) + 1,
                     'barcode' => $item->barcode ?? '',
-- 
GitLab