feat: send reminder emails for pending contracts
This commit is contained in:
@@ -22,8 +22,9 @@ class UploadReminderService
|
|||||||
public function sendContractUploadReminders(): string
|
public function sendContractUploadReminders(): string
|
||||||
{
|
{
|
||||||
// Contracts have to be uploaded before assignment's begin date. Reminder is
|
// 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.
|
// sent 7 and 14 days after disposition has been created.
|
||||||
$contractDueDate = (new \DateTimeImmutable())->modify('+3 days');
|
$contractDueDateFirst = (new \DateTimeImmutable())->modify('-7 days');
|
||||||
|
$contractDueDateSecond = (new \DateTimeImmutable())->modify('-14 days');
|
||||||
|
|
||||||
// Find dispositions of assignments with due contract upload
|
// Find dispositions of assignments with due contract upload
|
||||||
$qb = $this->dispositionRepository->createQueryBuilder('disposition');
|
$qb = $this->dispositionRepository->createQueryBuilder('disposition');
|
||||||
@@ -36,17 +37,14 @@ class UploadReminderService
|
|||||||
->where($qb->expr()->andX(
|
->where($qb->expr()->andX(
|
||||||
$qb->expr()->isNull('document'),
|
$qb->expr()->isNull('document'),
|
||||||
$qb->expr()->orX(
|
$qb->expr()->orX(
|
||||||
// Due date can be determined by assignment's date which potentially overrides destination date
|
$qb->expr()->eq('document.createdAt', ':contractDueDateFirst'),
|
||||||
$qb->expr()->andX(
|
$qb->expr()->eq('document.createdAt', ':contractDueDateSecond'),
|
||||||
$qb->expr()->isNotNull('assignment.dateFrom'),
|
|
||||||
$qb->expr()->eq('assignment.dateFrom', ':dateFrom')
|
|
||||||
),
|
|
||||||
$qb->expr()->eq('destination.dateFrom', ':dateFrom'),
|
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
->setParameters([
|
->setParameters([
|
||||||
'documentType' => Upload::TYPE_CONTRACT,
|
'documentType' => Upload::TYPE_CONTRACT,
|
||||||
'dateFrom' => $contractDueDate,
|
'contractDueDateFirst' => $contractDueDateFirst,
|
||||||
|
'contractDueDateSecond' => $contractDueDateSecond,
|
||||||
])
|
])
|
||||||
->getQuery()
|
->getQuery()
|
||||||
->getResult()
|
->getResult()
|
||||||
|
|||||||
@@ -10,7 +10,9 @@
|
|||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<strong>
|
<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>
|
</strong>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
Reference in New Issue
Block a user