Skip to content
Snippets Groups Projects
Commit 8f52f00b authored by Dorian Merz's avatar Dorian Merz Committed by André Lahmann
Browse files

refs #9562:

* fixed bug in SolrMarcFincTrait::getWorkPartTitleDetails(). Now uses getData() instead of auto-
* changed preg_replace to rtrim method with same expected output
* corrected function documentation
parent 69a4495c
No related merge requests found
......@@ -670,20 +670,24 @@ trait SolrMarcFincTrait
}
/**
* Get an array of title detail lines with original notations combining
* information from MARC field 245 and linked content in 880.
* Get an array of work part title detail lines with original notations
* from MARC field 505. The lines are combined of information from
* subfield t and (if present) subfield r.
*
* @return array
*/
public function getWorkPartTitleDetails()
{
$workPartTitles = [];
$titleRegexPattern = '/(\s[\/\.:]\s*)*$/';
$truncateTrail = function ($string) use ($titleRegexPattern) {
return preg_replace(
$titleRegexPattern, '', trim($string)
);
//$titleRegexPattern = '/(\s[\/\.:]\s*)*$/';
$truncateTrail = function ($string) /*use ($titleRegexPattern)*/ {
// strip off whitespaces and some special characters
// from the end of the input string
#return preg_replace(
# $titleRegexPattern, '', trim($string)
#);
return rtrim($string," \t\n\r\0\x0B".'.:-/');
};
if ($fields = $this->getMarcRecord()->getFields('505')) {
......@@ -694,8 +698,8 @@ trait SolrMarcFincTrait
// each occurance of $t gets $a pretached if it exists
if (isset($rs[$i])) {
$workPartTitles[] =
$truncateTrail($subfield->getData()) . ' /' .
$truncateTrail($rs[$i]);
$truncateTrail($subfield->getData()) . ': ' .
$truncateTrail($rs[$i]->getData());
} else {
$workPartTitles[] =
$truncateTrail($subfield->getData());
......@@ -709,20 +713,17 @@ trait SolrMarcFincTrait
}
/**
* Get an array of title detail lines with original notations combining
* information from MARC field 245 and linked content in 880.
* Get an array of work title detail lines with original notations
* from MARC field 700.
*
* @return array
*/
public function getWorkTitleDetails()
{
$workTitles = [];
$titleRegexPattern = '/(\s[\/\.:]\s*)*$/';
$truncateTrail = function ($string) use ($titleRegexPattern) {
return preg_replace(
$titleRegexPattern, '', trim($string)
);
$truncateTrail = function ($string) {
return rtrim($string," \t\n\r\0\x0B".'.:-/');
};
if ($fields = $this->getMarcRecord()->getFields('700')) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment