Skip to content
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
2 changes: 2 additions & 0 deletions code/web/release_notes/26.Q1.02.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
The following notes include hotfix changes that were released on 02/24/26.

## Aspen Discovery Updates
- Bugfix for searching events causing a null-pointer exception. (*JW*)
- Bugfix for ItemAPI endpoints returning an error due to missing fields for MARC record ([DIS-2027] (https://aspen-discovery.atlassian.net/browse/DIS-2027)) (*JW*)


## This release includes code contributions from
Expand Down
39 changes: 33 additions & 6 deletions code/web/services/API/ItemAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,32 @@ class ItemAPI extends AbstractAPI {
*/
protected $recordDriver;

/**
* Centralize MARC fields to one place should specification
* change in the future.
*/
private array $marcFields = [
'isbn',
'upc',
'issn',
'title_display',
'author_display',
'publisherStr',
'placeOfPublication',
'edition',
'callnumber',
'genre',
'series',
'physical',
'lccn',
'contents',
'format',
'format_category',
'language',
'recordtype',
'id'
];

public $record;

public $isbn;
Expand Down Expand Up @@ -99,6 +125,10 @@ function launch() {
}
}

public function getMarcFields() : string {
return implode(',', $this->marcFields);
}

/** @noinspection PhpUnused */
function getDescriptionByTitleAndAuthor() {
global $configArray;
Expand Down Expand Up @@ -230,9 +260,7 @@ function getItem() : array {

// Retrieve Full Marc Record
disableErrorHandler();
$fieldsToReturn = 'isbn,upc,issn,title_display,author_display,publisher,placeOfPublication,edition,callnumber,genre,series,physical,lccn,contents,format,format_category,language';

if (!($record = $this->db->getRecord($this->id, $fieldsToReturn))) {
if (!($record = $this->db->getRecord($this->id, $this->getMarcFields()))) {
return [
'error',
'Record does not exist',
Expand Down Expand Up @@ -363,8 +391,7 @@ function getBasicItemInfo() : array {
}

// Retrieve Full Marc Record
$fieldsToReturn = 'isbn,upc,issn,title_display,author_display,publisherStr,placeOfPublication,format,format_category,language,ils_description,display_description';
if (!($record = $this->db->getRecord($this->id, $fieldsToReturn))) {
if (!($record = $this->db->getRecord($this->id, $this->getMarcFields()))) {
AspenError::raiseError(new AspenError('Record Does Not Exist'));
}
$this->record = $record;
Expand Down Expand Up @@ -1624,4 +1651,4 @@ function getRelatedRecord() {
'record' => $summary,
];
}
}
}
Loading