From 63db6737df459a7f9bae0426cec99bf154ab5c70 Mon Sep 17 00:00:00 2001 From: Pavel Dohnal Date: Fri, 19 Mar 2021 12:01:44 +0100 Subject: [PATCH] Only some statuses can be updated We want to maintain the previous behaviour [MAILPOET-3481] --- lib/Entities/NewsletterEntity.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Entities/NewsletterEntity.php b/lib/Entities/NewsletterEntity.php index 5450336b65..a17fbbd91c 100644 --- a/lib/Entities/NewsletterEntity.php +++ b/lib/Entities/NewsletterEntity.php @@ -281,7 +281,10 @@ class NewsletterEntity { if ($task === null) continue; $scheduled = new Carbon($task->getScheduledAt()); - if ($scheduled < (new Carbon())->subDays(30)) return; + if ($scheduled < (new Carbon())->subDays(30)) continue; + + if (($status === self::STATUS_DRAFT) && ($task->getStatus() !== ScheduledTaskEntity::STATUS_SCHEDULED)) continue; + if (($status === self::STATUS_ACTIVE) && ($task->getStatus() !== ScheduledTaskEntity::STATUS_PAUSED)) continue; $task->setStatus($newTaskStatus); }