feat(admin): Anzahlungskonten in der Verwaltung pflegen (zwei IBANs)

- Migration 016_deposit_accounts.sql: Tabelle deposit_accounts (label, holder,
  bank, iban, sort_order), gefüllt mit Postbank (DE12 …1261 30) und Sparkasse
  (DE83 3206 0362 3303 2140 10); bookings.deposit_account -> deposit_account_id
  mit Fremdschlüssel (ON DELETE SET NULL), Altbestand wird aufs erste Konto
  gemappt; schema.sql nachgezogen
- Neue Seite Verwaltung → Konten (/admin/accounts): anlegen, ändern, löschen
  (Löschen nur ohne Buchungsbezug), Anzeige der Verwendung je Konto
- Buchungsformular wählt aus dieser Liste (Anzeige mit IBAN-Ende), Validierung
  prüft IBAN-Format, Auftragsbestätigung druckt das gewählte Konto
- deposit_accounts()/deposit_account() lesen aus der DB (Cache wird nach
  Änderungen verworfen); Konfigurations-Override entfällt
- Anleitung (Abschnitt 3 und 15), README, config.example.php und ROADMAP
  (Feature 25) aktualisiert
This commit is contained in:
torsten 2026-11-30 17:10:24 +01:00
parent bf85a64a79
commit cc8d7330f8
15 changed files with 478 additions and 76 deletions

View file

@ -55,6 +55,19 @@ CREATE TABLE IF NOT EXISTS users (
CONSTRAINT fk_users_employee FOREIGN KEY (employee_id) REFERENCES employees (id) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS deposit_accounts (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
label VARCHAR(80) NOT NULL,
holder VARCHAR(120) NOT NULL,
bank VARCHAR(80) NOT NULL DEFAULT '',
iban VARCHAR(34) NOT NULL,
sort_order INT NOT NULL DEFAULT 0,
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL,
PRIMARY KEY (id),
KEY idx_deposit_accounts_sort (sort_order, id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS bookings (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
trailer_id BIGINT UNSIGNED NOT NULL,
@ -67,7 +80,7 @@ CREATE TABLE IF NOT EXISTS bookings (
deposit_cents INT UNSIGNED NOT NULL DEFAULT 0,
-- Anzahlung laut Auftragsbestätigung: vereinbart? auf welches Konto?
deposit_required TINYINT(1) NOT NULL DEFAULT 0,
deposit_account VARCHAR(40) NOT NULL DEFAULT '',
deposit_account_id BIGINT UNSIGNED NULL DEFAULT NULL,
rent_cents INT UNSIGNED NOT NULL DEFAULT 0,
delivery_cents INT UNSIGNED NOT NULL DEFAULT 0,
total_cents INT UNSIGNED NOT NULL DEFAULT 0,
@ -96,6 +109,7 @@ CREATE TABLE IF NOT EXISTS bookings (
CONSTRAINT fk_bookings_trailer FOREIGN KEY (trailer_id) REFERENCES trailers (id) ON DELETE RESTRICT,
CONSTRAINT fk_bookings_employee FOREIGN KEY (employee_id) REFERENCES employees (id) ON DELETE RESTRICT,
CONSTRAINT fk_bookings_return_employee FOREIGN KEY (return_employee_id) REFERENCES employees (id) ON DELETE SET NULL,
CONSTRAINT fk_bookings_deposit_account FOREIGN KEY (deposit_account_id) REFERENCES deposit_accounts (id) ON DELETE SET NULL,
CONSTRAINT fk_bookings_created_by FOREIGN KEY (created_by) REFERENCES users (id) ON DELETE SET NULL,
CONSTRAINT fk_bookings_updated_by FOREIGN KEY (updated_by) REFERENCES users (id) ON DELETE SET NULL,
CONSTRAINT fk_bookings_cancelled_by FOREIGN KEY (cancelled_by) REFERENCES users (id) ON DELETE SET NULL