diff --git a/app/Console/Commands/SettleUnpaidLegacyInvoices.php b/app/Console/Commands/SettleUnpaidLegacyInvoices.php index 8cf53db6..6e6fc2c8 100644 --- a/app/Console/Commands/SettleUnpaidLegacyInvoices.php +++ b/app/Console/Commands/SettleUnpaidLegacyInvoices.php @@ -134,7 +134,7 @@ class SettleUnpaidLegacyInvoices extends Command ]); $statuses = $classified - ->map(fn (array $entry): string => $entry['source']?->status ?? 'unknown') + ->map(fn (array $entry): string => $entry['source']->status ?? 'unknown') ->unique() ->values(); @@ -335,8 +335,8 @@ class SettleUnpaidLegacyInvoices extends Command 'UPO #%d · User #%d · Quelle %s (%s, %s)', $post->id, $post->user_id, - $source?->number ?? '?', - $source?->status ?? 'unbekannt', + $source->number ?? '?', + $source->status ?? 'unbekannt', $source?->invoice_date?->toDateString() ?? '-', ); } diff --git a/app/Services/Billing/ManualInvoicePdfRenderer.php b/app/Services/Billing/ManualInvoicePdfRenderer.php index fdf53350..ef0d6a24 100644 --- a/app/Services/Billing/ManualInvoicePdfRenderer.php +++ b/app/Services/Billing/ManualInvoicePdfRenderer.php @@ -54,10 +54,10 @@ class ManualInvoicePdfRenderer public function serviceName(Invoice $invoice): string { $option = $invoice->userPaymentOption; - $conditions = $option?->legacy_conditions ?? []; + $conditions = $option->legacy_conditions ?? []; $name = $conditions['name'] - ?? $option?->paymentOption?->article_number + ?? $option->paymentOption->article_number ?? 'Leistung laut Vereinbarung'; $portal = match ($conditions['legacy_portal'] ?? null) { @@ -80,7 +80,9 @@ class ManualInvoicePdfRenderer { $option = $invoice->userPaymentOption; - if (! $option?->current_period_start || ! $option->current_period_end) { + // Beide Spalten sind NOT NULL — ohne Vereinbarung gibt es keinen + // Zeitraum, mit Vereinbarung immer einen. + if ($option === null) { return null; } @@ -107,7 +109,7 @@ class ManualInvoicePdfRenderer private function drawBody(string &$content, Invoice $invoice): void { - $invoiceDate = $invoice->invoice_date?->format('d.m.Y') ?? 'n/a'; + $invoiceDate = $invoice->invoice_date->format('d.m.Y'); $y = 700.0; $content .= $this->text(self::LEFT, $y, 'Rechnungsdatum: '.$invoiceDate, 9);