Skip to content

Commit

Permalink
pkp/pkp-lib#9894 add keywords and fix locale for subjects in onix export
Browse files Browse the repository at this point in the history
  • Loading branch information
kaitlinnewson authored and asmecher committed Jun 24, 2024
1 parent 58b9889 commit 28aebc9
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions plugins/importexport/onix30/filter/MonographONIX30XmlFilter.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@ function createProductNode($doc, $submission, $publicationFormat) {
unset($extentNode);
}


/* --- Add Subject elements --- */

$subjectNode = $doc->createElementNS($deployment->getNamespace(), 'Subject');
Expand All @@ -411,19 +410,20 @@ function createProductNode($doc, $submission, $publicationFormat) {
$subjectNode->appendChild($this->_buildTextNode($doc, 'SubjectSchemeIdentifier', '12')); // 12 is BIC subject category code list.
$subjectNode->appendChild($this->_buildTextNode($doc, 'SubjectSchemeVersion', '2')); // Version 2 of ^^

$submissionSubjectDao = DAORegistry::getDAO('SubmissionSubjectDAO');
$allSubjects = $submissionSubjectDao->getSubjects($publication->getId(), array_keys(AppLocale::getSupportedFormLocales()));
$uniqueSubjects = array();
foreach ($allSubjects as $locale => $subjects) {
$uniqueSubjects = array_merge($uniqueSubjects, $subjects);
if ($publication->getData('subjects')) {
$allSubjects = ($publication->getData('subjects')[$publication->getData('locale')]);
$subjectNode->appendChild($this->_buildTextNode($doc, 'SubjectCode', trim(join(', ', $allSubjects))));
}
$descDetailNode->appendChild($subjectNode);

if (sizeof($uniqueSubjects) > 0) {
$subjectNode->appendChild($this->_buildTextNode($doc, 'SubjectCode', trim(join(', ', $uniqueSubjects))));
if ($publication->getData('keywords')) {
$allKeywords = ($publication->getData('keywords')[$publication->getData('locale')]);
$keywordNode = $doc->createElementNS($deployment->getNamespace(), 'Subject');
$keywordNode->appendChild($this->_buildTextNode($doc, 'SubjectSchemeIdentifier', '20')); // Keywords
$keywordNode->appendChild($this->_buildTextNode($doc, 'SubjectHeadingText', trim(join(', ', $allKeywords))));
$descDetailNode->appendChild($keywordNode);
}

$descDetailNode->appendChild($subjectNode);

/* --- Add Audience elements --- */

if ($submission->getData('audience')) {
Expand Down

0 comments on commit 28aebc9

Please sign in to comment.