Skip to content

Commit

Permalink
changes and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bozana committed Jan 22, 2025
1 parent 4bb9ae2 commit eb203f6
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 36 deletions.
13 changes: 8 additions & 5 deletions plugins/generic/datacite/filter/DataciteXmlFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -336,14 +336,17 @@ 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) {
/** @var Affiliation $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);
}
}
Expand Down
20 changes: 10 additions & 10 deletions plugins/importexport/doaj/filter/DOAJXmlFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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;
;
}
}
}
Expand Down
17 changes: 7 additions & 10 deletions plugins/importexport/pubmed/filter/ArticlePubMedXmlFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,17 +215,14 @@ 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) {
/** @var Affiliation $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') ?? '', '/'));
Expand Down
6 changes: 3 additions & 3 deletions plugins/oaiMetadataFormats/marc/templates/record.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
{foreach from=$authors item=author}
<varfield id="{if $authors|@count==1}100{else}720{/if}" i1="1" i2=" ">
<subfield label="a">{$author->getFullName(false, true, $journal->getPrimaryLocale())|escape}</subfield>
{foreach from=$author->getLocalizedAffiliations() item=$affiliation}
{if $affiliation['ror']}<subfield code="u">{$affiliation['ror']|escape}</subfield>
{elseif $affiliation['name']}<subfield code="u">{$affiliation['name']|escape}</subfield>{/if}
{foreach from=$author->getAffiliations() item=$affiliation}
{if $affiliation->getROR()}<subfield code="u">{$affiliation->getROR()|escape}</subfield>
{else}<subfield code="u">{$affiliation->getLocalizedName($publication->getData('locale'))|escape}</subfield>{/if}
{/foreach}
{if $author->getUrl()}<subfield label="0">{$author->getUrl()|escape}</subfield>{/if}
{if $author->getData('orcid')}<subfield label="0">{$author->getData('orcid')|escape}</subfield>{/if}
Expand Down
6 changes: 3 additions & 3 deletions plugins/oaiMetadataFormats/marcxml/templates/record.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
{foreach from=$authors item=author}
<datafield tag="{if $authors|@count==1}100{else}720{/if}" ind1="1" ind2=" ">
<subfield code="a">{$author->getFullName(false, true, $journal->getPrimaryLocale())|escape}</subfield>
{foreach from=$author->getLocalizedAffiliations() item=$affiliation}
{if $affiliation['ror']}<subfield code="u">{$affiliation['ror']|escape}</subfield>
{elseif $affiliation['name']}<subfield code="u">{$affiliation['name']|escape}</subfield>{/if}
{foreach from=$author->getAffiliations() item=$affiliation}
{if $affiliation->getROR()}<subfield code="u">{$affiliation['ror']|escape}</subfield>
{else}<subfield code="u">{$affiliation->getLocalizedName($publication->getData('locale'))|escape}</subfield>{/if}
{/foreach}
{if $author->getUrl()}<subfield code="0">{$author->getUrl()|escape}</subfield>{/if}
{if $author->getData('orcid')}<subfield code="0">{$author->getData('orcid')|escape}</subfield>{/if}
Expand Down
8 changes: 3 additions & 5 deletions templates/frontend/objects/article_details.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,12 @@
<span class="name">
{$author->getFullName()|escape}
</span>
{if $author->getLocalizedAffiliations()}
{foreach $author->getLocalizedAffiliations() as $affiliation}
{foreach $author->getAffiliations() as $affiliation}
<span class="affiliation">
{$affiliation['name']|escape}
{if $affiliation['ror']}<a href="{$affiliation['ror']|escape}">{$rorIdIcon}</a>{/if}
{$affiliation->getLocalizedName()|escape}
{if $affiliation->getROR()}<a href="{$affiliation->getROR()|escape}">{$rorIdIcon}</a>{/if}
</span><br/>
{/foreach}
{/if}
{assign var=authorUserGroup value=$userGroupsById[$author->getData('userGroupId')]}
{if $authorUserGroup->showTitle}
<span class="userGroup">
Expand Down

0 comments on commit eb203f6

Please sign in to comment.