From da87db1cae0c379ff328d75bd11685842a99b650 Mon Sep 17 00:00:00 2001 From: Kaitlin Newson Date: Tue, 10 Dec 2024 14:45:34 -0400 Subject: [PATCH] pkp/pkp-lib#10653 remove deprecated submission functions --- .../marc/OAIMetadataFormat_MARC.php | 14 +++++++++----- .../oaiMetadataFormats/marc/templates/record.tpl | 12 ++++++------ .../marcxml/OAIMetadataFormat_MARC21.php | 14 +++++++++----- .../marcxml/templates/record.tpl | 16 ++++++++-------- .../rfc1807/OAIMetadataFormat_RFC1807.php | 13 ++++++------- 5 files changed, 38 insertions(+), 31 deletions(-) diff --git a/plugins/oaiMetadataFormats/marc/OAIMetadataFormat_MARC.php b/plugins/oaiMetadataFormats/marc/OAIMetadataFormat_MARC.php index 9da40347bba..9328c2e3c7b 100644 --- a/plugins/oaiMetadataFormats/marc/OAIMetadataFormat_MARC.php +++ b/plugins/oaiMetadataFormats/marc/OAIMetadataFormat_MARC.php @@ -19,6 +19,7 @@ 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; @@ -38,6 +39,9 @@ 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'); @@ -45,20 +49,20 @@ public function toXml($record, $format = null) $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->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..12ac9ffa3b3 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=$publication->getData('galleys') 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..fda87f2a086 100644 --- a/plugins/oaiMetadataFormats/marcxml/OAIMetadataFormat_MARC21.php +++ b/plugins/oaiMetadataFormats/marcxml/OAIMetadataFormat_MARC21.php @@ -19,6 +19,7 @@ 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; @@ -38,6 +39,9 @@ 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'); @@ -45,20 +49,20 @@ public function toXml($record, $format = null) $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->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..bf6fde66c36 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=$publication->getData('galleys') 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"; }