diff --git a/plugins/gateways/resolver/ResolverPlugin.php b/plugins/gateways/resolver/ResolverPlugin.php index f04a1193c35..b3889e57a6f 100644 --- a/plugins/gateways/resolver/ResolverPlugin.php +++ b/plugins/gateways/resolver/ResolverPlugin.php @@ -139,13 +139,13 @@ public function fetch($args, $request) foreach ($submissions as $submission) { // Look for the correct page in the list of articles. $matches = null; - if (preg_match('/^[Pp][Pp]?[.]?[ ]?(\d+)$/u', $submission->getPages(), $matches)) { + if (preg_match('/^[Pp][Pp]?[.]?[ ]?(\d+)$/u', $submission->getCurrentPublication()->getData('pages'), $matches)) { $matchedPage = $matches[1]; if ($page == $matchedPage) { $request->redirect(null, 'article', 'view', $submission->getBestId()); } } - if (preg_match('/^[Pp][Pp]?[.]?[ ]?(\d+)[ ]?-[ ]?([Pp][Pp]?[.]?[ ]?)?(\d+)$/u', $submission->getPages(), $matches)) { + if (preg_match('/^[Pp][Pp]?[.]?[ ]?(\d+)[ ]?-[ ]?([Pp][Pp]?[.]?[ ]?)?(\d+)$/u', $submission->getCurrentPublication()->getData('pages'), $matches)) { $matchedPageFrom = $matches[1]; $matchedPageTo = $matches[3]; if ($page >= $matchedPageFrom && ($page < $matchedPageTo || ($page == $matchedPageTo && $matchedPageFrom = $matchedPageTo))) { diff --git a/plugins/oaiMetadataFormats/marc/OAIMetadataFormat_MARC.php b/plugins/oaiMetadataFormats/marc/OAIMetadataFormat_MARC.php index 92d8fad3429..9328c2e3c7b 100644 --- a/plugins/oaiMetadataFormats/marc/OAIMetadataFormat_MARC.php +++ b/plugins/oaiMetadataFormats/marc/OAIMetadataFormat_MARC.php @@ -3,8 +3,8 @@ /** * @file plugins/oaiMetadataFormats/marc/OAIMetadataFormat_MARC.php * - * Copyright (c) 2014-2021 Simon Fraser University - * Copyright (c) 2003-2021 John Willinsky + * Copyright (c) 2014-2024 Simon Fraser University + * Copyright (c) 2003-2024 John Willinsky * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. * * @class OAIMetadataFormat_MARC @@ -18,6 +18,9 @@ namespace APP\plugins\oaiMetadataFormats\marc; +use APP\journal\Journal; +use APP\publication\Publication; +use APP\submission\Submission; use APP\template\TemplateManager; use PKP\core\PKPString; use PKP\i18n\LocaleConversion; @@ -33,27 +36,33 @@ class OAIMetadataFormat_MARC extends OAIMetadataFormat */ public function toXml($record, $format = null) { + /** @var Submission $article */ $article = $record->getData('article'); + + /** @var Publication $publication */ + $publication = $article->getCurrentPublication(); + + /** @var Journal $journal */ $journal = $record->getData('journal'); $templateMgr = TemplateManager::getManager(); $templateMgr->assign([ 'journal' => $journal, 'article' => $article, - 'publication' => $article->getCurrentPublication(), + 'publication' => $publication, 'issue' => $record->getData('issue'), 'section' => $record->getData('section') ]); $subjects = array_merge_recursive( - stripAssocArray((array) $article->getDiscipline(null)), - stripAssocArray((array) $article->getSubject(null)) + stripAssocArray((array) $publication->getData('discipline')), + stripAssocArray((array) $publication->getData('subject')) ); $templateMgr->assign([ 'subject' => isset($subjects[$journal->getPrimaryLocale()]) ? $subjects[$journal->getPrimaryLocale()] : '', - 'abstract' => PKPString::html2text($article->getAbstract($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 16477409587..12ac9ffa3b3 100644 --- a/plugins/oaiMetadataFormats/marc/templates/record.tpl +++ b/plugins/oaiMetadataFormats/marc/templates/record.tpl @@ -1,8 +1,8 @@ {** * plugins/oaiMetadataFormats/marc/record.tpl * - * Copyright (c) 2013-2021 Simon Fraser University - * Copyright (c) 2003-2021 John Willinsky + * Copyright (c) 2013-2024 Simon Fraser University + * Copyright (c) 2003-2024 John Willinsky * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. * * MARC-formatted metadata record for an article @@ -10,8 +10,8 @@ - {if $article->getDatePublished()} - "{$article->getDatePublished()|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=$publication->getData('galleys') item=galley} {$galley->getFileType()|escape} @@ -81,13 +81,13 @@ {$language} - {if $article->getCoverage($journal->getPrimaryLocale())} + {if $publication->getData('coverage', $journal->getPrimaryLocale())} - {$article->getCoverage($journal->getPrimaryLocale())|escape} + {$publication->getData('coverage', $journal->getPrimaryLocale())|escape} {/if} - {translate key="submission.copyrightStatement" copyrightYear=$article->getCopyrightYear() copyrightHolder=$article->getCopyrightHolder($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 13e23a5784c..fda87f2a086 100644 --- a/plugins/oaiMetadataFormats/marcxml/OAIMetadataFormat_MARC21.php +++ b/plugins/oaiMetadataFormats/marcxml/OAIMetadataFormat_MARC21.php @@ -3,8 +3,8 @@ /** * @file plugins/oaiMetadataFormats/marcxml/OAIMetadataFormat_MARC21.php * - * Copyright (c) 2014-2021 Simon Fraser University - * Copyright (c) 2003-2021 John Willinsky + * Copyright (c) 2014-2024 Simon Fraser University + * Copyright (c) 2003-2024 John Willinsky * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. * * @class OAIMetadataFormat_MARC21 @@ -18,6 +18,9 @@ namespace APP\plugins\oaiMetadataFormats\marcxml; +use APP\journal\Journal; +use APP\publication\Publication; +use APP\submission\Submission; use APP\template\TemplateManager; use PKP\core\PKPString; use PKP\i18n\LocaleConversion; @@ -33,27 +36,33 @@ class OAIMetadataFormat_MARC21 extends OAIMetadataFormat */ public function toXml($record, $format = null) { + /** @var Submission $article */ $article = $record->getData('article'); + + /** @var Publication $publication */ + $publication = $article->getCurrentPublication(); + + /* @var Journal $journal */ $journal = $record->getData('journal'); $templateMgr = TemplateManager::getManager(); $templateMgr->assign([ 'journal' => $journal, 'article' => $article, - 'publication' => $article->getCurrentPublication(), + 'publication' => $publication, 'issue' => $record->getData('issue'), 'section' => $record->getData('section') ]); $subjects = array_merge_recursive( - stripAssocArray((array) $article->getDiscipline(null)), - stripAssocArray((array) $article->getSubject(null)) + stripAssocArray((array) $publication->getData('discipline')), + stripAssocArray((array) $publication->getData('subject')) ); $templateMgr->assign([ 'subject' => isset($subjects[$journal->getPrimaryLocale()]) ? $subjects[$journal->getPrimaryLocale()] : '', - 'abstract' => PKPString::html2text($article->getAbstract($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 5f326b7b9fb..bf6fde66c36 100644 --- a/plugins/oaiMetadataFormats/marcxml/templates/record.tpl +++ b/plugins/oaiMetadataFormats/marcxml/templates/record.tpl @@ -1,8 +1,8 @@ {** * plugins/oaiMetadataFormats/marcxml/record.tpl * - * Copyright (c) 2013-2021 Simon Fraser University - * Copyright (c) 2003-2021 John Willinsky + * Copyright (c) 2013-2024 Simon Fraser University + * Copyright (c) 2003-2024 John Willinsky * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. * * MARCXML-formatted metadata record for an article @@ -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->getDatePublished()} - "{$article->getDatePublished()|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=$publication->getData('galleys') item=galley} {$galley->getFileType()|escape} @@ -89,13 +89,13 @@ {$language} - {if $article->getCoverage($journal->getPrimaryLocale())} + {if $publication->getData('coverage', $journal->getPrimaryLocale())} - {$article->getCoverage($journal->getPrimaryLocale())|escape} + {$publication->getData('coverage', $journal->getPrimaryLocale())|escape} {/if} - {translate key="submission.copyrightStatement" copyrightYear=$article->getCopyrightYear() copyrightHolder=$article->getCopyrightHolder($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 e474187493b..fd405c7de64 100644 --- a/plugins/oaiMetadataFormats/rfc1807/OAIMetadataFormat_RFC1807.php +++ b/plugins/oaiMetadataFormats/rfc1807/OAIMetadataFormat_RFC1807.php @@ -3,8 +3,8 @@ /** * @file plugins/oaiMetadataFormats/rfc1807/OAIMetadataFormat_RFC1807.php * - * Copyright (c) 2014-2021 Simon Fraser University - * Copyright (c) 2003-2021 John Willinsky + * Copyright (c) 2014-2024 Simon Fraser University + * Copyright (c) 2003-2024 John Willinsky * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. * * @class OAIMetadataFormat_RFC1807 @@ -17,7 +17,12 @@ namespace APP\plugins\oaiMetadataFormats\rfc1807; use APP\core\Application; +use APP\issue\Issue; use APP\issue\IssueAction; +use APP\journal\Journal; +use APP\publication\Publication; +use APP\section\Section; +use APP\submission\Submission; use PKP\db\DAORegistry; use PKP\oai\OAIMetadataFormat; use PKP\oai\OAIUtils; @@ -33,15 +38,21 @@ class OAIMetadataFormat_RFC1807 extends OAIMetadataFormat */ public function toXml($record, $format = null) { + /** @var Submission $article */ $article = &$record->getData('article'); + + /** @var Journal $journal */ $journal = &$record->getData('journal'); + + /* @var Section $section */ $section = &$record->getData('section'); + + /** @var Issue $issue */ $issue = &$record->getData('issue'); - $galleys = &$record->getData('galleys'); + /** @var Publication $publication */ $publication = $article->getCurrentPublication(); - // Publisher $publisher = $journal->getLocalizedName(); // Default $publisherInstitution = $journal->getData('publisherInstitution'); if (!empty($publisherInstitution)) { @@ -50,14 +61,14 @@ public function toXml($record, $format = null) // Sources contains journal title, issue ID, and pages $source = $issue->getIssueIdentification(); - $pages = $article->getPages(); + $pages = $publication->getData('pages'); if (!empty($pages)) { $source .= '; ' . $pages; } // Format creators $creators = []; - foreach ($publication->getAuthors() as $author) { + foreach ($publication->getData('authors') as $author) { $authorName = $author->getFullName(false, true); $affiliation = $author->getLocalizedAffiliation(); if (!empty($affiliation)) { @@ -66,24 +77,35 @@ public function toXml($record, $format = null) $creators[] = $authorName; } - // Subject $supportedLocales = $journal->getSupportedFormLocales(); - $submissionKeywordDao = DAORegistry::getDAO('SubmissionKeywordDAO'); /** @var SubmissionKeywordDAO $submissionKeywordDao */ - $submissionSubjectDao = DAORegistry::getDAO('SubmissionSubjectDAO'); /** @var SubmissionSubjectDAO $submissionSubjectDao */ + + /** @var SubmissionKeywordDAO $submissionKeywordDao */ + $submissionKeywordDao = DAORegistry::getDAO('SubmissionKeywordDAO'); + + /** @var SubmissionSubjectDAO $submissionSubjectDao */ + $submissionSubjectDao = DAORegistry::getDAO('SubmissionSubjectDAO'); + $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 - $coverage = $article->getCoverage($article->getData('locale')); + $coverage = $publication->getData('coverage', $publication->getData('locale')); $issueAction = new IssueAction(); $request = Application::get()->getRequest(); - $url = $request->getDispatcher()->url($request, Application::ROUTE_PAGE, $journal->getPath(), 'article', 'view', [$article->getBestId()], urlLocaleForPage: ''); - $includeUrls = $journal->getSetting('publishingMode') != \APP\journal\Journal::PUBLISHING_MODE_NONE || $issueAction->subscribedUser($request->getUser(), $journal, null, $article->getId()); - $response = "getDispatcher()->url( + $request, + Application::ROUTE_PAGE, + $journal->getPath(), + 'article', + 'view', + [$article->getBestId()], + urlLocaleForPage: '' + ); + $includeUrls = $journal->getData('publishingMode') != Journal::PUBLISHING_MODE_NONE || $issueAction->subscribedUser($request->getUser(), $journal, null, $article->getId()); + return "formatElement('organization', $source) . $this->formatElement('title', $publication->getLocalizedTitle()) . $this->formatElement('type', $section->getLocalizedIdentifyType()) . - $this->formatElement('author', $creators) . - ($article->getDatePublished() ? $this->formatElement('date', $article->getDatePublished()) : '') . + ($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->getLocalizedSponsor()) . - $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"; - - return $response; } /**