From 04594afae64ce050b31eaa42c83a271577df473f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Fri, 21 Apr 2023 14:54:33 +0200 Subject: [PATCH] Comment ticket status + add more parameters to WarnBeforeAutoCloseTicket job and AutoCloseOldTickets --- app/Enums/TicketStatus.php | 8 ++++++++ app/Jobs/AutoCloseOldTickets.php | 4 +++- app/Jobs/WarnBeforeAutoCloseTicket.php | 4 +++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/Enums/TicketStatus.php b/app/Enums/TicketStatus.php index 12f478e..d19bad7 100644 --- a/app/Enums/TicketStatus.php +++ b/app/Enums/TicketStatus.php @@ -6,13 +6,21 @@ use Kwaadpepper\Enum\BaseEnumRoutable; /** * @method static self new() + * Nouveau ticket * @method static self estimateTodo() + * Devis à faire. * @method static self takenInAccount() + * Nouveau ticket à été pris en charge * @method static self waiting() + * On attend que le client réponde dans le ticket * @method static self waitingValidation() + * On attend que le client valide l'estimation * @method static self recette() + * Est mis en recette * @method static self production() + * Est mis en production * @method static self archived() + * Ticket fermé */ class TicketStatus extends BaseEnumRoutable { diff --git a/app/Jobs/AutoCloseOldTickets.php b/app/Jobs/AutoCloseOldTickets.php index 0f1deff..bd333d2 100644 --- a/app/Jobs/AutoCloseOldTickets.php +++ b/app/Jobs/AutoCloseOldTickets.php @@ -20,7 +20,9 @@ class AutoCloseOldTickets $limitDays = 15; $message = 'En l\'absence d\'activitée depuis 15 jours ce ticket est automatiquement clos et archivé.'; $tickets = Ticket::where(function ($q) { - $q->where('status', TicketStatus::production()); + $q->where('status', TicketStatus::production()) + ->orWhere('status', TicketStatus::waitingValidation()) + ->orWhere('status', TicketStatus::waiting()); })->whereDate('updated_at', '<=', Carbon::now()->subDays($limitDays)) ->whereDoesntHave('messages', function ($q) use ($limitDays) { $q->whereDate('updated_at', '>', Carbon::now()->subDays($limitDays)); diff --git a/app/Jobs/WarnBeforeAutoCloseTicket.php b/app/Jobs/WarnBeforeAutoCloseTicket.php index b57f08c..88f7813 100644 --- a/app/Jobs/WarnBeforeAutoCloseTicket.php +++ b/app/Jobs/WarnBeforeAutoCloseTicket.php @@ -23,7 +23,9 @@ class WarnBeforeAutoCloseTicket // phpcs:ignore Generic.Files.LineLength.TooLong $messageToUser = 'En l\'absence d\'activitée, ou de réponse de votre part ce ticket sera automatiquement clos et archivé dans %s jours.'; $tickets = Ticket::where(function ($q) { - $q->where('status', TicketStatus::production()); + $q->where('status', TicketStatus::production()) + ->orWhere('status', TicketStatus::waitingValidation()) + ->orWhere('status', TicketStatus::waiting()); })->whereDate('updated_at', '<=', Carbon::now()->subDays($warningDays)) ->whereDoesntHave('messages', function ($q) use ($warningDays) { $q->whereDate('updated_at', '>', Carbon::now()->subDays($warningDays));