Skip to content

Commit

Permalink
Merge branch 'fixesAssignmentsImport-797' into 'main'
Browse files Browse the repository at this point in the history
Fixes submission assignment if user has not been imported

See merge request softwares-pkp/plugins_ojs/fullJournalTransfer!48
  • Loading branch information
thiagolepidus committed Apr 18, 2024
2 parents 389db88 + 2069ad9 commit 5a05631
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
29 changes: 29 additions & 0 deletions filter/import/NativeXmlExtendedArticleFilter.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,24 @@ public function parseStage($node, $submission)

public function parseStageAssignment($node, $submission, $stageId)
{
$deployment = $this->getDeployment();

$user = DAORegistry::getDAO('UserDAO')
->getUserByEmail($node->getAttribute('user_email'));

if (is_null($user)) {
$deployment->addWarning(
ASSOC_TYPE_SUBMISSION,
$submission->getId(),
__(
'plugins.importexport.fullJournal.error.userNotFound',
['email' => $node->getAttribute('user_email')]
)
);

return null;
}

$userGroups = DAORegistry::getDAO('UserGroupDAO')
->getByContextId($submission->getContextId())
->toArray();
Expand Down Expand Up @@ -125,13 +140,27 @@ public function parseDecision($node, $submission, $stageId, $reviewRound = null)
public function parseReviewAssignment($node, $reviewRound)
{
$deployment = $this->getDeployment();
$submission = $deployment->getSubmission();

$reviewAssignmentDAO = DAORegistry::getDAO('ReviewAssignmentDAO');
$reviewAssignment = $reviewAssignmentDAO->newDataObject();

$userDAO = DAORegistry::getDAO('UserDAO');
$reviewer = $userDAO->getUserByEmail($node->getAttribute('reviewer_email'));

if (is_null($reviewer)) {
$deployment->addWarning(
ASSOC_TYPE_SUBMISSION,
$submission->getId(),
__(
'plugins.importexport.fullJournal.error.userNotFound',
['email' => $node->getAttribute('reviewer_email')]
)
);

return null;
}

$reviewAssignment->setSubmissionId($reviewRound->getSubmissionId());
$reviewAssignment->setReviewerId($reviewer->getId());
$reviewAssignment->setReviewRoundId($reviewRound->getId());
Expand Down
3 changes: 3 additions & 0 deletions locale/en_US/locale.po
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ msgstr "Importing articles..."

msgid "plugins.importexport.fullJournal.importCompleted"
msgstr "Import completed successfully"

msgid "plugins.importexport.fullJournal.error.userNotFound"
msgstr "User with email {$email} is not present on the site."
3 changes: 3 additions & 0 deletions locale/pt_BR/locale.po
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ msgstr "Importando artigos..."

msgid "plugins.importexport.fullJournal.importCompleted"
msgstr "Importação concluída com sucesso"

msgid "plugins.importexport.fullJournal.error.userNotFound"
msgstr "Usuário com email {$email} não está presente no site."
4 changes: 2 additions & 2 deletions version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<version>
<application>fullJournalTransfer</application>
<type>plugins.importexport</type>
<release>2.0.9.2</release>
<date>2024-04-17</date>
<release>2.0.9.3</release>
<date>2024-04-18</date>
<class>FullJournalImportExportPlugin</class>
</version>

0 comments on commit 5a05631

Please sign in to comment.