diff --git a/plugins/oaiMetadataFormats/marc/OAIMetadataFormat_MARC.php b/plugins/oaiMetadataFormats/marc/OAIMetadataFormat_MARC.php index 9da40347bba..57c8963efab 100644 --- a/plugins/oaiMetadataFormats/marc/OAIMetadataFormat_MARC.php +++ b/plugins/oaiMetadataFormats/marc/OAIMetadataFormat_MARC.php @@ -18,7 +18,9 @@ namespace APP\plugins\oaiMetadataFormats\marc; +use APP\core\Application; use APP\journal\Journal; +use APP\publication\Publication; use APP\submission\Submission; use APP\template\TemplateManager; use PKP\core\PKPString; @@ -38,6 +40,12 @@ public function toXml($record, $format = null) /** @var Submission $article */ $article = $record->getData('article'); + /** @var Publication $publication */ + $publication = $article->getCurrentPublication(); + + $representationDao = Application::getRepresentationDAO(); + $representations = $representationDao->getByPublicationId($publication->getId()); + /** @var Journal $journal */ $journal = $record->getData('journal'); @@ -45,20 +53,21 @@ public function toXml($record, $format = null) $templateMgr->assign([ 'journal' => $journal, 'article' => $article, - 'publication' => $article->getCurrentPublication(), + 'publication' => $publication, + 'representations' => $representations, 'issue' => $record->getData('issue'), 'section' => $record->getData('section') ]); $subjects = array_merge_recursive( - stripAssocArray((array) $article->getData('discipline')), - stripAssocArray((array) $article->getData('subject')) + stripAssocArray((array) $publication->getData('discipline')), + stripAssocArray((array) $publication->getData('subject')) ); $templateMgr->assign([ 'subject' => isset($subjects[$journal->getPrimaryLocale()]) ? $subjects[$journal->getPrimaryLocale()] : '', - 'abstract' => PKPString::html2text($article->getData('abstract', $article->getData('locale'))), - 'language' => LocaleConversion::get3LetterIsoFromLocale($article->getData('locale')) + 'abstract' => PKPString::html2text($publication->getData('abstract', $publication->getData('locale'))), + 'language' => LocaleConversion::get3LetterIsoFromLocale($publication->getData('locale')) ]); $plugin = PluginRegistry::getPlugin('oaiMetadataFormats', 'OAIFormatPlugin_MARC'); diff --git a/plugins/oaiMetadataFormats/marc/templates/record.tpl b/plugins/oaiMetadataFormats/marc/templates/record.tpl index 9331202b100..6fae6da6ca2 100644 --- a/plugins/oaiMetadataFormats/marc/templates/record.tpl +++ b/plugins/oaiMetadataFormats/marc/templates/record.tpl @@ -10,8 +10,8 @@ - {if $article->getData('datePublished')} - "{$article->getData('datePublished')|strtotime|date_format:"%y%m%d %Y"} eng " + {if $publication->getData('datePublished')} + "{$publication->getData('datePublished')|strtotime|date_format:"%y%m%d %Y"} eng " {/if} {if $journal->getData('onlineIssn')} @@ -63,7 +63,7 @@ {$identifyType|escape} {/if} - {foreach from=$article->getGalleys() item=galley} + {foreach from=$representations item=galley} {$galley->getFileType()|escape} @@ -81,13 +81,13 @@ {$language} - {if $article->getData('coverage', $journal->getPrimaryLocale())} + {if $publication->getData('coverage', $journal->getPrimaryLocale())} - {$article->getData('coverage', $journal->getPrimaryLocale())|escape} + {$publication->getData('coverage', $journal->getPrimaryLocale())|escape} {/if} - {translate key="submission.copyrightStatement" copyrightYear=$article->getdata('copyrightYear') copyrightHolder=$article->getData('copyrightHolder', $journal->getPrimaryLocale())|escape} + {translate key="submission.copyrightStatement" copyrightYear=$publication->getdata('copyrightYear') copyrightHolder=$publication->getData('copyrightHolder', $journal->getPrimaryLocale())|escape} diff --git a/plugins/oaiMetadataFormats/marcxml/OAIMetadataFormat_MARC21.php b/plugins/oaiMetadataFormats/marcxml/OAIMetadataFormat_MARC21.php index a79a939bae9..faa4822b7b4 100644 --- a/plugins/oaiMetadataFormats/marcxml/OAIMetadataFormat_MARC21.php +++ b/plugins/oaiMetadataFormats/marcxml/OAIMetadataFormat_MARC21.php @@ -18,7 +18,9 @@ namespace APP\plugins\oaiMetadataFormats\marcxml; +use APP\core\Application; use APP\journal\Journal; +use APP\publication\Publication; use APP\submission\Submission; use APP\template\TemplateManager; use PKP\core\PKPString; @@ -38,6 +40,12 @@ public function toXml($record, $format = null) /** @var Submission $article */ $article = $record->getData('article'); + /** @var Publication $publication */ + $publication = $article->getCurrentPublication(); + + $representationDao = Application::getRepresentationDAO(); + $representations = $representationDao->getByPublicationId($publication->getId()); + /* @var Journal $journal */ $journal = $record->getData('journal'); @@ -45,20 +53,21 @@ public function toXml($record, $format = null) $templateMgr->assign([ 'journal' => $journal, 'article' => $article, - 'publication' => $article->getCurrentPublication(), + 'publication' => $publication, + 'representations' => $representations, 'issue' => $record->getData('issue'), 'section' => $record->getData('section') ]); $subjects = array_merge_recursive( - stripAssocArray((array) $article->getData('discipline')), - stripAssocArray((array) $article->getData('subject')) + stripAssocArray((array) $publication->getData('discipline')), + stripAssocArray((array) $publication->getData('subject')) ); $templateMgr->assign([ 'subject' => isset($subjects[$journal->getPrimaryLocale()]) ? $subjects[$journal->getPrimaryLocale()] : '', - 'abstract' => PKPString::html2text($article->getData('abstract', $article->getData('locale'))), - 'language' => LocaleConversion::get3LetterIsoFromLocale($article->getData('locale')) + 'abstract' => PKPString::html2text($publication->getData('abstract', $publication->getData('locale'))), + 'language' => LocaleConversion::get3LetterIsoFromLocale($publication->getData('locale')) ]); $plugin = PluginRegistry::getPlugin('oaiMetadataFormats', 'OAIFormatPlugin_MARC21'); diff --git a/plugins/oaiMetadataFormats/marcxml/templates/record.tpl b/plugins/oaiMetadataFormats/marcxml/templates/record.tpl index 5bb54755be6..b229800296e 100644 --- a/plugins/oaiMetadataFormats/marcxml/templates/record.tpl +++ b/plugins/oaiMetadataFormats/marcxml/templates/record.tpl @@ -12,8 +12,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/MARC21/slim https://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd"> nmb a2200000Iu 4500 - {if $article->getData('datePublished')} - "{$article->getData('datePublished')|strtotime|date_format:"%y%m%d %Y"} eng " + {if $publication->getData('datePublished')} + "{$publication->getData('datePublished')|strtotime|date_format:"%y%m%d %Y"} eng " {/if} {if $journal->getData('onlineIssn')} @@ -25,9 +25,9 @@ {$journal->getData('printIssn')|escape} {/if} - {if $article->getStoredPubId('doi')} + {if $publication->getStoredPubId('doi')} - {$article->getStoredPubId('doi')|escape} + {$publication->getStoredPubId('doi')|escape} doi {/if} @@ -72,7 +72,7 @@ {$identifyType|escape} {/if} - {foreach from=$article->getGalleys() item=galley} + {foreach from=$representations item=galley} {$galley->getFileType()|escape} @@ -89,13 +89,13 @@ {$language} - {if $article->getData('coverage', $journal->getPrimaryLocale())} + {if $publication->getData('coverage', $journal->getPrimaryLocale())} - {$article->getData('coverage', $journal->getPrimaryLocale())|escape} + {$publication->getData('coverage', $journal->getPrimaryLocale())|escape} {/if} - {translate key="submission.copyrightStatement" copyrightYear=$article->getdata('copyrightYear') copyrightHolder=$article->getData('copyrightHolder', $journal->getPrimaryLocale())|escape} + {translate key="submission.copyrightStatement" copyrightYear=$publication->getdata('copyrightYear') copyrightHolder=$publication->getData('copyrightHolder', $journal->getPrimaryLocale())|escape} diff --git a/plugins/oaiMetadataFormats/rfc1807/OAIMetadataFormat_RFC1807.php b/plugins/oaiMetadataFormats/rfc1807/OAIMetadataFormat_RFC1807.php index 9b40ec58724..fd405c7de64 100644 --- a/plugins/oaiMetadataFormats/rfc1807/OAIMetadataFormat_RFC1807.php +++ b/plugins/oaiMetadataFormats/rfc1807/OAIMetadataFormat_RFC1807.php @@ -61,7 +61,7 @@ public function toXml($record, $format = null) // Sources contains journal title, issue ID, and pages $source = $issue->getIssueIdentification(); - $pages = $article->getData('pages'); + $pages = $publication->getData('pages'); if (!empty($pages)) { $source .= '; ' . $pages; } @@ -87,11 +87,11 @@ public function toXml($record, $format = null) $subjects = array_merge_recursive( (array) $submissionKeywordDao->getKeywords($publication->getId(), $supportedLocales), - (array) $submissionSubjectDao->getSubjects($article->getCurrentPublication()->getId(), $supportedLocales) + (array) $submissionSubjectDao->getSubjects($publication->getId(), $supportedLocales) ); $subject = $subjects[$journal->getPrimaryLocale()] ?? ''; - $coverage = $article->getData('coverage', $article->getData('locale')); + $coverage = $publication->getData('coverage', $publication->getData('locale')); $issueAction = new IssueAction(); $request = Application::get()->getRequest(); @@ -117,15 +117,14 @@ public function toXml($record, $format = null) $this->formatElement('organization', $source) . $this->formatElement('title', $publication->getLocalizedTitle()) . $this->formatElement('type', $section->getLocalizedIdentifyType()) . - $this->formatElement('author', $creators) . - ($article->getData('datePublished') ? $this->formatElement('date', $article->getData('datePublished')) : '') . + ($publication->getData('datePublished') ? $this->formatElement('date', $publication->getData('datePublished')) : '') . $this->formatElement('copyright', strip_tags($journal->getLocalizedData('licenseTerms'))) . ($includeUrls ? $this->formatElement('other_access', "url:{$url}") : '') . $this->formatElement('keyword', $subject) . $this->formatElement('period', $coverage) . - $this->formatElement('monitoring', $article->getLocalizedData('sponsor')) . - $this->formatElement('language', $article->getData('locale')) . + $this->formatElement('monitoring', $publication->getLocalizedData('sponsor')) . + $this->formatElement('language', $publication->getData('locale')) . $this->formatElement('abstract', strip_tags($publication->getLocalizedData('abstract'))) . "\n"; }