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

Sierra: Fix and improve item/bib handling with transaction history #3133

Merged
Merged
Changes from 1 commit
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
Prev Previous commit
Fix accidental reversals.
EreMaijala committed Oct 2, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit dc257d698032dda673999db05242147aa32fb4fe
25 changes: 19 additions & 6 deletions module/VuFind/src/VuFind/ILS/Driver/SierraRest.php
Original file line number Diff line number Diff line change
@@ -2271,6 +2271,9 @@ protected function getItemStatusesForBib(string $id, bool $checkHoldings, ?array
);
}
}
$callNumber = isset($item['callNumber'])
? $this->extractCallNumber($item['callNumber'])
: $bibCallNumber;
$volume = isset($item['varFields']) ? $this->extractVolume($item) : '';

$entry = [
@@ -2280,12 +2283,10 @@ protected function getItemStatusesForBib(string $id, bool $checkHoldings, ?array
'availability' => $available,
'status' => $status,
'reserve' => 'N',
'callnumber' => isset($item['callNumber'])
? preg_replace('/^\|a/', '', $item['callNumber'])
: $bibCallNumber,
'callnumber' => trim($callNumber),
'duedate' => $duedate,
'number' => $volume,
'barcode' => $item['barcode'],
'number' => trim($volume),
'barcode' => $item['barcode'] ?? '',
'sort' => $sort--,
];
if ($notes) {
@@ -2349,7 +2350,7 @@ protected function getItemStatusesForBib(string $id, bool $checkHoldings, ?array
'id' => $id,
'item_id' => "ORDER_{$id}_$locationCode",
'location' => $location,
'callnumber' => $bibCallNumber,
'callnumber' => trim($bibCallNumber),
'number' => '',
'status' => $this->mapStatusCode('Ordered'),
'reserve' => 'N',
@@ -2365,6 +2366,18 @@ protected function getItemStatusesForBib(string $id, bool $checkHoldings, ?array
return $statuses;
}

/**
* Extract the actual call number from item's call number field
*
* @param string $callNumber Call number field
*
* @return string
*/
protected function extractCallNumber(string $callNumber): string
{
return str_starts_with($callNumber, '|a') ? substr($callNumber, 2) : $callNumber;
}

/**
* Get textual messages for orders
*