From 15b6c62a6e9558b786e5875f32250ec6222b9c76 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Thu, 6 Jul 2017 10:26:55 -0400
Subject: [PATCH] Smarter offline behavior for new items.

---
 module/VuFind/src/VuFind/ILS/Driver/NoILS.php    | 16 ++++++++++++++++
 themes/bootstrap3/templates/search/newitem.phtml |  6 ++++++
 2 files changed, 22 insertions(+)

diff --git a/module/VuFind/src/VuFind/ILS/Driver/NoILS.php b/module/VuFind/src/VuFind/ILS/Driver/NoILS.php
index b53bdd0a666..f577f618c08 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/NoILS.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/NoILS.php
@@ -380,6 +380,20 @@ class NoILS extends AbstractBase implements TranslatorAwareInterface
         return null;
     }
 
+    /**
+     * Get Funds
+     *
+     * Return a list of funds which may be used to limit the getNewItems list.
+     *
+     * @throws ILSException
+     * @return array An associative array with key = fund ID, value = fund name.
+     */
+    public function getFunds()
+    {
+        // Does not work while ILS offline:
+        return [];
+    }
+
     /**
      * Get Departments
      *
@@ -437,6 +451,8 @@ class NoILS extends AbstractBase implements TranslatorAwareInterface
      *
      * @throws ILSException
      * @return array An array of associative arrays representing reserve items.
+     *
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
     public function findReserves($course, $inst, $dept)
     {
diff --git a/themes/bootstrap3/templates/search/newitem.phtml b/themes/bootstrap3/templates/search/newitem.phtml
index c0db48fa1b0..96163f91d4a 100644
--- a/themes/bootstrap3/templates/search/newitem.phtml
+++ b/themes/bootstrap3/templates/search/newitem.phtml
@@ -4,8 +4,14 @@
 
     // Set up breadcrumbs:
     $this->layout()->breadcrumbs = '<li class="active">' . $this->transEsc('New Items') . '</li>';
+
+    // Convenience variable:
+    $offlineMode = $this->ils()->getOfflineMode();
 ?>
 <h2><?=$this->transEsc('Find New Items')?></h2>
+<? if ($offlineMode == "ils-offline"): ?>
+  <?=$this->render('Helpers/ils-offline.phtml', ['offlineModeMsg' => 'ils_offline_holdings_message'])?>
+<? endif; ?>
 <form method="get" class="form-search-newitem">
   <div class="form-group">
     <label class="control-label"><?=$this->transEsc('Range')?>:</label>
-- 
GitLab