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 fec1f1d commit 907598f
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions OrcidProfilePlugin.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1155,14 +1155,19 @@ 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()->getLocalizedTitle() ?? '']
];

$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'))) {
$externalIds = [

'external-id-type' => 'doi',
'external-id-value' => $submission->getData('pub-id::doi'),
'external-id-url' => [
Expand All @@ -1173,20 +1178,6 @@ public function buildOrcidReview($submission, $review, $request, $issue = null)
];
$orcidReview['subject-external-identifier'] = $externalIds;
}

}

$translatedTitleAvailable = false;
foreach ($supportedSubmissionLocales as $defaultLanguage) {
if ($defaultLanguage !== $publicationLocale) {
$iso2LanguageCode = substr($defaultLanguage, 0, 2);
$defaultTitle = $submission->getLocalizedTitle($iso2LanguageCode);
if (strlen($defaultTitle) > 0 && !$translatedTitleAvailable) {
$orcidReview['subject-name']['translated-title'] = ['value' => $defaultTitle, 'language-code' => $iso2LanguageCode];
$translatedTitleAvailable = true;
}
}

}
}
return $orcidReview;
Expand Down

0 comments on commit 907598f

Please sign in to comment.