diff --git a/module/VuFind/src/VuFind/Controller/HoldsTrait.php b/module/VuFind/src/VuFind/Controller/HoldsTrait.php index b3cfa79a82ee46a04369b6d17c90f0e3e3567f0b..41957b1173bbc0988c715ff89d1d429e01ac670a 100644 --- a/module/VuFind/src/VuFind/Controller/HoldsTrait.php +++ b/module/VuFind/src/VuFind/Controller/HoldsTrait.php @@ -92,8 +92,10 @@ trait HoldsTrait // Send various values to the view so we can build the form: $requestGroups = $catalog->checkCapability( - 'getRequestGroups', [$driver->getUniqueID(), $patron] - ) ? $catalog->getRequestGroups($driver->getUniqueID(), $patron) : []; + 'getRequestGroups', [$driver->getUniqueID(), $patron, $gatheredDetails] + ) ? $catalog->getRequestGroups( + $driver->getUniqueID(), $patron, $gatheredDetails + ) : []; $extraHoldFields = isset($checkHolds['extraHoldFields']) ? explode(":", $checkHolds['extraHoldFields']) : []; diff --git a/module/VuFind/src/VuFind/ILS/Driver/Demo.php b/module/VuFind/src/VuFind/ILS/Driver/Demo.php index 3da19ce3a2515df78d5135595254009a2690bb93..07809d19e066fbe226dc7225eaa4786002844e4e 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Demo.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Demo.php @@ -1072,17 +1072,22 @@ class Demo extends AbstractBase /** * Get request groups * - * @param int $bibId BIB ID - * @param array $patron Patron information returned by the patronLogin + * @param int $bibId BIB ID + * @param array $patron Patron information returned by the patronLogin * method. + * @param array $holdDetails Optional array, only passed in when getting a list + * in the context of placing a hold; contains most of the same values passed to + * placeHold, minus the patron data. May be used to limit the request group + * options or may be ignored. * * @return array False if request groups not in use or an array of * associative arrays with id and name keys * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function getRequestGroups($bibId = null, $patron = null) - { + public function getRequestGroups($bibId = null, $patron = null, + $holdDetails = null + ) { $this->checkIntermittentFailure(); return [ [ diff --git a/module/VuFind/src/VuFind/ILS/Driver/MultiBackend.php b/module/VuFind/src/VuFind/ILS/Driver/MultiBackend.php index 7f7a4364cbe317bfb713be822b3ec4df287f0a2f..9bdba22cfe1b8539a478dc13ea5a9b1b8c7a6b8e 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/MultiBackend.php +++ b/module/VuFind/src/VuFind/ILS/Driver/MultiBackend.php @@ -701,21 +701,27 @@ class MultiBackend extends AbstractBase /** * Get request groups * - * @param int $id BIB ID - * @param array $patron Patron information returned by the patronLogin + * @param int $id BIB ID + * @param array $patron Patron information returned by the patronLogin * method. + * @param array $holdDetails Optional array, only passed in when getting a list + * in the context of placing a hold; contains most of the same values passed to + * placeHold, minus the patron data. May be used to limit the request group + * options or may be ignored. * * @return array An array of associative arrays with requestGroupId and * name keys */ - public function getRequestGroups($id, $patron) + public function getRequestGroups($id, $patron, $holdDetails = null) { $source = $this->getSource($id); $driver = $this->getDriver($source); if ($driver) { if ($this->getSource($patron['cat_username']) != $source || !$this->methodSupported( - $driver, 'getRequestGroups', compact('id', 'patron') + $driver, + 'getRequestGroups', + compact('id', 'patron', 'holdDetails') ) ) { // Return empty array since the sources don't match or the method @@ -724,7 +730,8 @@ class MultiBackend extends AbstractBase } $groups = $driver->getRequestGroups( $this->stripIdPrefixes($id, $source), - $this->stripIdPrefixes($patron, $source) + $this->stripIdPrefixes($patron, $source), + $this->stripIdPrefixes($holdDetails, $source) ); return $groups; } diff --git a/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php b/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php index 74e03b984bb0444e5ce6c54b7d457e3efd281c16..ea5a9fd884deafb70e5e40da6b851e1b84d3426c 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php +++ b/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php @@ -840,14 +840,18 @@ class VoyagerRestful extends Voyager implements \VuFindHttp\HttpServiceAwareInte /** * Get request groups * - * @param int $bibId BIB ID - * @param array $patron Patron information returned by the patronLogin + * @param int $bibId BIB ID + * @param array $patron Patron information returned by the patronLogin * method. + * @param array $holdDetails Optional array, only passed in when getting a list + * in the context of placing a hold; contains most of the same values passed to + * placeHold, minus the patron data. May be used to limit the request group + * options or may be ignored. * * @return array False if request groups not in use or an array of * associative arrays with id and name keys */ - public function getRequestGroups($bibId, $patron) + public function getRequestGroups($bibId, $patron, $holdDetails = null) { if (!$this->requestGroupsEnabled) { return false; diff --git a/module/VuFind/src/VuFind/ILS/Logic/Holds.php b/module/VuFind/src/VuFind/ILS/Logic/Holds.php index 358efcb02e5c5a5276b189e3abd2db64bfc8170f..4f37ad8864fcfffa131250ab84d0beeefd594793 100644 --- a/module/VuFind/src/VuFind/ILS/Logic/Holds.php +++ b/module/VuFind/src/VuFind/ILS/Logic/Holds.php @@ -488,6 +488,9 @@ class Holds */ protected function getRequestDetails($details, $HMACKeys, $action) { + // Include request type in the details + $details['requestType'] = $action; + // Generate HMAC $HMACkey = $this->hmac->generate($HMACKeys, $details);