Skip to content

Commit

Permalink
Add more note fields to description display
Browse files Browse the repository at this point in the history
  • Loading branch information
meganschanz committed Oct 9, 2024
1 parent f8bf535 commit c796426
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 21 deletions.
2 changes: 1 addition & 1 deletion module/VuFind/src/VuFind/RecordDriver/EDS.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function getItemsAbstract()
*
* @return array
*/
public function getAbstractAndSummaryNotes()
public function getAbstractNotes()
{
$abstract = $this->getItems(null, null, 'Ab');
return (array)($abstract[0]['Data'] ?? []);
Expand Down
62 changes: 46 additions & 16 deletions module/VuFind/src/VuFind/RecordDriver/Feature/MarcAdvancedTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -558,16 +558,6 @@ protected function getSeriesFromMARC($fieldInfo)
return $matches;
}

/**
* Get an array of summary strings for the record.
*
* @return array
*/
public function getSummary()
{
return $this->getFieldArray('520');
}

/**
* Get an array of technical details on the item represented by the record.
*
Expand Down Expand Up @@ -1258,22 +1248,62 @@ public function getMarcFieldWithInd(
}

/**
* Get the abstract and summary notes
* Get the location of other archival materials notes
*
* @return array Note fields from the MARC record
*/
public function getAbstractAndSummaryNotes()
public function getLocationOfArchivalMaterialsNotes()
{
return $this->getMarcFieldWithInd('544', null, [[1 => ['', '0']]]);
}

/**
* Get an array of summary strings for the record with only the 'a' subfield.
*
* @return array
*/
public function getSummary()
{
return $this->getMarcFieldWithInd('520', null, [[1 => ['', '0', '2', '3', '8']]]);
return $this->getMarcFieldWithInd('520', ['a'], [[1 => ['', '0', '2', '8']]]);
}

/**
* Get the location of other archival materials notes
* Get the summary note
*
* @return array Note fields from the MARC record
*/
public function getLocationOfArchivalMaterialsNotes()
public function getSummaryNotes()
{
return $this->getMarcFieldWithInd('544', null, [[1 => ['', '0']]]);
return $this->getMarcFieldWithInd('520', null, [[1 => ['', '0', '2', '8']]]);
}

/**
* Get the review by notes
*
* @return array Note fields from the MARC record
*/
public function getReviewNotes()
{
return $this->getMarcFieldWithInd('520', null, [[1 => ['1']]]);
}

/**
* Get the abstract notes
*
* @return array Note fields from the MARC record
*/
public function getAbstractNotes()
{
return $this->getMarcFieldWithInd('520', null, [[1 => ['3']]]);
}

/**
* Get the content advice notes
*
* @return array Note fields from the MARC record
*/
public function getContentAdviceNotes()
{
return $this->getMarcFieldWithInd('520', null, [[1 => ['4']]]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,9 @@ public function getDefaultDescriptionSpecs()
{
$spec = new RecordDataFormatter\SpecBuilder();
$spec->setTemplateLine('Summary', true, 'data-summary.phtml');
$spec->setLine('Abstract', 'getAbstractNotes');
$spec->setLine('Review', 'getReviewNotes');
$spec->setLine('Content Advice', 'getContentAdviceNotes');
$spec->setLine('Published', 'getDateSpan');
$spec->setLine('Item Description', 'getGeneralNotes');
$spec->setLine('Physical Description', 'getPhysicalDescriptions');
Expand Down
12 changes: 12 additions & 0 deletions module/VuFind/tests/fixtures/marc/marctraits.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,18 @@
<subfield code="a">Summary.</subfield>
<subfield code="b">Expanded.</subfield>
</datafield>
<datafield tag="520" ind1="1" ind2=" ">
<subfield code="a">Review Note.</subfield>
<subfield code="b">Expanded.</subfield>
</datafield>
<datafield tag="520" ind1="3" ind2=" ">
<subfield code="a">Abstract.</subfield>
<subfield code="b">Expanded.</subfield>
</datafield>
<datafield tag="520" ind1="4" ind2=" ">
<subfield code="a">Content Advice.</subfield>
<subfield code="b">Expanded.</subfield>
</datafield>
<datafield tag="521" ind1=" " ind2=" ">
<subfield code="a">Developers</subfield>
</datafield>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,17 +288,62 @@ public function testGetMarcFieldWithIndNoValues(): void
}

/**
* Test calling getAbstractAndSummaryNotes to get expected marc data
* Test calling getSummaryNotes to get expected marc data
*
* @return void
*/
public function testGetAbstractAndSummaryNotes(): void
public function testGetSummaryNotes(): void
{
$obj = $this->getMockDriverFromFixture('marc/marctraits.xml');

$this->assertEquals(
['Summary. Expanded.'],
$obj->getAbstractAndSummaryNotes()
$obj->getSummaryNotes()
);
}

/**
* Test calling getAbstractNotes to get expected marc data
*
* @return void
*/
public function testGetAbstractNotes(): void
{
$obj = $this->getMockDriverFromFixture('marc/marctraits.xml');

$this->assertEquals(
['Abstract. Expanded.'],
$obj->getAbstractNotes()
);
}

/**
* Test calling getReviewNotes to get expected marc data
*
* @return void
*/
public function testGetReviewNotes(): void
{
$obj = $this->getMockDriverFromFixture('marc/marctraits.xml');

$this->assertEquals(
['Review Note. Expanded.'],
$obj->getReviewNotes()
);
}

/**
* Test calling getContentAdviceNotes to get expected marc data
*
* @return void
*/
public function testGetContentAdviceNotes(): void
{
$obj = $this->getMockDriverFromFixture('marc/marctraits.xml');

$this->assertEquals(
['Content Advice. Expanded.'],
$obj->getContentAdviceNotes()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,14 @@ if ($doi = $this->driver->tryMethod('getCleanDOI')) {
echo 'DO - ' . "$doi\r\n";
}

$abstract = $this->driver->tryMethod('getAbstractAndSummaryNotes');
$summary = $this->driver->tryMethod('getSummaryNotes');
if (is_array($summary)) {
foreach ($summary as $note) {
echo 'AB - ' . "$note\r\n";
}
}

$abstract = $this->driver->tryMethod('getAbstractNotes');
if (is_array($abstract)) {
foreach ($abstract as $note) {
echo 'AB - ' . "$note\r\n";
Expand Down

0 comments on commit c796426

Please sign in to comment.