Skip to content

Commit

Permalink
pkp/pkp-lib#10653 remove deprecated submission functions
Browse files Browse the repository at this point in the history
  • Loading branch information
kaitlinnewson committed Dec 10, 2024
1 parent 9ba8d0e commit 07f52c1
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 31 deletions.
19 changes: 14 additions & 5 deletions plugins/oaiMetadataFormats/marc/OAIMetadataFormat_MARC.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -38,27 +40,34 @@ 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');

$templateMgr = TemplateManager::getManager();
$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');
Expand Down
12 changes: 6 additions & 6 deletions plugins/oaiMetadataFormats/marc/templates/record.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<oai_marc status="c" type="a" level="m" encLvl="3" catForm="u"
xmlns="http://www.openarchives.org/OAI/1.1/oai_marc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.openarchives.org/OAI/1.1/oai_marc http://www.openarchives.org/OAI/1.1/oai_marc.xsd">
{if $article->getData('datePublished')}
<fixfield id="008">"{$article->getData('datePublished')|strtotime|date_format:"%y%m%d %Y"} eng "</fixfield>
{if $publication->getData('datePublished')}
<fixfield id="008">"{$publication->getData('datePublished')|strtotime|date_format:"%y%m%d %Y"} eng "</fixfield>
{/if}
{if $journal->getData('onlineIssn')}
<varfield id="022" i1="#" i2="#">
Expand Down Expand Up @@ -63,7 +63,7 @@
<subfield label="a">{$identifyType|escape}</subfield>
</varfield>{/if}

{foreach from=$article->getGalleys() item=galley}
{foreach from=$representations item=galley}
<varfield id="856" i1=" " i2=" ">
<subfield label="q">{$galley->getFileType()|escape}</subfield>
</varfield>
Expand All @@ -81,13 +81,13 @@
<subfield label="a">{$language}</subfield>
</varfield>

{if $article->getData('coverage', $journal->getPrimaryLocale())}
{if $publication->getData('coverage', $journal->getPrimaryLocale())}
<varfield id="500" i1=" " i2=" ">
<subfield label="a">{$article->getData('coverage', $journal->getPrimaryLocale())|escape}</subfield>
<subfield label="a">{$publication->getData('coverage', $journal->getPrimaryLocale())|escape}</subfield>
</varfield>
{/if}

<varfield id="540" i1=" " i2=" ">
<subfield label="a">{translate key="submission.copyrightStatement" copyrightYear=$article->getdata('copyrightYear') copyrightHolder=$article->getData('copyrightHolder', $journal->getPrimaryLocale())|escape}</subfield>
<subfield label="a">{translate key="submission.copyrightStatement" copyrightYear=$publication->getdata('copyrightYear') copyrightHolder=$publication->getData('copyrightHolder', $journal->getPrimaryLocale())|escape}</subfield>
</varfield>
</oai_marc>
19 changes: 14 additions & 5 deletions plugins/oaiMetadataFormats/marcxml/OAIMetadataFormat_MARC21.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -38,27 +40,34 @@ 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');

$templateMgr = TemplateManager::getManager();
$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');
Expand Down
16 changes: 8 additions & 8 deletions plugins/oaiMetadataFormats/marcxml/templates/record.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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">
<leader> nmb a2200000Iu 4500</leader>
{if $article->getData('datePublished')}
<controlfield tag="008">"{$article->getData('datePublished')|strtotime|date_format:"%y%m%d %Y"} eng "</controlfield>
{if $publication->getData('datePublished')}
<controlfield tag="008">"{$publication->getData('datePublished')|strtotime|date_format:"%y%m%d %Y"} eng "</controlfield>
{/if}
{if $journal->getData('onlineIssn')}
<datafield tag="022" ind1="#" ind2="#">
Expand All @@ -25,9 +25,9 @@
<subfield code="a">{$journal->getData('printIssn')|escape}</subfield>
</datafield>
{/if}
{if $article->getStoredPubId('doi')}
{if $publication->getStoredPubId('doi')}
<datafield tag="024" ind1="7" ind2="#">
<subfield code="a">{$article->getStoredPubId('doi')|escape}</subfield>
<subfield code="a">{$publication->getStoredPubId('doi')|escape}</subfield>
<subfield code="2">doi</subfield>
</datafield>
{/if}
Expand Down Expand Up @@ -72,7 +72,7 @@
<subfield code="a">{$identifyType|escape}</subfield>
</datafield>{/if}

{foreach from=$article->getGalleys() item=galley}
{foreach from=$representations item=galley}
<datafield tag="856" ind1=" " ind2=" ">
<subfield code="q">{$galley->getFileType()|escape}</subfield>
</datafield>
Expand All @@ -89,13 +89,13 @@
<subfield code="a">{$language}</subfield>
</datafield>

{if $article->getData('coverage', $journal->getPrimaryLocale())}
{if $publication->getData('coverage', $journal->getPrimaryLocale())}
<datafield tag="500" ind1=" " ind2=" ">
<subfield code="a">{$article->getData('coverage', $journal->getPrimaryLocale())|escape}</subfield>
<subfield code="a">{$publication->getData('coverage', $journal->getPrimaryLocale())|escape}</subfield>
</datafield>
{/if}

<datafield tag="540" ind1=" " ind2=" ">
<subfield code="a">{translate key="submission.copyrightStatement" copyrightYear=$article->getdata('copyrightYear') copyrightHolder=$article->getData('copyrightHolder', $journal->getPrimaryLocale())|escape}</subfield>
<subfield code="a">{translate key="submission.copyrightStatement" copyrightYear=$publication->getdata('copyrightYear') copyrightHolder=$publication->getData('copyrightHolder', $journal->getPrimaryLocale())|escape}</subfield>
</datafield>
</record>
13 changes: 6 additions & 7 deletions plugins/oaiMetadataFormats/rfc1807/OAIMetadataFormat_RFC1807.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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();
Expand All @@ -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'))) .
"</rfc1807>\n";
}
Expand Down

0 comments on commit 07f52c1

Please sign in to comment.