fix: correctly calculate due dates for contract and invoice uploads

This commit is contained in:
Björn Fromme
2026-08-17 12:49:36 +02:00
parent 0e1df6da7c
commit 31149fdd13
4 changed files with 145 additions and 7 deletions
+8
View File
@@ -233,6 +233,14 @@ class Disposition implements BlameableEntityInterface, TimestampableEntityInterf
$dueDateFrom = $this->getCreatedAt()->modify(sprintf('+%d days', $deadlineDays));
$dueDateTo = $assignmentPeriod->end->modify('-1 day');
// A short-notice assignment can end before the normal $deadlineDays window would even
// start. Left uncapped, dueDateFrom >= dueDateTo makes isStarted() and isEnded() equal
// at every instant below, so the flag would never light up; treat the contract as due
// right away instead.
if ($dueDateFrom >= $dueDateTo) {
$dueDateFrom = $this->getCreatedAt();
}
$period = CarbonPeriodImmutable::create($dueDateFrom, $dueDateTo);
// isStarted() alone stays true once the period has begun, so the dashboard kept