feat: send reminder emails for pending contracts
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
</p>
|
||||
<p>
|
||||
<strong>
|
||||
<a href="{{ url('app_teamer_disposition_detail', { 'uuid': disposition.uuid }) }}">{{ disposition.assignment.destination}}</a>.
|
||||
<a href="{{ url('app_teamer_disposition_detail', { 'uuid': disposition.uuid }) }}">
|
||||
{{ disposition.assignment.destination}}
|
||||
</a>.
|
||||
</strong>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
Reference in New Issue
Block a user