Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
19 changes: 18 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,23 @@ public function getContainerEndPage()
return '';
}

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

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.

As usual the API repsonses are a bit of a mystery, so I don't know why the page count sometimes comes in via the BibRecord.../Pagination section like start page, and why it's sometimes in the Items data. I assume the answer is "vendor data 🤷 " but @cwolfebsco can you shed any light?

Unfortunately because our EDS templates will display any data that comes from Items, this means that record pages will sometimes display page count and sometimes won't, depending on which field has it. I have a set of configs in my RecordDataFormatter/EDS.ini to hide it from Items and display it via this new method. I don't know if it's generalizable enough to upstream though, even commented out.

[Defaults]
core[] = 'Page Count'
result-list[] = 'Page Count'

[Field_Page Count]
dataMethod = 'getPageCount'
# No thought yet into this positioning
pos = 300

[CoreItems]
...
extraLineOptions[] = 'CorePageCount'

; Need to disable Page Count here from EDS [Items] block
; because we need to load it with getPageCount (above) to cover
; both ways the field can show up from the API.
[CorePageCount]
lineIdentifierKey = 'Name'
lineIdentifierValue = 'Pages'
enabled = false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@maccabeelevine "vendor data" sounds about right, I am afraid :( Our teams try to match the available data the best they can. While a great benefit to have the original record searched, this is one of the unfortunate side effect.

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,17 @@ 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.
{
$driver = $this->getDriver('valid-eds-record');
$this->assertEquals('217', $driver->getPageCount());
}

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