Erinnerungsabstand und taegliche/woechentliche Zusammenfassung einstellbar

System > Betrieb > Benachrichtigungen: offene Meldungen (Doppelbuchungen im
Postfach, Portal-Aufgaben) nur einmal oder alle 1/2/3/7 Tage erneut senden;
Tages- und/oder Wochenuebersicht mit waehlbarer Uhrzeit, Wochentag und Inhalt
(Postfach, Anfragen, Neues, An-/Abreisen, Zahlungen, Portale, Bewertungen).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Opus 5.5 committed 2026-10-30 10:11:15 +01:00
1 parent 70a39315e2
commit 1c757f7429
20 files changed
+842 -22

No files matched your search

+24 -4
View File
@@ -9,19 +9,25 @@
/**
* Posts findings to the admin inbox ("Postfach"). Each finding has a fingerprint and arrives only once
* per landlord, so a check that runs every few minutes reports a lasting problem a single time.
* per landlord, so a check that runs every few minutes does not report a lasting problem again and again.
* While the finding is still detected and the message is unread, it is repeated after the landlord's
* reminder interval (Settings::reminderIntervalDays(), 0 = never).
*/
class Inbox
{
/**
* @return InboxMessage|null the new message, or null when this finding was posted before
* @return InboxMessage|null the message to e-mail now – new (wasRecentlyCreated) or due for a reminder – else null
*/
public function post(InboxMessageKind $kind, string $fingerprint, string $subject, string $body, ?Channel $channel = null, ?string $actionUrl = null): ?InboxMessage
{
$fingerprint = $kind->value.':'.$fingerprint;
if (InboxMessage::query()->where('fingerprint', $fingerprint)->exists()) {
return null;
$existing = InboxMessage::query()->where('fingerprint', $fingerprint)->first();
if ($existing) {
$due = $this->reminderDue($existing);
$existing->forceFill(['last_seen_at' => now(), ...($due ? ['notified_at' => now()] : [])])->save();
return $due ? $existing : null;
}
try {
@@ -33,9 +39,23 @@ public function post(InboxMessageKind $kind, string $fingerprint, string $subjec
'channel_id' => $channel?->id,
'property_id' => $channel?->property_id,
'action_url' => $actionUrl,
'notified_at' => now(),
'last_seen_at' => now(),
]);
} catch (UniqueConstraintViolationException) {
return null;
}
}
/**
* Unread messages are repeated once the reminder interval has passed; reading one ends its reminders.
*/
public function reminderDue(InboxMessage $message): bool
{
$days = Settings::reminderIntervalDays($message->tenant);
return $days > 0
&& ! $message->isRead()
&& ($message->notified_at === null || $message->notified_at->lessThanOrEqualTo(now()->subDays($days)));
}
}