From 988abad20b4a00a6f71493ad08ca9e2a2b6e80bf Mon Sep 17 00:00:00 2001 From: Laura Hild <lshild@wm.edu> Date: Thu, 7 Aug 2014 11:47:20 -0400 Subject: [PATCH] Symphony: factor out LibraryFilter logic --- .../VuFind/src/VuFind/ILS/Driver/Symphony.php | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/module/VuFind/src/VuFind/ILS/Driver/Symphony.php b/module/VuFind/src/VuFind/ILS/Driver/Symphony.php index 9ede1a56b5d..32b996e48d8 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Symphony.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Symphony.php @@ -452,6 +452,23 @@ class Symphony extends AbstractBase implements ServiceLocatorAwareInterface return $this->makeRequest('standard', 'lookupTitleInfo', $params); } + /** + * Determine if a library is excluded by LibraryFilter configuration. + * + * @param string $libraryID the ID of the library in question + * @return boolean true if excluded, false if not + */ + protected function libraryIsFilteredOut($libraryID) { + $notInWhitelist = !empty($this->config['LibraryFilter']['include_only']) + && !in_array( + $libraryID, $this->config['LibraryFilter']['include_only'] + ); + $onBlacklist = in_array( + $libraryID, $this->config['LibraryFilter']['exclude'] + ); + return $notInWhitelist || $onBlacklist; + } + /** * Parse Call Info * @@ -475,15 +492,7 @@ class Symphony extends AbstractBase implements ServiceLocatorAwareInterface $libraryID = $callInfo->libraryID; $library = $this->translatePolicyID('LIBR', $libraryID); - $notInWhitelist = !empty($this->config['LibraryFilter']['include_only']) - && !in_array( - $libraryID, $this->config['LibraryFilter']['include_only'] - ); - $onBlacklist = in_array( - $libraryID, $this->config['LibraryFilter']['exclude'] - ); - - if ($notInWhitelist || $onBlacklist) { + if ($this->libraryIsFilteredOut($libraryID)) { continue; } -- GitLab