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

[FINNA-3169] Quria: Add proper check whether item is reservable #3138

Merged
merged 2 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions module/Finna/src/Finna/ILS/Driver/AxiellWebServices.php
Original file line number Diff line number Diff line change
Expand Up @@ -1120,11 +1120,11 @@ public function getHolding($id, array $patron = null, array $options = [])
*
* @param array $organisationHoldings Organisation holdings
* @param string $id The record id to retrieve the holdings
* @param array $journalInfo Jornal information
* @param ?array $journalInfo Jornal information
*
* @return array
*/
protected function parseHoldings($organisationHoldings, $id, $journalInfo = null)
protected function parseHoldings(array $organisationHoldings, string $id, ?array $journalInfo = null)
{
if ($organisationHoldings[0]->status == 'noHolding') {
return [];
Expand Down
24 changes: 17 additions & 7 deletions module/Finna/src/Finna/ILS/Driver/Quria.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,12 @@ public function getHolding($id, array $patron = null, array $options = [])
}
}
} else {
$result = $this->parseHoldings($holdings, $id);
$result = $this->parseHoldings(
$holdings,
$id,
null,
(string)($response->$functionResult->catalogueRecordDetail->reservable ?? '')
);
}

if (!empty($result)) {
Expand All @@ -333,14 +338,19 @@ public function getHolding($id, array $patron = null, array $options = [])
/**
* This is responsible for iterating the organisation holdings
*
* @param array $organisationHoldings Organisation holdings
* @param string $id The record id to retrieve the holdings
* @param array $journalInfo Jornal information
* @param array $organisationHoldings Organisation holdings
* @param string $id The record id to retrieve the holdings
* @param ?array $journalInfo Jornal information
* @param ?string $reservable Is the record reservable
*
* @return array
*/
protected function parseHoldings($organisationHoldings, $id, $journalInfo = null)
{
protected function parseHoldings(
array $organisationHoldings,
string $id,
?array $journalInfo = null,
?string $reservable = null
) {
$result = [];
foreach ($organisationHoldings as $organisation) {
$holdingsBranch = $journalInfo === null
Expand All @@ -354,7 +364,7 @@ protected function parseHoldings($organisationHoldings, $id, $journalInfo = null
$holdable = $journalInfo['holdable'];
} else {
$reservableId = $branch->reservable ?? '';
$holdable = ($branch->reservationButtonStatus ?? '') == 'reservationOk';
$holdable = $reservable === 'yes';
}
$departments = $this->objectToArray($branch->holdings->holding ?? []);
$organisationId = $branch->id ?? '';
Expand Down