diff --git a/Changes.md b/Changes.md index 1fa7536..bab3732 100644 --- a/Changes.md +++ b/Changes.md @@ -2,6 +2,16 @@ --- +## 2026-07-02 – Feature: Zusätzliche CC-E-Mail-Adressen pro Kunde (Issue #111) + +- **`migrations/084_customer_cc_emails.sql`:** Neue Spalten `email_cc1`, `email_cc2` in `customers` +- **`src/Models/Customer.php`:** `create()` und `update()` speichern die beiden CC-Adressen (Whitespace wird zu NULL normalisiert) +- **`src/Views/customers/form.php`:** Zwei neue Eingabefelder „E-Mail CC 1/2" unter der Haupt-E-Mail +- **`src/Controllers/InvoiceController.php`:** `show()` lädt den Kunden und übergibt ihn an die Detailansicht +- **`src/Views/invoices/show.php`:** CC-Felder im E-Mail-Sende-Modal werden mit den hinterlegten Kunden-CC-Adressen vorbelegt + +--- + ## 2026-06-29 – Feature: Ereignisse-Log für Nextcloud-Import (Issue #109) - **`migrations/083_system_events.sql`:** Neue Tabelle `system_events` (id, channel, message, created_at) diff --git a/docs/funktionen.md b/docs/funktionen.md index e436719..807b2b3 100644 --- a/docs/funktionen.md +++ b/docs/funktionen.md @@ -42,6 +42,8 @@ CRUD für Lieferantenstammdaten. Lieferanten können Belegen zugeordnet werden; CRUD für Kundenstammdaten. Kunden werden beim Erstellen von Ausgangsrechnungen ausgewählt. +- Pro Kunde können neben der Haupt-E-Mail-Adresse **zwei zusätzliche CC-Adressen** hinterlegt werden. Beim Rechnungsversand werden diese automatisch in die CC-Felder des E-Mail-Dialogs übernommen. + --- ## Ausgangsrechnungen diff --git a/migrations/084_customer_cc_emails.sql b/migrations/084_customer_cc_emails.sql new file mode 100644 index 0000000..5b5fc24 --- /dev/null +++ b/migrations/084_customer_cc_emails.sql @@ -0,0 +1,7 @@ +-- 084_customer_cc_emails.sql +-- Zwei zusätzliche CC-E-Mail-Adressen pro Kunde, die beim Rechnungsversand +-- automatisch in die CC-Felder übernommen werden. + +ALTER TABLE customers + ADD COLUMN IF NOT EXISTS email_cc1 VARCHAR(255) NULL DEFAULT NULL AFTER email, + ADD COLUMN IF NOT EXISTS email_cc2 VARCHAR(255) NULL DEFAULT NULL AFTER email_cc1; diff --git a/src/Controllers/InvoiceController.php b/src/Controllers/InvoiceController.php index 4060542..72d9384 100644 --- a/src/Controllers/InvoiceController.php +++ b/src/Controllers/InvoiceController.php @@ -131,6 +131,11 @@ class InvoiceController extends BaseController $accounts = Account::all(['aktiv' => 1]); } + // Kunde für CC-Vorbelegung im E-Mail-Modal + $customer = !empty($invoice['customer_id']) + ? \Steuerkram\Models\Customer::find((int)$invoice['customer_id']) + : null; + $view = new View(); $view->render('layout/base.php', [ 'pageTitle' => 'Rechnung ' . ($invoice['rechnungs_nr'] ?? 'Entwurf'), @@ -142,6 +147,7 @@ class InvoiceController extends BaseController 'originalrechnung' => $originalrechnung, 'bookings' => $bookings, 'accounts' => $accounts, + 'customer' => $customer ?: null, ]), ]); } diff --git a/src/Models/Customer.php b/src/Models/Customer.php index 44695c4..4814c16 100644 --- a/src/Models/Customer.php +++ b/src/Models/Customer.php @@ -39,8 +39,8 @@ class Customer $nr = self::generateKundennummer(); Database::execute( 'INSERT INTO customers (kundennummer, firma, anrede, vorname, nachname, strasse, plz, ort, land, - email, telefon, ust_id, steuernummer, payment_days, notes, mail_subject_template, mail_body_template) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', + email, email_cc1, email_cc2, telefon, ust_id, steuernummer, payment_days, notes, mail_subject_template, mail_body_template) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', [ $data['kundennummer'] ?? $nr, $data['firma'] ?? null, @@ -52,6 +52,8 @@ class Customer $data['ort'], $data['land'] ?? 'DE', $data['email'] ?? null, + trim($data['email_cc1'] ?? '') !== '' ? trim($data['email_cc1']) : null, + trim($data['email_cc2'] ?? '') !== '' ? trim($data['email_cc2']) : null, $data['telefon'] ?? null, $data['ust_id'] ?? null, $data['steuernummer'] ?? null, @@ -68,7 +70,7 @@ class Customer { Database::execute( 'UPDATE customers SET firma=?, anrede=?, vorname=?, nachname=?, strasse=?, plz=?, ort=?, land=?, - email=?, telefon=?, ust_id=?, steuernummer=?, payment_days=?, notes=?, + email=?, email_cc1=?, email_cc2=?, telefon=?, ust_id=?, steuernummer=?, payment_days=?, notes=?, mail_subject_template=?, mail_body_template=?, updated_at=NOW() WHERE id=?', [ @@ -81,6 +83,8 @@ class Customer $data['ort'], $data['land'] ?? 'DE', $data['email'] ?? null, + trim($data['email_cc1'] ?? '') !== '' ? trim($data['email_cc1']) : null, + trim($data['email_cc2'] ?? '') !== '' ? trim($data['email_cc2']) : null, $data['telefon'] ?? null, $data['ust_id'] ?? null, $data['steuernummer'] ?? null, diff --git a/src/Views/customers/form.php b/src/Views/customers/form.php index b0d664f..1a860f3 100644 --- a/src/Views/customers/form.php +++ b/src/Views/customers/form.php @@ -60,6 +60,22 @@ +
+
+ + +
+
+ + +
+
+

+ Zusätzliche CC-Adressen werden beim Rechnungsversand automatisch als Kopie vorgeschlagen. +

+
diff --git a/src/Views/invoices/show.php b/src/Views/invoices/show.php index 0267ebf..d56d065 100644 --- a/src/Views/invoices/show.php +++ b/src/Views/invoices/show.php @@ -370,11 +370,13 @@ $badgeClass = match($invoice['status']) {
- +
- +