diff --git a/module/finc/src/finc/ILS/Driver/FincILS.php b/module/finc/src/finc/ILS/Driver/FincILS.php index 6eab90c6eea0d407403fddcaa95df5435fe46db3..036bb03fe6abff5fb7899e493e8ab7cb3cd9a261 100644 --- a/module/finc/src/finc/ILS/Driver/FincILS.php +++ b/module/finc/src/finc/ILS/Driver/FincILS.php @@ -1145,7 +1145,7 @@ class FincILS extends PAIA implements LoggerAwareInterface // check for existing data in cache if ($this->paiaCacheEnabled) { - $itemsResponse = $this->getCachedData($patron['cat_username']); + $itemsResponse = $this->getCachedData($this->getCacheKeyItems($patron)); } if (!isset($itemsResponse) || $itemsResponse == null) { @@ -1159,7 +1159,7 @@ class FincILS extends PAIA implements LoggerAwareInterface } if ($this->paiaCacheEnabled) { - $this->putCachedData($patron['cat_username'], $itemsResponse); + $this->putCachedData($this->getCacheKeyItems($patron), $itemsResponse); } } diff --git a/module/finc/src/finc/ILS/Driver/FincLibero.php b/module/finc/src/finc/ILS/Driver/FincLibero.php index 7bbc7143e0ae0598a8bf27046b23cc4ede034294..1fc98649fc39a63bb9b7dc095e7b76929d06ea35 100644 --- a/module/finc/src/finc/ILS/Driver/FincLibero.php +++ b/module/finc/src/finc/ILS/Driver/FincLibero.php @@ -465,7 +465,7 @@ class FincLibero extends FincILS implements TranslatorAwareInterface $this->removeCachedData($holdDetails['doc_id']); } if ($this->paiaCacheEnabled) { - $this->removeCachedData($patron['cat_username']); + $this->removeCachedData($this->getCacheKeyItems($patron)); } } } @@ -1252,6 +1252,10 @@ class FincLibero extends FincILS implements TranslatorAwareInterface if ($this->daiaCacheEnabled) { $this->removeCachedData($holdDetails['doc_id']); } + + if ($this->paiaCacheEnabled) { + $this->removeCachedData($this->getCacheKeyItems($patron)); + } } } } diff --git a/module/finc/src/finc/ILS/Driver/PAIA.php b/module/finc/src/finc/ILS/Driver/PAIA.php index 15c6aecc6ff4d3c59ebae586b80e9379d7056ffb..ccdf2d1f776e521623066d5d2771160032d20f54 100644 --- a/module/finc/src/finc/ILS/Driver/PAIA.php +++ b/module/finc/src/finc/ILS/Driver/PAIA.php @@ -205,7 +205,7 @@ class PAIA extends \VuFind\ILS\Driver\PAIA // Otherwise the changed status will not be shown before the cache // expires. if ($this->paiaCacheEnabled) { - $this->removeCachedData($patron['cat_username']); + $this->removeCachedData($this->getCacheKeyItems($patron)); } } $returnArray = ['count' => $count, 'items' => $details]; @@ -305,7 +305,7 @@ class PAIA extends \VuFind\ILS\Driver\PAIA } if ($this->paiaCacheEnabled) { - $fees = $this->getCachedData($this->_feesCacheKey($patron)); + $fees = $this->getCachedData($this->getCacheKeyFees($patron)); } if (!isset($fees) || $fees == null) { @@ -319,7 +319,7 @@ class PAIA extends \VuFind\ILS\Driver\PAIA } if ($this->paiaCacheEnabled) { - $this->putCachedData($this->_feesCacheKey($patron), $fees); + $this->putCachedData($this->getCacheKeyFees($patron), $fees); } } @@ -588,7 +588,7 @@ class PAIA extends \VuFind\ILS\Driver\PAIA } if ($this->paiaCacheEnabled) { - $this->removeCachedData($patron['cat_username']); + $this->removeCachedData($this->getCacheKeyItems($patron)); } } } @@ -692,7 +692,7 @@ class PAIA extends \VuFind\ILS\Driver\PAIA // item renew was successfull and therefore the status changed. Otherwise // the changed status will not be shown before the cache expires. if ($this->paiaCacheEnabled) { - $this->removeCachedData($patron['cat_username']); + $this->removeCachedData($this->getCacheKeyItems($patron)); } } $returnArray = ['blocks' => false, 'details' => $details]; @@ -723,7 +723,7 @@ class PAIA extends \VuFind\ILS\Driver\PAIA // check for existing data in cache if ($this->paiaCacheEnabled) { - $itemsResponse = $this->getCachedData($patron['cat_username']); + $itemsResponse = $this->getCachedData($this->getCacheKeyItems($patron)); } if (!isset($itemsResponse) || $itemsResponse == null) { @@ -736,7 +736,7 @@ class PAIA extends \VuFind\ILS\Driver\PAIA throw $e; } if ($this->paiaCacheEnabled) { - $this->putCachedData($patron['cat_username'], $itemsResponse); + $this->putCachedData($this->getCacheKeyItems($patron), $itemsResponse); } } @@ -768,6 +768,18 @@ class PAIA extends \VuFind\ILS\Driver\PAIA return []; } + /** + * Helper function to generate cache key for items. + * + * @param array $patron Array with patron information + * + * @return string + */ + protected function getCacheKeyItems($patron) + { + return $this->getCacheKey($patron['cat_username'] . '_items'); + } + /** * Helper function to generate cache key for fees. * @@ -775,21 +787,33 @@ class PAIA extends \VuFind\ILS\Driver\PAIA * * @return string */ - private function _feesCacheKey($patron) + protected function getCacheKeyFees($patron) { - return $patron['cat_username'] . '_fees'; + return $this->getCacheKey($patron['cat_username'] . '_fees'); } /** * Helper function to generate cache key for notifications. * * @param array $patron Array with patron information - * + * + * @return string + */ + protected function getCacheKeyNotifications($patron) + { + return $this->getCacheKey($patron['cat_username'] . '_notifications'); + } + + /** + * Helper function to generate cache key for patron data. + * + * @param array $patron Array with patron information + * * @return string */ - private function _notificationsCacheKey($patron) + protected function getCacheKeyPatron($patron) { - return $patron['cat_username'] . '_notifications'; + return $this->getCacheKey($patron['cat_username'] . '_patron'); } /** @@ -827,7 +851,7 @@ class PAIA extends \VuFind\ILS\Driver\PAIA } if ($this->paiaCacheEnabled) { - $response = $this->getCachedData($this->_notificationsCacheKey($patron)); + $response = $this->getCachedData($this->getCacheKeyNotifications($patron)); if ($response !== null) { return $response; } @@ -863,7 +887,7 @@ class PAIA extends \VuFind\ILS\Driver\PAIA } if ($this->paiaCacheEnabled) { - $this->putCachedData($this->_notificationsCacheKey($patron), $response); + $this->putCachedData($this->getCacheKeyNotifications($patron), $response); } return $response; @@ -896,7 +920,7 @@ class PAIA extends \VuFind\ILS\Driver\PAIA } if (!$keepCache && $this->paiaCacheEnabled) { - $this->removeCachedData($this->_notificationsCacheKey($patron)); + $this->removeCachedData($this->getCacheKeyNotifications($patron)); } return $response; @@ -917,7 +941,7 @@ class PAIA extends \VuFind\ILS\Driver\PAIA } if ($this->paiaCacheEnabled) { - $this->removeCachedData($this->_notificationsCacheKey($patron)); + $this->removeCachedData($this->getCacheKeyNotifications($patron)); } return true; @@ -1166,7 +1190,7 @@ class PAIA extends \VuFind\ILS\Driver\PAIA // From Vufind documentation: // "dueStatus - A special status – may be 'due' (for items due very - // soon) or 'overdue' (for overdue items). If this is false, empty + // soon) or 'overdue' (for overdue items). If this is false, empty // string, or unset, VuFind will assume that items have no special status. // (optional)." $result['dueStatus'] = isset($doc['endtime']) && (new \DateTime() > new \DateTime($doc['endtime'])) @@ -1313,7 +1337,7 @@ class PAIA extends \VuFind\ILS\Driver\PAIA // prepare post data depending on configured grant type switch ($this->grantType) { - case 'password' : + case 'password': $post_data = [ "username" => $username, "password" => $password @@ -1419,33 +1443,29 @@ class PAIA extends \VuFind\ILS\Driver\PAIA * @return array * @throws ILSException */ - protected function paiaGetUserDetails($patron) + protected function paiaGetUserDetails($patronId) { // check if user has appropriate scope if (!$this->paiaCheckScope(self::SCOPE_READ_PATRON)) { throw new ILSException('You are not entitled to read patron.'); } - $cacheKey = function ($patron) { - return $patron . '_user_details'; - }; - $response = null; if ($this->paiaCacheEnabled) { - $response = $this->getCachedData($cacheKey($patron)); + $response = $this->getCachedData($this->getCacheKeyPatron(['cat_username' => $patronId])); } if ($response === null) { // all error handling is done in paiaHandleErrors so pass on the excpetion - $response = $this->paiaGetAsArray('core/' . $patron); - + $response = $this->paiaGetAsArray('core/' . $patronId); + if ($this->paiaCacheEnabled) { - $this->putCachedData($cacheKey($patron), $response); + $this->putCachedData($this->getCacheKeyPatron(['cat_username' => $patronId]), $response); } } - return $this->paiaParseUserDetails($patron, $response); + return $this->paiaParseUserDetails($patronId, $response); } /** @@ -1522,6 +1542,10 @@ class PAIA extends \VuFind\ILS\Driver\PAIA 'success' => true, 'sysMessage' => 'Successfully requested' ]; + + if ($this->paiaCacheEnabled) { + $this->removeCachedData($this->getCacheKeyPatron($patron)); + } } return $details; } @@ -1697,7 +1721,7 @@ class PAIA extends \VuFind\ILS\Driver\PAIA } return $retval; } - + /** * PAIA support function to implement ILS specific parsing of user_details * Calling parent method and just trimming firstname diff --git a/themes/finc-accessibility/templates/Auth/AbstractBase/newpassword.phtml b/themes/finc-accessibility/templates/Auth/AbstractBase/newpassword.phtml index f70192010cf76b2585436218c577f602b8c705ea..35626b631169b615e7d19b27081f6a7d570bf6a1 100644 --- a/themes/finc-accessibility/templates/Auth/AbstractBase/newpassword.phtml +++ b/themes/finc-accessibility/templates/Auth/AbstractBase/newpassword.phtml @@ -3,7 +3,7 @@ <?php if (isset($this->username)): ?> <div class="form-group"> <label class="control-label"><?=$this->transEsc('Username') ?>:</label> - <p class="form-control-static"><?=$this->username ?></p> + <p class="form-control-static"><?=$this->cat_username ?></p> </div> <?php endif; ?> <?php if (isset($this->verifyold) && $this->verifyold || isset($this->oldpwd)): ?>