Skip to content

Commit

Permalink
#10214 Editorial reminder issue update
Browse files Browse the repository at this point in the history
  • Loading branch information
touhidurabir committed Dec 25, 2024
1 parent 4788455 commit 753129c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
1 change: 1 addition & 0 deletions classes/submission/reviewRound/ReviewRound.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ public function determineStatus()
break;

case ReviewAssignment::REVIEW_ASSIGNMENT_STATUS_AWAITING_RESPONSE:
case ReviewAssignment::REVIEW_ASSIGNMENT_STATUS_REQUEST_RESEND:
case ReviewAssignment::REVIEW_ASSIGNMENT_STATUS_ACCEPTED:
$anyIncompletedReview = true;
break;
Expand Down
32 changes: 23 additions & 9 deletions jobs/email/EditorialReminder.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

namespace PKP\jobs\email;

use APP\core\Application;
use APP\facades\Repo;
use APP\notification\NotificationManager;
use APP\submission\Submission;
use Carbon\Carbon;
use Illuminate\Support\Facades\Mail;
use PKP\context\Context;
use PKP\db\DAORegistry;
Expand Down Expand Up @@ -90,30 +90,41 @@ public function handle(): void
$reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO');
$reviewRound = $reviewRoundDao->getLastReviewRoundBySubmissionId($submission->getId(), $submission->getData('stageId'));

if ($reviewRound->getStatus() === ReviewRound::REVIEW_ROUND_STATUS_PENDING_REVIEWERS) {
if ($reviewRound->determineStatus() === ReviewRound::REVIEW_ROUND_STATUS_PENDING_REVIEWERS) {
$outstanding[$submissionId] = __('editor.submission.roundStatus.pendingReviewers');
continue;
}

if ($reviewRound->getStatus() === ReviewRound::REVIEW_ROUND_STATUS_REVIEWS_COMPLETED) {
if ($reviewRound->determineStatus() === ReviewRound::REVIEW_ROUND_STATUS_PENDING_REVIEWS) {
$outstanding[$submissionId] = __('editor.submission.roundStatus.pendingReviews');
continue;
}

if ($reviewRound->determineStatus() === ReviewRound::REVIEW_ROUND_STATUS_REVIEWS_READY) {
$outstanding[$submissionId] = __('editor.submission.roundStatus.reviewsReady');
continue;
}

if ($reviewRound->determineStatus() === ReviewRound::REVIEW_ROUND_STATUS_REVIEWS_COMPLETED) {
$outstanding[$submissionId] = __('editor.submission.roundStatus.reviewsCompleted');
continue;
}

if ($reviewRound->getStatus() === ReviewRound::REVIEW_ROUND_STATUS_REVIEWS_OVERDUE) {
if ($reviewRound->determineStatus() === ReviewRound::REVIEW_ROUND_STATUS_REVIEWS_OVERDUE) {
$outstanding[$submissionId] = __('editor.submission.roundStatus.reviewOverdue');
continue;
}

if ($reviewRound->getStatus() === ReviewRound::REVIEW_ROUND_STATUS_REVISIONS_SUBMITTED) {
if ($reviewRound->determineStatus() === ReviewRound::REVIEW_ROUND_STATUS_REVISIONS_SUBMITTED) {
$outstanding[$submissionId] = __('editor.submission.roundStatus.revisionsSubmitted');
continue;
}
}

if (in_array($submission->getData('stageId'), [WORKFLOW_STAGE_ID_EDITING, WORKFLOW_STAGE_ID_PRODUCTION])) {
$lastActivityTimestamp = strtotime($submission->getData('dateLastActivity'));
if ($lastActivityTimestamp < strtotime('-30 days')) {
$lastActivityTimestamp = Carbon::parse($submission->getData('dateLastActivity'))->endOfDay();
$comparingTimestamp = Carbon::today()->endOfDay()->subDays(30);
if ($comparingTimestamp->gt($lastActivityTimestamp)) {
/** @var WorkflowStageDAO $workflowStageDao */
$workflowStageDao = DAORegistry::getDAO('WorkflowStageDAO');
$outstanding[$submissionId] = __(
Expand Down Expand Up @@ -155,8 +166,11 @@ public function handle(): void
->from($context->getContactEmail(), $context->getLocalizedName(Locale::getLocale()))
->recipients([$editor])
->subject($emailTemplate->getLocalizedData('subject'))
->body($emailTemplate->getLocalizedData('body'))
->allowUnsubscribe($notification);
->body($emailTemplate->getLocalizedData('body'));

if ($notification) {
$mailable->allowUnsubscribe($notification);
}

Mail::send($mailable);

Expand Down

0 comments on commit 753129c

Please sign in to comment.