Skip to content

Commit

Permalink
#322 Unable to submit review data with multilingual submission
Browse files Browse the repository at this point in the history
  • Loading branch information
ewhanson committed Dec 19, 2024
1 parent c9eedb6 commit 9902d14
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions OrcidProfilePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,16 @@ public function buildOrcidReview($submission, $review, $request, $issue = null)
$orcidReview['subject-url'] = ['value' => $publicationUrl];
$orcidReview['review-url'] = ['value' => $publicationUrl];
$orcidReview['subject-type'] = 'journal-article';
$orcidReview['subject-name'] = [
'title' => ['value' => $submission->getCurrentPublication()->getLocalizedData('title') ?? '']
];

$allTitles = $submission->getCurrentPublication()->getData('title');
$submissionLocale = $submission->getData('locale');
foreach ($allTitles as $locale => $title) {
if ($locale === $submissionLocale) {
$orcidReview['subject-name']['title'] = ['value' => $title];
} else {
$orcidReview['subject-name']['translated-title'] = ['value' => $title, 'language-code' => substr($locale, 0, 2)];
}
}


if (!empty($submission->getData('pub-id::doi'))) {
Expand All @@ -501,17 +508,6 @@ public function buildOrcidReview($submission, $review, $request, $issue = null)
}
}

$translatedTitleAvailable = false;
foreach ($supportedSubmissionLocales as $defaultLanguage) {
if ($defaultLanguage !== $publicationLocale) {
$iso2LanguageCode = substr($defaultLanguage, 0, 2);
$defaultTitle = $submission->getLocalizedData($iso2LanguageCode);
if (strlen($defaultTitle) > 0 && !$translatedTitleAvailable) {
$orcidReview['subject-name']['translated-title'] = ['value' => $defaultTitle, 'language-code' => $iso2LanguageCode];
$translatedTitleAvailable = true;
}
}
}
return $orcidReview;
}
}
Expand Down Expand Up @@ -1198,7 +1194,7 @@ public function sendSubmissionToOrcid($publication, $request)
error_log('Application is set to sandbox mode and will not have any interaction with orcid service');
return new JSONMessage(false, __('common.sandbox'));
}

$context = $request->getContext();
$contextId = $this->currentContextId = $context->getId();
$publicationId = $publication->getId();
Expand Down

0 comments on commit 9902d14

Please sign in to comment.