Skip to content

Commit

Permalink
Merge pull request #4639 from bozana/7135
Browse files Browse the repository at this point in the history
pkp/pkp-lib#7135 Multiple author affiliations (Ror)
  • Loading branch information
bozana authored Feb 6, 2025
2 parents be4f9c9 + 1b02bef commit 88cb17c
Show file tree
Hide file tree
Showing 24 changed files with 155 additions and 85 deletions.
19 changes: 19 additions & 0 deletions api/v1/rors/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

/**
* @defgroup api_v1_rors Ror API requests
*/

/**
* @file api/v1/rors/index.php
*
* Copyright (c) 2025 Simon Fraser University
* Copyright (c) 2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @ingroup api_v1_rors
*
* @brief Handle API requests for rors.
*/

return new \PKP\handler\APIHandler(new \PKP\API\v1\rors\PKPRorController());
10 changes: 7 additions & 3 deletions cypress/tests/data/60-content/CmontgomerieSubmission.cy.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* @file cypress/tests/data/60-content/CmontgomerieSubmission.cy.js
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2000-2021 John Willinsky
* Copyright (c) 2014-2025 Simon Fraser University
* Copyright (c) 2000-2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
*/
Expand All @@ -28,7 +28,11 @@ describe('Data suite: Cmontgomerie', function() {
{
givenName: {en: 'Mark'},
familyName: {en: 'Irvine'},
affiliation: {en: 'University of Victoria'},
affiliations: [
{
name: {en: 'University of Victoria'}
}
],
email: '[email protected]',
country: 'CA',
userGroupId: Cypress.env('authorUserGroupId')
Expand Down
10 changes: 7 additions & 3 deletions cypress/tests/data/60-content/EostromSubmission.cy.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* @file cypress/tests/data/60-content/EostromSubmission.cy.js
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2000-2021 John Willinsky
* Copyright (c) 2014-2025 Simon Fraser University
* Copyright (c) 2000-2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
*/
Expand All @@ -24,7 +24,11 @@ describe('Data suite tests', function() {
{
givenName: {en: 'Frank'},
familyName: {en: 'van Laerhoven'},
affiliation: {en: 'Indiana University'},
affiliations: [
{
name: {en: 'Indiana University'}
}
],
email: '[email protected]',
country: 'US',
userGroupId: Cypress.env('authorUserGroupId')
Expand Down
10 changes: 7 additions & 3 deletions cypress/tests/data/60-content/KalkhafajiSubmission.cy.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* @file cypress/tests/data/60-content/KalkhafajiSubmission.cy.js
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2000-2021 John Willinsky
* Copyright (c) 2014-2025 Simon Fraser University
* Copyright (c) 2000-2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
*/
Expand All @@ -25,7 +25,11 @@ describe('Data suite tests', function() {
{
givenName: {en: 'Margaret'},
familyName: {en: 'Morse'},
affiliation: {en: 'Stanford University'},
affiliations: [
{
name: {en: 'Stanford University'}
}
],
email: '[email protected]',
country: 'US',
userGroupId: Cypress.env('authorUserGroupId')
Expand Down
7 changes: 5 additions & 2 deletions dbscripts/xml/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<!--
* dbscripts/xml/install.xml
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2003-2021 John Willinsky
* Copyright (c) 2014-2025 Simon Fraser University
* Copyright (c) 2003-2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* Installation descriptor file.
Expand Down Expand Up @@ -39,6 +39,8 @@
<migration class="PKP\migration\install\TombstoneMigration" />
<migration class="PKP\migration\install\DoiMigration" />
<migration class="PKP\migration\install\InstitutionsMigration" />
<migration class="PKP\migration\install\AffiliationsMigration" />
<migration class="PKP\migration\install\RorsMigration" />

<migration class="APP\migration\install\OJSMigration" />

Expand All @@ -53,4 +55,5 @@
<code function="createConfig"/>
<code function="addPluginVersions"/>
<code function="installDefaultNavigationMenus"/>
<code function="updateRorRegistryDataset"/>
</install>
6 changes: 4 additions & 2 deletions dbscripts/xml/upgrade.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<!--
* dbscripts/xml/upgrade.xml
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2003-2021 John Willinsky
* Copyright (c) 2014-2025 Simon Fraser University
* Copyright (c) 2003-2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* Upgrade descriptor file.
Expand Down Expand Up @@ -159,6 +159,8 @@
<migration class="PKP\migration\upgrade\v3_5_0\FilterClassNames"/>
<migration class="APP\migration\upgrade\v3_5_0\I10620_EditorialBoardMemberRole"/>
<migration class="APP\migration\upgrade\v3_5_0\I9707_WeblateUILocales"/>
<migration class="PKP\migration\upgrade\v3_5_0\I7135_CreateAuthorAffiliationsTables"/>
<migration class="PKP\migration\upgrade\v3_5_0\I7135_CreateNewRorRegistryCacheTables"/>
<note file="docs/release-notes/README-3.5.0" />
</upgrade>

Expand Down
2 changes: 1 addition & 1 deletion lib/pkp
Submodule pkp updated 51 files
+177 −0 api/v1/rors/PKPRorController.php
+59 −5 api/v1/submissions/PKPSubmissionController.php
+128 −0 classes/affiliation/Affiliation.php
+119 −0 classes/affiliation/Collector.php
+164 −0 classes/affiliation/DAO.php
+276 −0 classes/affiliation/Repository.php
+109 −0 classes/affiliation/maps/Schema.php
+50 −2 classes/author/Author.php
+3 −24 classes/author/Collector.php
+18 −3 classes/author/DAO.php
+38 −8 classes/author/Repository.php
+9 −2 classes/author/maps/Schema.php
+57 −0 classes/components/forms/FieldAffiliations.php
+12 −8 classes/components/forms/publication/ContributorForm.php
+1 −0 classes/core/EntityDAO.php
+16 −4 classes/facades/Repo.php
+2 −33 classes/identity/Identity.php
+14 −3 classes/install/Installer.php
+6 −3 classes/mail/mailables/SubmissionAcknowledgementOtherAuthors.php
+60 −0 classes/migration/install/AffiliationsMigration.php
+64 −0 classes/migration/install/RorsMigration.php
+62 −0 classes/migration/upgrade/v3_5_0/I7135_CreateAuthorAffiliationsTables.php
+158 −0 classes/migration/upgrade/v3_5_0/I7135_CreateNewRorRegistryCacheTables.php
+174 −0 classes/ror/Collector.php
+202 −0 classes/ror/DAO.php
+171 −0 classes/ror/Repository.php
+76 −0 classes/ror/Ror.php
+97 −0 classes/ror/maps/Schema.php
+28 −22 classes/scheduledTask/PKPScheduler.php
+12 −8 classes/services/PKPSchemaService.php
+20 −8 classes/submission/Repository.php
+445 −0 classes/task/UpdateRorRegistryDataset.php
+34 −2 classes/user/User.php
+20 −3 controllers/grid/settings/user/form/UserDetailsForm.php
+47 −4 controllers/grid/users/author/form/PKPAuthorForm.php
+5 −5 controllers/grid/users/reviewer/form/AdvancedSearchReviewerForm.php
+4 −4 cypress/support/commands_new_workflow.js
+3 −0 locale/en/admin.po
+3 −0 locale/en/api.po
+6 −0 locale/en/manager.po
+18 −0 locale/en/submission.po
+51 −0 locale/en/user.po
+51 −6 plugins/importexport/native/filter/NativeXmlPKPAuthorFilter.php
+1 −1 plugins/importexport/native/filter/NativeXmlPKPPublicationFilter.php
+21 −3 plugins/importexport/native/filter/PKPAuthorNativeXmlFilter.php
+19 −3 plugins/importexport/native/pkp-native.xsd
+46 −0 schemas/affiliation.json
+6 −6 schemas/author.json
+63 −0 schemas/ror.json
+92 −0 templates/images/ror.svg
+3 −3 xml/importexport.xsd
9 changes: 7 additions & 2 deletions pages/article/ArticleHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/**
* @file pages/article/ArticleHandler.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2003-2021 John Willinsky
* Copyright (c) 2014-2025 Simon Fraser University
* Copyright (c) 2003-2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class ArticleHandler
Expand All @@ -30,6 +30,7 @@
use Firebase\JWT\Key;
use PKP\citation\CitationDAO;
use PKP\config\Config;
use PKP\core\Core;
use PKP\core\PKPApplication;
use PKP\core\PKPJwt as JWT;
use PKP\db\DAORegistry;
Expand Down Expand Up @@ -301,6 +302,9 @@ public function view($args, $request)
]);
}

$rorIconPath = Core::getBaseDir() . '/' . PKP_LIB_PATH . '/templates/images/ror.svg';
$rorIdIcon = file_exists($rorIconPath) ? file_get_contents($rorIconPath) : '';

// Assign deprecated values to the template manager for
// compatibility with older themes
$templateMgr->assign([
Expand All @@ -312,6 +316,7 @@ public function view($args, $request)
'keywords' => $publication->getData('keywords'),
'orcidIcon' => OrcidManager::getIcon(),
'orcidUnauthenticatedIcon' => OrcidManager::getUnauthenticatedIcon(),
'rorIdIcon' => $rorIdIcon
]);

// Fetch and assign the galley to the template
Expand Down
2 changes: 1 addition & 1 deletion plugins/generic/crossref
33 changes: 17 additions & 16 deletions plugins/generic/datacite/filter/DataciteXmlFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/**
* @file plugins/generic/datacite/filter/DataciteXmlFilter.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2000-2021 John Willinsky
* Copyright (c) 2014-2025 Simon Fraser University
* Copyright (c) 2000-2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class DataciteXmlFilter
Expand Down Expand Up @@ -297,8 +297,7 @@ public function createCreatorsNode(DOMDocument $doc, Issue $issue, Publication $
$creators[] = [
'name' => $creator,
'orcid' => null,
'affiliation' => null,
'ror' => null
'affiliations' => null
];
break;
}
Expand All @@ -312,17 +311,15 @@ public function createCreatorsNode(DOMDocument $doc, Issue $issue, Publication $
$creators[] = [
'name' => $author->getFullName(false, true, $publication->getData('locale')),
'orcid' => $author->getData('orcidIsVerified') ? $author->getData('orcid') : null,
'affiliation' => $author->getLocalizedData('affiliation', $publication->getData('locale')),
'ror' => $author->getData('rorId') ?? null
'affiliations' => $author->getAffiliations()
];
}
break;
case isset($issue):
$creators[] = [
'name' => $publisher,
'orcid' => null,
'affiliation' => null,
'ror' => null
'affiliations' => null
];
break;
}
Expand All @@ -338,15 +335,19 @@ public function createCreatorsNode(DOMDocument $doc, Issue $issue, Publication $
$node->setAttribute('nameIdentifierScheme', 'ORCID');
$creatorNode->appendChild($node);
}
if ($creator['affiliation']) {
$node = $doc->createElementNS($deployment->getNamespace(), 'affiliation');
if ($creator['ror']) {
$node->setAttribute('affiliationIdentifier', $creator['ror']);
$node->setAttribute('affiliationIdentifierScheme', 'ROR');
$node->setAttribute('schemeURI', 'https://ror.org');
if ($creator['affiliations']) {
// Currently affiliations are only there for Publication objects
foreach ($creator['affiliations'] as $affiliation) {
$node = $doc->createElementNS($deployment->getNamespace(), 'affiliation');
$ror = $affiliation->getRor();
if ($ror) {
$node->setAttribute('affiliationIdentifier', $ror);
$node->setAttribute('affiliationIdentifierScheme', 'ROR');
$node->setAttribute('schemeURI', 'https://ror.org');
}
$node->appendChild($doc->createTextNode($affiliation->getLocalizedName($publication->getData('locale'))));
$creatorNode->appendChild($node);
}
$node->appendChild($doc->createTextNode($creator['affiliation']));
$creatorNode->appendChild($node);
}
$creatorsNode->appendChild($creatorNode);
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/generic/googleScholar
10 changes: 5 additions & 5 deletions plugins/importexport/doaj/filter/DOAJJsonFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/**
* @file plugins/importexport/doaj/filter/DOAJJsonFilter.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2000-2021 John Willinsky
* Copyright (c) 2014-2025 Simon Fraser University
* Copyright (c) 2000-2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class DOAJJsonFilter
Expand Down Expand Up @@ -158,9 +158,9 @@ public function &process(&$pubObject)

foreach ($articleAuthors as $articleAuthor) {
$author = ['name' => $articleAuthor->getFullName(false, false, $publicationLocale)];
$affiliation = $articleAuthor->getAffiliation($publicationLocale);
if (!empty($affiliation)) {
$author['affiliation'] = $affiliation;
$affiliations = $articleAuthor->getLocalizedAffiliationNamesAsString($publicationLocale);
if (!empty($affiliations)) {
$author['affiliations'] = $affiliations;
}
if ($articleAuthor->getData('orcid') && $articleAuthor->getData('orcidIsVerified')) {
$author['orcid_id'] = $articleAuthor->getData('orcid');
Expand Down
22 changes: 16 additions & 6 deletions plugins/importexport/doaj/filter/DOAJXmlFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/**
* @file plugins/importexport/doaj/filter/DOAJXmlFilter.php
*
* Copyright (c) 2014-2022 Simon Fraser University
* Copyright (c) 2000-2022 John Willinsky
* Copyright (c) 2014-2025 Simon Fraser University
* Copyright (c) 2000-2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class DOAJXmlFilter
Expand Down Expand Up @@ -248,8 +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')));
if (in_array($author->getAffiliation($publication->getData('locale')), $affilList) && !empty($affilList[0])) {
$authorNode->appendChild($node = $doc->createElement('affiliationId', htmlspecialchars(current(array_keys($affilList, $author->getAffiliation($publication->getData('locale')))), ENT_COMPAT, 'UTF-8')));
$affiliations = $author->getLocalizedAffiliationNames($publication->getData('locale'));
foreach ($affiliations as $affiliation) {
$authorNode->appendChild(
$doc->createElement(
'affiliationId',
htmlspecialchars(current(array_keys($affilList, $affiliation)), ENT_COMPAT, 'UTF-8')
)
);
}
if ($author->getData('orcid') && $author->getData('orcidIsVerified')) {
$authorNode->appendChild($doc->createElement('orcid_id'))->appendChild($doc->createTextNode($author->getData('orcid')));
Expand All @@ -269,8 +275,12 @@ public function createAffiliationsList($authors, $publication)
{
$affilList = [];
foreach ($authors as $author) {
if (!in_array($author->getAffiliation($publication->getData('locale')), $affilList)) {
$affilList[] = $author->getAffiliation($publication->getData('locale')) ;
$affiliations = $author->getLocalizedAffiliationNames($publication->getData('locale'));
foreach ($affiliations as $affiliation) {
if (!in_array($affiliation, $affilList)) {
$affilList[] = $affiliation;
;
}
}
}
return $affilList;
Expand Down
4 changes: 2 additions & 2 deletions plugins/importexport/native/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ for documentation.

## Sample XML

Sample XML can be found in https://github.com/pkp/ojs/blob/[tag]/cypress/fixtures/export-issues.xml,
where [tag] indicates your version of OJS, e.g.: 3_2_1-0 for OJS 3.1.2-0.
Sample XML can be found in https://github.com/pkp/datasets/blob/main/omp/[branch]/mysql/native-export-sample.xml,
where [branch] indicates the GitHub repository branch name of your OMP version, e.g.: stable-3_3_0 for OJS 3.3.0-x, stable-3_4_0 for OJS 3.4.0-x.
15 changes: 11 additions & 4 deletions plugins/importexport/pubmed/filter/ArticlePubMedXmlFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/**
* @file plugins/importexport/pubmed/filter/ArticlePubMedXmlFilter.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2000-2021 John Willinsky
* Copyright (c) 2014-2025 Simon Fraser University
* Copyright (c) 2000-2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class ArticlePubMedXmlFilter
Expand Down Expand Up @@ -215,8 +215,15 @@ 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())));
}
$authorElement->appendChild($doc->createElement('Affiliation'))->appendChild($doc->createTextNode($author->getLocalizedAffiliation()));

foreach ($author->getAffiliations() as $affiliation) {
$affiliationInfoElement = $doc->createElement('AffiliationInfo');
$affiliationInfoElement->appendChild($doc->createElement('Affiliation'))->appendChild($doc->createTextNode($affiliation->getLocalizedName()));
if ($affiliation->getRor()) {
$affiliationInfoElement->appendChild($identifierNode = $doc->createElement('Identifier'))->appendChild($doc->createTextNode($affiliation->getRor()));
$identifierNode->setAttribute('Source', 'ROR');
}
$authorElement->appendChild($affiliationInfoElement);
}
if ($author->getData('orcid') && $author->getData('orcidIsVerified')) {
// 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
13 changes: 10 additions & 3 deletions plugins/oaiMetadataFormats/dc/tests/OAIMetadataFormat_DCTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
/**
* @file plugins/oaiMetadataFormats/dc/tests/OAIMetadataFormat_DCTest.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2000-2021 John Willinsky
* Copyright (c) 2014-2025 Simon Fraser University
* Copyright (c) 2000-2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class OAIMetadataFormat_DCTest
Expand Down Expand Up @@ -102,7 +102,14 @@ public function testToXml()
$author = new Author();
$author->setGivenName('author-firstname', 'en');
$author->setFamilyName('author-lastname', 'en');
$author->setAffiliation('author-affiliation', 'en');
$author->setAffiliations([
Repo::affiliation()->newDataObject([
'id' => 1,
'authorId' => 1,
'ror' => 'https://ror.org/05ek4tb53',
'name' => ['en' => 'author-affiliation']
])
]);
$author->setEmail('[email protected]');

// Publication
Expand Down
Loading

0 comments on commit 88cb17c

Please sign in to comment.