feat(booking): Kaution je Buchung, drei Vertragsunterschriften, Mails und Aufbewahrung nach Kundenwunsch
Kundenwunsch vom 04.12.2026 (docs/auftraege): - Kaution je Buchung (bookings.deposit_amount_cents, Standard 100 €, 0 = keine) statt globaler Konfiguration; Voreinstellungen im Formular angepasst. - Auftragsbestätigung rechnet Kaution nicht mehr in Gesamt/Restbetrag ein, zeigt sie als "in bar"-Hinweis unter dem Zahlungseingang, Verwendungszweck "#Buchungsnummer Name", Hinweis auf Anruf 8–10 Tage vor dem Termin. - Mietvertrag mit drei Unterschriften (Migration 021, document_signatures): Mitarbeiter bestätigt Zahlungseingang, Kunde Übernahme, Kunde Kautionsrückgabe; Zusatzvereinbarungen werden im Vertrag abgedruckt. - Zahlungserinnerung ebenfalls ohne Kaution im Betrag. - Mail-Fuß mit Signaturblock und Antwort-Sperrhinweis, Betreffzeilen mit Buchungsnummer und Mietgegenstand (ohne Anhängernummer), Wochentag in Datumsangaben. - Aufbewahrung: ohne Rechnung 30 Tage, mit Rechnung Mietvertrag 8 Jahre; Jahresarchiv der Mietverträge (app/export.php, Verwaltung → Sicherungen). - Automatische Bewertungsmail eine Woche nach Rückgabe (Migration 022). - Mehrfachvermietung: "Weiterer Anhänger für diesen Kunden" (/bookings/new?from=ID). Migrationen 020–022 sind lokal gelaufen; PDF-Erzeugung, Unterschrifts-Lebenszyklus und Jahresexport getestet.
This commit is contained in:
parent
606237dbda
commit
00b7b7f0e9
33 changed files with 1355 additions and 218 deletions
|
|
@ -62,6 +62,14 @@ function admin_handle(string $path, array $user): void
|
|||
admin_backups($user);
|
||||
return;
|
||||
}
|
||||
if ($path === '/admin/export') {
|
||||
admin_year_export();
|
||||
return;
|
||||
}
|
||||
if (preg_match('#^/admin/export/([A-Za-z0-9_.-]+)$#', $path, $m) === 1) {
|
||||
admin_year_export_file($m[1]);
|
||||
return;
|
||||
}
|
||||
if (preg_match('#^/admin/backups/(backup_[A-Za-z0-9_.-]+\.tar\.gz)/download$#', $path, $m) === 1) {
|
||||
admin_backup_download($m[1]);
|
||||
return;
|
||||
|
|
@ -803,9 +811,51 @@ function admin_backups(array $user): void
|
|||
'directory' => backup_root(),
|
||||
'maxMb' => (int) config('app.backup_max_mb', 200),
|
||||
'available' => class_exists('PharData'),
|
||||
'exports' => year_exports(),
|
||||
'exportYear' => (int) date('Y'),
|
||||
], 'Sicherungen');
|
||||
}
|
||||
|
||||
/** Baut den Jahresexport der Mietverträge und liefert ihn als Download aus. */
|
||||
function admin_year_export(): never
|
||||
{
|
||||
$year = (int) query_string('year');
|
||||
if ($year < 2000 || $year > (int) date('Y')) {
|
||||
$year = (int) date('Y');
|
||||
}
|
||||
try {
|
||||
$export = year_export_build($year);
|
||||
admin_year_export_stream($export['path'], $export['name']);
|
||||
} catch (Throwable $error) {
|
||||
flash('error', 'Jahresexport fehlgeschlagen: ' . $error->getMessage());
|
||||
redirect('/admin/backups');
|
||||
}
|
||||
}
|
||||
|
||||
/** Liefert ein bereits gebautes Jahresarchiv aus. */
|
||||
function admin_year_export_file(string $name): never
|
||||
{
|
||||
if (!preg_match('/^mietvertraege-\d{4}\.(zip|tar\.gz)$/', $name)) {
|
||||
abort_page(404, 'Dieses Archiv gibt es nicht.');
|
||||
}
|
||||
$path = year_export_dir() . '/' . $name;
|
||||
if (!is_file($path)) {
|
||||
abort_page(404, 'Dieses Archiv gibt es nicht.');
|
||||
}
|
||||
admin_year_export_stream($path, $name);
|
||||
}
|
||||
|
||||
function admin_year_export_stream(string $path, string $name): never
|
||||
{
|
||||
$mime = str_ends_with($name, '.zip') ? 'application/zip' : 'application/gzip';
|
||||
header('Content-Type: ' . $mime);
|
||||
header('Content-Length: ' . (string) filesize($path));
|
||||
header('Content-Disposition: attachment; filename="' . $name . '"');
|
||||
header('Cache-Control: private, no-store');
|
||||
readfile($path);
|
||||
exit;
|
||||
}
|
||||
|
||||
function admin_backup_restore(array $user): never
|
||||
{
|
||||
$name = post_string('name');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue