Skip to content

Commit

Permalink
pkp#10486 fix context retrieval using the conditional that validates …
Browse files Browse the repository at this point in the history
…whether the context of the request is the same as the context of the submission.
  • Loading branch information
YvesLepidus committed Feb 4, 2025
1 parent 2757b51 commit 6c31032
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions classes/services/PKPSubmissionService.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,10 @@ public function getPropertyReviewAssignments($submission) {

$request = \Application::get()->getRequest();
$currentUser = $request->getUser();
$context = $request->getContext();
if (!$context || $context->getId() != $submission->getData('contextId')) {
$context = Services::get('context')->get($submission->getData('contextId'));
}
$context = Services::get('context')->get($submission->getData('contextId'));
$dateFormatShort = $context->getLocalizedDateFormatShort();
$due = is_null($reviewAssignment->getDateDue()) ? null : strftime($dateFormatShort, strtotime($reviewAssignment->getDateDue()));
Expand Down Expand Up @@ -396,7 +400,10 @@ public function getPropertyStages($submission, $stageIds = null) {
}

$currentUser = \Application::get()->getRequest()->getUser();
$context = Services::get('context')->get($submission->getData('contextId'));
$context = \Application::get()->getRequest()->getContext();
if (!$context || $context->getId() != $submission->getData('contextId')) {
$context = Services::get('context')->get($submission->getData('contextId'));
}
$contextId = $context ? $context->getId() : CONTEXT_ID_NONE;

$stages = array();
Expand Down Expand Up @@ -550,7 +557,11 @@ public function getWorkflowUrlByUserRoles($submission, $userId = null) {
return false;
}

$submissionContext = Services::get('context')->get($submission->getData('contextId'));
$submissionContext = $request->getContext();

if (!$submissionContext || $submissionContext->getId() != $submission->getData('contextId')) {
$submissionContext = Services::get('context')->get($submission->getData('contextId'));
}

$dispatcher = $request->getDispatcher();

Expand Down

0 comments on commit 6c31032

Please sign in to comment.