diff --git a/src/Service/Cron/UploadReminderService.php b/src/Service/Cron/UploadReminderService.php index 800eb7e..b7dedd2 100644 --- a/src/Service/Cron/UploadReminderService.php +++ b/src/Service/Cron/UploadReminderService.php @@ -22,8 +22,9 @@ class UploadReminderService public function sendContractUploadReminders(): string { // Contracts have to be uploaded before assignment's begin date. Reminder is - // sent three days before end of this period thus due date is today in three days. - $contractDueDate = (new \DateTimeImmutable())->modify('+3 days'); + // sent 7 and 14 days after disposition has been created. + $contractDueDateFirst = (new \DateTimeImmutable())->modify('-7 days'); + $contractDueDateSecond = (new \DateTimeImmutable())->modify('-14 days'); // Find dispositions of assignments with due contract upload $qb = $this->dispositionRepository->createQueryBuilder('disposition'); @@ -36,17 +37,14 @@ class UploadReminderService ->where($qb->expr()->andX( $qb->expr()->isNull('document'), $qb->expr()->orX( - // Due date can be determined by assignment's date which potentially overrides destination date - $qb->expr()->andX( - $qb->expr()->isNotNull('assignment.dateFrom'), - $qb->expr()->eq('assignment.dateFrom', ':dateFrom') - ), - $qb->expr()->eq('destination.dateFrom', ':dateFrom'), + $qb->expr()->eq('document.createdAt', ':contractDueDateFirst'), + $qb->expr()->eq('document.createdAt', ':contractDueDateSecond'), ) )) ->setParameters([ 'documentType' => Upload::TYPE_CONTRACT, - 'dateFrom' => $contractDueDate, + 'contractDueDateFirst' => $contractDueDateFirst, + 'contractDueDateSecond' => $contractDueDateSecond, ]) ->getQuery() ->getResult() diff --git a/templates/email/reminder_contract_upload.html.twig b/templates/email/reminder_contract_upload.html.twig index 0d99f82..f8dad08 100644 --- a/templates/email/reminder_contract_upload.html.twig +++ b/templates/email/reminder_contract_upload.html.twig @@ -10,7 +10,9 @@

- {{ disposition.assignment.destination}}. + + {{ disposition.assignment.destination}} + .