From ead0e03f27d20b67001e2daabafcaeb544709ef0 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Wed, 27 May 2020 13:12:03 -0400
Subject: [PATCH] Minor Overdrive fixes/improvements: - Reformat comments in
 Overdrive.ini (word wrapping; normalized whitespace; no quoted Booleans) -
 Remove unused "previews" setting - Fix bug with missing
 showOverdriveAdminMenu setting

---
 config/vufind/Overdrive.ini                   | 72 +++++++++----------
 .../DigitalContent/OverdriveConnector.php     |  2 +
 2 files changed, 38 insertions(+), 36 deletions(-)

diff --git a/config/vufind/Overdrive.ini b/config/vufind/Overdrive.ini
index 184f2ca3198..ac34d13f1ca 100644
--- a/config/vufind/Overdrive.ini
+++ b/config/vufind/Overdrive.ini
@@ -1,42 +1,43 @@
 [Overdrive]
-; are your records in Marc format? If true, then the driver will mostly default to Marc templates
-; if false, then the driver will assume your records come from Overdrive.
+; are your records in Marc format? If true, then the driver will mostly default
+; to Marc templates. If false, then the driver will assume your records come from
+; Overdrive.
 isMarc = false;
 
-;(if isMarc is true) The marc field/subfield that has the overdriveID
+; (if isMarc is true) The marc field/subfield that has the overdriveID
 overdriveIdMarcField = "037"
 overdriveIdMarcSubfield = "a"
 
-;When to show the Overdrive Content link in the MyResearch Menu. (see noAccessString below).
-;Note: if you choose accessOnly then the menu item will be hidden when the noAccessString is returned from
-;Overdrive's authentication API.  In this case "no access" means the patron type should not have access to
-;Overdrive, not that there is a temporary problem like an expired card.
-;always: show the menu item.
-;accessOnly: only show if the patron has access to overdrive
-;never: never show the item(default)
+; When to show the Overdrive Content link in the MyResearch Menu. (see noAccessString
+; below).
+; Note: if you choose accessOnly then the menu item will be hidden when the
+; noAccessString is returned from Overdrive's authentication API. In this case "no
+; access" means the patron type should not have access to Overdrive, not that there
+; is a temporary problem like an expired card. Options:
+; - always: show the menu item.
+; - accessOnly: only show if the patron has access to overdrive
+; - never: never show the item(default)
 showMyContent = "never"
 
-;Whether to show the Overdrive API Troubleshooting menu item in the Admin Menu
-showOverdriveAdminMenu = "false"
+; Whether to show the Overdrive API Troubleshooting menu item in the Admin Menu
+showOverdriveAdminMenu = false
 
-;A substring to check for in the message that Overdrive returns when a patron account does not have access to Overdrive.
-;This string will probably be coming from your ILS or your own authentication API. You may want to change the message that
-;gets displayed in the language translation files when this happens.  Other messages that come from the API will result
-;an account problem type message.
+; A substring to check for in the message that Overdrive returns when a patron
+; account does not have access to Overdrive. This string will probably be coming
+; from your ILS or your own authentication API. You may want to change the message
+; that gets displayed in the language translation files when this happens. Other
+; messages that come from the API will result in an account problem type message.
 noAccessString = ""
 
-;enable previews for Overdrive (true false)
-previews = "true"
-
-;Enable Consortium Support (true/false).  Enable this if this vufind instance is set up
-;for a consortium AND you have some user member libraries that have advantage accounts.  This will allow
-;the individual user to have availability based on her individual library holdings.  Leave this off otherwise
-;because there is a little more overhead with it on.
-;Default is false.
+; Enable Consortium Support (true/false). Enable this if this VuFind instance is
+; set up for a consortium AND you have some user member libraries that have advantage
+; accounts. This will allow the individual user to have availability based on her
+; individual library holdings. Leave this off otherwise because there is a little
+; more overhead with it on. Default is false.
 consortiumSupport = false
 
 [API]
-;You should only have to change these top 5 in most cases.  These
+; You should only have to change these top 5 in most cases. These
 ; values should be supplied to you by the Overdrive API support team.
 clientKey = "YOURLIBKEY"
 clientSecret = "yourclientsecret"
@@ -44,30 +45,29 @@ productionLibraryID = ""
 productionWebsiteID = ""
 ILSname = ""
 
-;set production mode to false to use the integration API during testing
+; set production mode to false to use the integration API during testing;
 ; set production mode to true to begin using prod URLs and IDs
 productionMode = true
 
-;how long to keep the collection token in the object cache (in seconds);
-;the collection token will be refreshed after this amount of time
-;default: 60*60*24*7 = 604800 (one week)
+; how long to keep the collection token in the object cache (in seconds);
+; the collection token will be refreshed after this amount of time
+; default: 60*60*24*7 = 604800 (one week)
 tokenCacheLifetime = 604800
 
-;Use these in integration mode
+; Use these in integration mode
 integrationLibraryID = ""
 integrationWebsiteID = ""
 
-;you shouldn't have to change anything below unless the API changes
+; you shouldn't have to change anything below unless the API changes
 tokenURL = "https://oauth.overdrive.com/token"
 patronTokenURL = "https://oauth-patron.overdrive.com/patrontoken"
 
-;Base Discovery API integration URL
+; Base Discovery API integration URL
 integrationDiscoveryURL = "http://integration.api.overdrive.com"
-;Base Circulation API integration URL
+; Base Circulation API integration URL
 integrationCircURL = "http://integration-patron.api.overdrive.com"
 
-;Base Discovery API Production URL
+; Base Discovery API Production URL
 productionDiscoveryURL = "https://api.overdrive.com"
-;Base Circulation API Production URL
+; Base Circulation API Production URL
 productionCircURL = "https://patron.api.overdrive.com"
-
diff --git a/module/VuFind/src/VuFind/DigitalContent/OverdriveConnector.php b/module/VuFind/src/VuFind/DigitalContent/OverdriveConnector.php
index 01183e9d74b..9b9444cab85 100644
--- a/module/VuFind/src/VuFind/DigitalContent/OverdriveConnector.php
+++ b/module/VuFind/src/VuFind/DigitalContent/OverdriveConnector.php
@@ -799,6 +799,8 @@ class OverdriveConnector implements LoggerAwareInterface,
         $conf->showMyContent
             = strtolower($this->recordConfig->Overdrive->showMyContent);
         $conf->noAccessString = $this->recordConfig->Overdrive->noAccessString;
+        $conf->showOverdriveAdminMenu
+            = $this->recordConfig->Overdrive->showOverdriveAdminMenu ?? false;
         $conf->tokenCacheLifetime
             = $this->recordConfig->API->tokenCacheLifetime;
         return $conf;
-- 
GitLab