Skip to content
Open
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
21 changes: 20 additions & 1 deletion module/VuFind/src/VuFind/RecordDriver/EDS.php
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,7 @@ function ($data) {
}

/**
* Get year of containing record.
* Get the start page of the item that contains this record.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated, just a fix.

*
* @return string
*/
Expand Down Expand Up @@ -1099,6 +1099,25 @@ public function getContainerEndPage()
return '';
}

/**
* Get the page count.
*
* @return string
*/
public function getPageCount()
{
if (
$pageCount = $this->extractEbscoDataFromRecordInfo(
'BibRecord/BibEntity/PhysicalDescription/Pagination/PageCount'
)[0] ?? ''
) {
return $pageCount;
} elseif ($pageCount = $this->getItem('Name', 'Pages')[0]['Data'] ?? '') {
return $pageCount;
}
return '';
}

/**
* Returns an array of formats based on publication type.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,35 @@ public function testGetContainerEndPageNoData(): void
$this->assertEquals('', $driver->getContainerEndPage());
}

/**
* Test getPageCount for a record.
*
* @return void
*/
public function testGetPageCount(): void
Comment thread
maccabeelevine marked this conversation as resolved.
{
// Find page count in PhysicalDescription
$driver = $this->getDriver('valid-eds-record');
$this->assertEquals('217', $driver->getPageCount());

// Fail to find it
$json = $this->getJsonFixture('eds/valid-eds-record.json');
unset($json['RecordInfo']['BibRecord']['BibEntity']['PhysicalDescription']['Pagination']);
$driver->setRawData($json);
$this->assertEquals('', $driver->getPageCount());

// Find it in Items
$json['Items'][] =
[
'Name' => 'Pages',
'Label' => 'Page Count',
'Group' => 'Src',
'Data' => '42',
];
$driver->setRawData($json);
$this->assertEquals('42', $driver->getPageCount());
}

/**
* Test getFormats for an ebook record.
*
Expand Down