feat(documents): Mietvertrag, Auftragsbestätigung und Rechnung zur Buchung
- Mietvertrag als PDF in drei Varianten (Mit Lieferung, Selbstabholer, Truhe), Seite 2+ mit der AGB aus app/agb.php – derselbe Text wie /agb. - Auftragsbestätigung als PDF, ebenfalls in drei Varianten. - PDF-Erzeuger ohne Fremdbibliothek (app/pdf.php, Helvetica + JPEG für die Unterschrift); Layout in app/documents.php. - Unterschrift auf dem Tablet (views/document_sign.php, Canvas -> JPEG) wird ins PDF gesetzt; Unterlagen lassen sich ansehen, drucken und per Mail an den Kunden senden (mail_send_attachment()). - Rechnung aus Lexware als PDF-Upload; Ablage unter storage/documents/<booking_id>/ (per .htaccess gesperrt). - Aufbewahrung: documents_cleanup() im Cron löscht einen Monat nach Mietende (app.document_retention_days), inklusive verwaister Dateien. - Migrationen per HTTP (/migrate?token=…, app/migrate.php), weil das Hosting kein SSH hat; deploy.sh ruft die Route nach dem Sync auf. - Schema: booking_documents (Migration 012, auch in schema.sql), Doku in README/ROADMAP/docs/todo_kundenemail_2026-11-30-unterlagen.md. Enthält außerdem die bislang nicht committeten Anpassungen in bootstrap.php und app.js/pages.php, die im selben Arbeitsstand lagen.
This commit is contained in:
parent
3e34a6c839
commit
2de8e95c15
24 changed files with 2412 additions and 49 deletions
|
|
@ -351,6 +351,13 @@ do_sync() {
|
|||
printf '%s\t%s\t\n' "$REPO_ROOT/storage/.htaccess" "storage/.htaccess" >> "$manifest"
|
||||
|
||||
upload_manifest "$manifest"
|
||||
|
||||
# Migrationen nachziehen: auf dem Hosting gibt es kein SSH, die Route
|
||||
# /migrate?token=… (app/migrate.php) wendet ausstehende Migrationen an.
|
||||
local migrations
|
||||
migrations="$(curl -sS --max-time 120 "$PUBLIC_URL/migrate?token=$cron_token" 2>&1)" || true
|
||||
echo "Migrationen: ${migrations:-keine Antwort}"
|
||||
|
||||
if [[ -z "$VAPID_PUBLIC_KEY" || -z "$VAPID_PRIVATE_KEY" ]]; then
|
||||
echo "WARNUNG: VAPID-Schlüssel fehlen in $CREDENTIALS – Push bleibt deaktiviert." >&2
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -17,41 +17,11 @@ if (PHP_SAPI !== 'cli') {
|
|||
|
||||
require __DIR__ . '/../app/bootstrap.php';
|
||||
|
||||
$pdo = db();
|
||||
$pdo->exec(
|
||||
'CREATE TABLE IF NOT EXISTS schema_migrations (
|
||||
version INT UNSIGNED NOT NULL,
|
||||
applied_at DATETIME NOT NULL,
|
||||
PRIMARY KEY (version)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci'
|
||||
);
|
||||
|
||||
$applied = array_map('intval', $pdo->query('SELECT version FROM schema_migrations')->fetchAll(PDO::FETCH_COLUMN));
|
||||
$files = glob(__DIR__ . '/../sql/migrations/*.sql') ?: [];
|
||||
sort($files, SORT_STRING);
|
||||
|
||||
$count = 0;
|
||||
foreach ($files as $file) {
|
||||
$name = basename($file);
|
||||
if (!preg_match('/^(\d+)_/', $name, $match)) {
|
||||
fwrite(STDERR, "Überspringe Datei ohne Versionsnummer: $name\n");
|
||||
continue;
|
||||
}
|
||||
$version = (int) $match[1];
|
||||
if (in_array($version, $applied, true)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
echo "Migration $version: $name\n";
|
||||
$sql = preg_replace('/^\s*--.*$/m', '', (string) file_get_contents($file)) ?? '';
|
||||
foreach (array_filter(array_map('trim', explode(';', $sql))) as $statement) {
|
||||
if ($statement !== '') {
|
||||
$pdo->exec($statement);
|
||||
}
|
||||
}
|
||||
$pdo->prepare('INSERT IGNORE INTO schema_migrations (version, applied_at) VALUES (?, ?)')
|
||||
->execute([$version, utc_now()]);
|
||||
$count++;
|
||||
// Dieselbe Logik wie die Route /migrate?token=… (app/migrate.php), damit auf
|
||||
// dem Hosting ohne SSH nach dem Sync migriert werden kann.
|
||||
$result = migrations_run();
|
||||
foreach ($result['applied'] as $name) {
|
||||
echo "Migration angewendet: $name\n";
|
||||
}
|
||||
|
||||
$count = count($result['applied']);
|
||||
echo $count === 0 ? "Keine ausstehenden Migrationen.\n" : "$count Migration(en) angewendet.\n";
|
||||
|
|
|
|||
|
|
@ -25,10 +25,11 @@ $push = push_dispatch_due($lookback);
|
|||
$mail = reminder_send_due($lookback);
|
||||
|
||||
fwrite(STDOUT, sprintf(
|
||||
"Aufräumen: %d Login-Fehlversuche, %d Tokens, %d Einladungen, %d E-Mail-Protokolle, %d Push-Protokolle entfernt%s.\n",
|
||||
"Aufräumen: %d Login-Fehlversuche, %d Tokens, %d Einladungen, %d E-Mail-Protokolle, %d Push-Protokolle, %d Buchungsunterlagen entfernt%s.\n",
|
||||
$cleanup['login_attempts'], $cleanup['auth_tokens'], $cleanup['user_invites'],
|
||||
$cleanup['reminder_mail_log'],
|
||||
$cleanup['reminder_push_log'], $cleanup['log_rotated'] ? ', Fehlerprotokoll rotiert' : ''
|
||||
$cleanup['reminder_push_log'], $cleanup['booking_documents'],
|
||||
$cleanup['log_rotated'] ? ', Fehlerprotokoll rotiert' : ''
|
||||
));
|
||||
|
||||
if (!push_is_configured()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue