Skip to content

Commit

Permalink
#7495 Add stageAssignments to submission.stages
Browse files Browse the repository at this point in the history
  • Loading branch information
jardakotesovec committed Oct 3, 2024
1 parent 95b3535 commit 42f0fb7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
11 changes: 8 additions & 3 deletions classes/submission/maps/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ public function getPropertyStages(Submission $submission): array
];

$currentUserAssignedRoles = [];
$stageAssignmentsOverview = [];
if ($currentUser) {
// Replaces StageAssignmentDAO::getBySubmissionAndUserIdAndStageId
$stageAssignments = StageAssignment::withSubmissionIds([$submission->getId()])
Expand All @@ -540,17 +541,21 @@ public function getPropertyStages(Submission $submission): array

// Replaces StageAssignmentDAO::getBySubmissionAndUserIdAndStageId
$stageAssignments = StageAssignment::withSubmissionIds([$submission->getId()])
->withUserId($currentUser->getId())
->withStageIds([$stageId])
->get();

foreach ($stageAssignments as $stageAssignment) {
$userGroup = Repo::userGroup()->get($stageAssignment->userGroupId);
$currentUserAssignedRoles[] = (int) $userGroup->getRoleId();
$stageAssignmentsOverview[] = [
"roleId" => $userGroup->getRoleId(),
"recommendOnly" => $stageAssignment->recommendOnly,
"canChangeMetadata" => $stageAssignment->canChangeMetadata,
"userId" => $stageAssignment->userId
];
}
}
$stage['currentUserAssignedRoles'] = array_values(array_unique($currentUserAssignedRoles));

$stage['stageAssignments'] = $stageAssignmentsOverview;
// Stage-specific statuses
switch ($stageId) {
case WORKFLOW_STAGE_ID_SUBMISSION:
Expand Down
2 changes: 2 additions & 0 deletions locale/en/dashboard.po
Original file line number Diff line number Diff line change
Expand Up @@ -314,3 +314,5 @@ msgstr "An editorial recommendation has been received"
msgid "dashboard.recommendOnly.recommendationsCompleted"
msgstr "All editorial recommendations have been received, and a decision is required."

msgid "dashboard.recommendOnly.onlyAllowedToRecommend"
msgstr "Only allowed to recommend an editorial decision"
1 change: 0 additions & 1 deletion pages/dashboard/DashboardHandlerNext.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ class_exists(\APP\components\forms\publication\AssignToIssueForm::class); // For

'DECISION_RECOMMEND_ACCEPT' => Decision::RECOMMEND_ACCEPT,
'DECISION_RECOMMEND_DECLINE' => Decision::RECOMMEND_DECLINE,
'DECISION_RECOMMEND_ACCEPT' => Decision::RECOMMEND_ACCEPT,
'DECISION_RECOMMEND_PENDING_REVISIONS' => Decision::RECOMMEND_PENDING_REVISIONS,
'DECISION_RECOMMEND_RESUBMIT' => Decision::RECOMMEND_RESUBMIT,

Expand Down

0 comments on commit 42f0fb7

Please sign in to comment.