feat: assignments with disabled formalities
addresses #869dnvm8c
This commit is contained in:
1 parent
5979988dcc
commit
c33c1b6bf0
20 files changed
+720
-67
No files matched your search
@@ -38,14 +38,21 @@ class DispositionReminderService
|
||||
->select('disposition', 'assignment', 'destination')
|
||||
->innerJoin('disposition.assignment', 'assignment')
|
||||
->innerJoin('assignment.destination', 'destination')
|
||||
->innerJoin('disposition.documents', 'document', Join::WITH, 'document.type = :documentType')
|
||||
->leftJoin('disposition.documents', 'document', Join::WITH, 'document.type = :documentType')
|
||||
->innerJoin('disposition.teamer', 'teamer')
|
||||
->where($qb->expr()->andX(
|
||||
$qb->expr()->isNull('teamer.deletedAt'),
|
||||
$qb->expr()->notIn('assignment.status', ':statusAssignment'),
|
||||
$qb->expr()->eq('destination.dateFrom', ':dateFrom'),
|
||||
$qb->expr()->eq('document.status', ':statusContract'),
|
||||
// A checked contract is what normally marks a placement as settled enough to be
|
||||
// reminded about. A skip-formalities assignment never produces one, so it has to
|
||||
// qualify on the flag alone - otherwise its teamers get no trip reminder at all.
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->eq('document.status', ':statusContract'),
|
||||
$qb->expr()->eq('assignment.skipFormalities', ':skipFormalities'),
|
||||
),
|
||||
))
|
||||
->setParameter('skipFormalities', true)
|
||||
->setParameter('documentType', Upload::TYPE_CONTRACT)
|
||||
->setParameter('statusAssignment', [Assignment::STATUS_DELETED, Assignment::STATUS_CALLED_OFF])
|
||||
->setParameter('dateFrom', $dateFrom->format('Y-m-d'))
|
||||
|
||||
@@ -26,13 +26,29 @@ class DispositionStatusService
|
||||
return 'No ended dispositions to update';
|
||||
}
|
||||
|
||||
$completed = 0;
|
||||
|
||||
foreach ($endedDispositions as $disposition) {
|
||||
// A skip-formalities placement has no invoice step left to run through, so ending it
|
||||
// means it is done - anything else would park it in `ended` forever and keep asking
|
||||
// the teamer for a Honorarnote that is not wanted.
|
||||
if (true === $disposition->isSkipFormalities()) {
|
||||
$disposition->setStatus(Disposition::STATUS_COMPLETED);
|
||||
++$completed;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$disposition->setStatus(Disposition::STATUS_ENDED);
|
||||
}
|
||||
|
||||
$this->entityManager->flush();
|
||||
|
||||
$message = 'Ended '.$count.' dispositions';
|
||||
$message = sprintf(
|
||||
'Ended %d dispositions (%d of them completed without formalities)',
|
||||
$count,
|
||||
$completed
|
||||
);
|
||||
|
||||
$this->logger->info($message);
|
||||
|
||||
|
||||
Reference in new issue
Block a user