Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add getDefaultPickUpLocation() to FOLIO driver #3927

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions module/VuFind/src/VuFind/ILS/Driver/Folio.php
Original file line number Diff line number Diff line change
Expand Up @@ -1444,6 +1444,46 @@ public function getPickupLocations($patron, $holdInfo = null)
return $locations;
}

/**
* Get Default Pick Up Location
*
* Returns the default pick up location set in FOLIO user record
*
* @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. (Unused by the FOLIO driver.)
*
* @return false|string The default pickup location for the patron or false
* if the user has to choose.
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function getDefaultPickUpLocation($patron, $holdDetails = null)
{
// There should always be a patron, but just a paranoia check to avoid hitting the API with empty values.
if (!($patron['id'] ?? '')) {
return false;
}

// Find the patron's default pickup location in their preferences
$query = ['query' => 'userId==' . $patron['id']];
foreach (
$this->getPagedResults(
'requestPreferences',
'/request-preference-storage/request-preference',
$query
) as $pref
) {
if ($pref->defaultServicePointId) {
return $pref->defaultServicePointId;
}
}

return false;
}

/**
* This method queries the ILS for a patron's current holds
*
Expand Down
Loading