From 445dd48c81031b66f505d7b3672d84800702d496 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sun, 1 Dec 2024 16:15:07 +1100 Subject: [PATCH] When re-enabling dynamic items, ensure the next_at date is from today, not from when it was last run --- app/Classes/File/Send/Dynamic.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/Classes/File/Send/Dynamic.php b/app/Classes/File/Send/Dynamic.php index e3e8a86..f807bdd 100644 --- a/app/Classes/File/Send/Dynamic.php +++ b/app/Classes/File/Send/Dynamic.php @@ -74,18 +74,27 @@ final class Dynamic extends Send $this->do->next_at = $next_at ->addDay(); + while ($this->do->next_at->isPast()) + $this->do->next_at->addDay(); + break; case 'WEEKLY': $this->do->next_at = $next_at ->addWeek(); + while ($this->do->next_at->isPast()) + $this->do->next_at->addWeek(); + break; case 'MONTHLY': $this->do->next_at = $next_at ->addMonth(); + while ($this->do->next_at->isPast()) + $this->do->next_at->addMonth(); + break; default: