From c3cebae4942ba6136dfbd8f991c1cfa8fac8842b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Tue, 6 Oct 2026 15:01:00 +0200 Subject: [PATCH] fix: teamer dashboard crashing on isContractDue() without deadline 489aafed made isContractDue() and isInvoiceDue() take the deadline days, but teamer/index.html.twig still called them as bare getters, throwing an ArgumentCountError for every teamer with an upcoming disposition. The controller now resolves which reason applies and hands it to the template. Co-Authored-By: Claude Opus 5.5 --- src/Controller/Teamer/IndexController.php | 19 +++++++--- templates/teamer/index.html.twig | 45 +++++++++++------------ 2 files changed, 36 insertions(+), 28 deletions(-) diff --git a/src/Controller/Teamer/IndexController.php b/src/Controller/Teamer/IndexController.php index 75881c3..8734a6b 100644 --- a/src/Controller/Teamer/IndexController.php +++ b/src/Controller/Teamer/IndexController.php @@ -78,19 +78,28 @@ class IndexController extends AbstractController ]); } + /** + * @return list + */ private function processDocuments(array $upcomingDispositions): array { $contractUploadDeadlineDays = (int) $this->getParameter('contract_upload_deadline_days'); $invoiceUploadDeadlineDays = (int) $this->getParameter('invoice_upload_deadline_days'); $dispositions = []; + // The due checks need the configured deadlines, which the template cannot pass, so the + // reason is resolved here. Order matters: the first matching reason is the one shown. foreach ($upcomingDispositions as $disposition) { /** @var Disposition $disposition */ - if ($disposition->isContractDue($contractUploadDeadlineDays) - || $disposition->isContractRejected() - || $disposition->isInvoiceDue($invoiceUploadDeadlineDays) - ) { - $dispositions[] = $disposition; + $reason = match (true) { + $disposition->isContractDue($contractUploadDeadlineDays) => 'contract_due', + $disposition->isContractRejected() => 'contract_rejected', + $disposition->isInvoiceDue($invoiceUploadDeadlineDays) => 'invoice_due', + default => null, + }; + + if (null !== $reason) { + $dispositions[] = ['disposition' => $disposition, 'reason' => $reason]; } } diff --git a/templates/teamer/index.html.twig b/templates/teamer/index.html.twig index 24fceec..62db48a 100644 --- a/templates/teamer/index.html.twig +++ b/templates/teamer/index.html.twig @@ -48,31 +48,30 @@ Meine Dokumente