diff --git a/plugins/generic/datacite/filter/DataciteXmlFilter.php b/plugins/generic/datacite/filter/DataciteXmlFilter.php index 880e16e3812..10a1551cf4d 100644 --- a/plugins/generic/datacite/filter/DataciteXmlFilter.php +++ b/plugins/generic/datacite/filter/DataciteXmlFilter.php @@ -311,7 +311,7 @@ public function createCreatorsNode(DOMDocument $doc, Issue $issue, Publication $ $creators[] = [ 'name' => $author->getFullName(false, true, $publication->getData('locale')), 'orcid' => $author->getOrcid(), - 'affiliations' => $author->getLocalizedAffiliations($publication->getData('locale')) + 'affiliations' => $author->getAffiliations() ]; } break; @@ -336,14 +336,16 @@ public function createCreatorsNode(DOMDocument $doc, Issue $issue, Publication $ $creatorNode->appendChild($node); } if ($creator['affiliations']) { - foreach($creator['affiliations'] as $affiliation) { + // Currently affiliations are only there for Publication objects + foreach ($creator['affiliations'] as $affiliation) { $node = $doc->createElementNS($deployment->getNamespace(), 'affiliation'); - if ($affiliation['ror']) { - $node->setAttribute('affiliationIdentifier', $affiliation['ror']); + $ror = $affiliation->getRor(); + if ($ror) { + $node->setAttribute('affiliationIdentifier', $ror); $node->setAttribute('affiliationIdentifierScheme', 'ROR'); $node->setAttribute('schemeURI', 'https://ror.org'); } - $node->appendChild($doc->createTextNode($affiliation['name'])); + $node->appendChild($doc->createTextNode($affiliation->getLocalizedName($publication->getData('locale')))); $creatorNode->appendChild($node); } } diff --git a/plugins/importexport/doaj/filter/DOAJXmlFilter.php b/plugins/importexport/doaj/filter/DOAJXmlFilter.php index b6429062de6..0052e9757a5 100644 --- a/plugins/importexport/doaj/filter/DOAJXmlFilter.php +++ b/plugins/importexport/doaj/filter/DOAJXmlFilter.php @@ -248,15 +248,14 @@ public function createAuthorNode($doc, $publication, $author, $affilList) $deployment = $this->getDeployment(); $authorNode = $doc->createElement('author'); $authorNode->appendChild($node = $doc->createElement('name', htmlspecialchars($author->getFullName(false, false, $publication->getData('locale')), ENT_COMPAT, 'UTF-8'))); - $affiliations = $author->getLocalizedAffiliationNames($publication->getData('locale')); - foreach ($affiliations as $affiliation) { - if (in_array($affiliation, $affilList) && !empty($affilList[0])) { - $authorNode->appendChild( - $node = $doc->createElement('affiliationId', - htmlspecialchars(current(array_keys($affilList, $affiliation)), ENT_COMPAT, 'UTF-8') - ) - ); - } + // Now, with ROR and multiple affiliations support, we export all affiliations, no matter if the name exists in the publication locale + foreach ($affilList as $affiliation) { + $authorNode->appendChild( + $doc->createElement( + 'affiliationId', + htmlspecialchars(current(array_keys($affilList, $affiliation)), ENT_COMPAT, 'UTF-8') + ) + ); } if ($orcid = $author->getData('orcid')) { $authorNode->appendChild($doc->createElement('orcid_id'))->appendChild($doc->createTextNode($orcid)); @@ -279,7 +278,8 @@ public function createAffiliationsList($authors, $publication) $affiliations = $author->getLocalizedAffiliationNames($publication->getData('locale')); foreach ($affiliations as $affiliation) { if (!in_array($affiliation, $affilList)) { - $affilList[] = $affiliation;; + $affilList[] = $affiliation; + ; } } } diff --git a/plugins/importexport/pubmed/filter/ArticlePubMedXmlFilter.php b/plugins/importexport/pubmed/filter/ArticlePubMedXmlFilter.php index c2416add5f0..c7733e23f83 100644 --- a/plugins/importexport/pubmed/filter/ArticlePubMedXmlFilter.php +++ b/plugins/importexport/pubmed/filter/ArticlePubMedXmlFilter.php @@ -215,17 +215,13 @@ public function generateAuthorNode($doc, $journal, $issue, $submission, $author) $authorElement->appendChild($doc->createElement('FirstName'))->appendChild($doc->createTextNode(ucfirst($author->getLocalizedGivenName()))); $authorElement->appendChild($doc->createElement('LastName'))->appendChild($doc->createTextNode(ucfirst($author->getLocalizedFamilyName()))); } - foreach($author->getLocalizedAffiliations() as $affiliation) { - if(!empty($affiliation['name']) || !empty($affiliation['ror'])) { - $affiliationInfoElement = $doc->createElement('AffiliationInfo'); - if(!empty($affiliation['name'])) { - $affiliationInfoElement->appendChild($doc->createElement('Affiliation'))->appendChild($doc->createTextNode($affiliation['name'])); - } - if(!empty($affiliation['ror'])) { - $affiliationInfoElement->appendChild($doc->createElement('Identifier'))->appendChild($doc->createTextNode($affiliation['ror'])); - } - $authorElement->appendChild($affiliationInfoElement); + foreach ($author->getAffiliations() as $affiliation) { + $affiliationInfoElement = $doc->createElement('AffiliationInfo'); + $affiliationInfoElement->appendChild($doc->createElement('Affiliation'))->appendChild($doc->createTextNode($affiliation->getLocalizedName())); + if ($affiliation->getRor()) { + $affiliationInfoElement->appendChild($doc->createElement('Identifier'))->appendChild($doc->createTextNode($affiliation->getRor())); } + $authorElement->appendChild($affiliationInfoElement); } // We're storing the ORCID with a URL (http://orcid.org/{$ID}), but the XML expects just the ID $orcidId = explode('/', trim($author->getData('orcid') ?? '', '/')); diff --git a/plugins/oaiMetadataFormats/marc/templates/record.tpl b/plugins/oaiMetadataFormats/marc/templates/record.tpl index 7141280746b..09cd002c738 100644 --- a/plugins/oaiMetadataFormats/marc/templates/record.tpl +++ b/plugins/oaiMetadataFormats/marc/templates/record.tpl @@ -34,9 +34,9 @@ {foreach from=$authors item=author} {$author->getFullName(false, true, $journal->getPrimaryLocale())|escape} - {foreach from=$author->getLocalizedAffiliations() item=$affiliation} - {if $affiliation['ror']}{$affiliation['ror']|escape} - {elseif $affiliation['name']}{$affiliation['name']|escape}{/if} + {foreach from=$author->getAffiliations() item=$affiliation} + {if $affiliation->getRor()}{$affiliation->getRor()|escape} + {else}{$affiliation->getLocalizedName($publication->getData('locale'))|escape}{/if} {/foreach} {if $author->getUrl()}{$author->getUrl()|escape}{/if} {if $author->getData('orcid')}{$author->getData('orcid')|escape}{/if} diff --git a/plugins/oaiMetadataFormats/marcxml/templates/record.tpl b/plugins/oaiMetadataFormats/marcxml/templates/record.tpl index f0e9da489dd..1dc8a2db3d9 100644 --- a/plugins/oaiMetadataFormats/marcxml/templates/record.tpl +++ b/plugins/oaiMetadataFormats/marcxml/templates/record.tpl @@ -43,9 +43,9 @@ {foreach from=$authors item=author} {$author->getFullName(false, true, $journal->getPrimaryLocale())|escape} - {foreach from=$author->getLocalizedAffiliations() item=$affiliation} - {if $affiliation['ror']}{$affiliation['ror']|escape} - {elseif $affiliation['name']}{$affiliation['name']|escape}{/if} + {foreach from=$author->getAffiliations() item=$affiliation} + {if $affiliation->getRor()}{$affiliation['ror']|escape} + {else}{$affiliation->getLocalizedName($publication->getData('locale'))|escape}{/if} {/foreach} {if $author->getUrl()}{$author->getUrl()|escape}{/if} {if $author->getData('orcid')}{$author->getData('orcid')|escape}{/if} diff --git a/templates/frontend/objects/article_details.tpl b/templates/frontend/objects/article_details.tpl index 6652cd12672..28c71733f86 100755 --- a/templates/frontend/objects/article_details.tpl +++ b/templates/frontend/objects/article_details.tpl @@ -113,14 +113,12 @@ {$author->getFullName()|escape} - {if $author->getLocalizedAffiliations()} - {foreach $author->getLocalizedAffiliations() as $affiliation} + {foreach $author->getAffiliations() as $affiliation} - {$affiliation['name']|escape} - {if $affiliation['ror']}{$rorIdIcon}{/if} + {$affiliation->getLocalizedName()|escape} + {if $affiliation->getRor()}{$rorIdIcon}{/if}
{/foreach} - {/if} {assign var=authorUserGroup value=$userGroupsById[$author->getData('userGroupId')]} {if $authorUserGroup->showTitle}