From dcc274daf9664ca41cfca734073fa0dfedf43a5b Mon Sep 17 00:00:00 2001 From: Ere Maijala <ere.maijala@helsinki.fi> Date: Wed, 26 Oct 2016 16:56:32 +0300 Subject: [PATCH] Added support for new block functions in MultiBackend driver (#843) --- .../src/VuFind/ILS/Driver/MultiBackend.php | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/module/VuFind/src/VuFind/ILS/Driver/MultiBackend.php b/module/VuFind/src/VuFind/ILS/Driver/MultiBackend.php index 19dc073a2fa..7f7a4364cbe 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/MultiBackend.php +++ b/module/VuFind/src/VuFind/ILS/Driver/MultiBackend.php @@ -1163,6 +1163,56 @@ class MultiBackend extends AbstractBase throw new ILSException('No suitable backend driver found'); } + /** + * Check whether the patron is blocked from placing requests (holds/ILL/SRR). + * + * @param array $patron Patron data from patronLogin(). + * + * @return mixed A boolean false if no blocks are in place and an array + * of block reasons if blocks are in place + */ + public function getRequestBlocks($patron) + { + $source = $this->getSource($patron['cat_username']); + $driver = $this->getDriver($source); + if ($driver) { + if (!$this->methodSupported( + $driver, 'getRequestBlocks', compact('patron') + )) { + return false; + } + return $driver->getRequestBlocks( + $this->stripIdPrefixes($patron, $source) + ); + } + throw new ILSException('No suitable backend driver found'); + } + + /** + * Check whether the patron has any blocks on their account. + * + * @param array $patron Patron data from patronLogin(). + * + * @return mixed A boolean false if no blocks are in place and an array + * of block reasons if blocks are in place + */ + public function getAccountBlocks($patron) + { + $source = $this->getSource($patron['cat_username']); + $driver = $this->getDriver($source); + if ($driver) { + if (!$this->methodSupported( + $driver, 'getAccountBlocks', compact('patron') + )) { + return false; + } + return $driver->getAccountBlocks( + $this->stripIdPrefixes($patron, $source) + ); + } + throw new ILSException('No suitable backend driver found'); + } + /** * Function which specifies renew, hold and cancel settings. * -- GitLab