diff --git a/app/company-settings-preview/page.tsx b/app/company-settings-preview/page.tsx
index 574df16..3e1b70d 100644
--- a/app/company-settings-preview/page.tsx
+++ b/app/company-settings-preview/page.tsx
@@ -11,6 +11,10 @@ export const metadata: Metadata = {
const FALLBACK: CompanySettings = {
sellerName: "",
+ legalForm: "sole-proprietorship",
+ registerCourt: null,
+ registerNumber: null,
+ managingDirector: null,
sellerStreet: "",
sellerZip: "",
sellerCity: "",
diff --git a/app/lib/correctionInvoicePdf.tsx b/app/lib/correctionInvoicePdf.tsx
index 2d1d158..22cda51 100644
--- a/app/lib/correctionInvoicePdf.tsx
+++ b/app/lib/correctionInvoicePdf.tsx
@@ -121,6 +121,13 @@ export type InvoiceSeller = {
vatId: string;
taxRatePercent: number;
bankDetails?: string | null;
+ // Pflichtangaben in Geschäftsbriefen for registered legal forms (§37a
+ // HGB / §35a GmbHG) — optional because a sole proprietorship (the
+ // default legalForm in company-settings) has neither. Mirrors
+ // invoicePdf.tsx's own InvoiceSeller — see that file's comment.
+ registerCourt?: string | null;
+ registerNumber?: string | null;
+ managingDirector?: string | null;
};
// Stornorechnung: every item at its full ordered quantity (nothing
@@ -266,6 +273,8 @@ function CorrectionInvoiceDocument({ kind, order, seller }: { kind: CorrectionIn
{seller.sellerName} · {seller.sellerStreet}, {seller.sellerZip} {seller.sellerCity} · {seller.sellerEmail} · USt-IdNr.{" "}
{seller.vatId}
+ {seller.registerCourt && seller.registerNumber ? ` · ${seller.registerCourt} · ${seller.registerNumber}` : ""}
+ {seller.managingDirector ? ` · Geschäftsführung: ${seller.managingDirector}` : ""}
{seller.bankDetails ? Bankverbindung (für Überweisung): {seller.bankDetails} : null}
diff --git a/app/lib/emailTemplates.ts b/app/lib/emailTemplates.ts
index e29ce8a..f316880 100644
--- a/app/lib/emailTemplates.ts
+++ b/app/lib/emailTemplates.ts
@@ -80,10 +80,13 @@ export const DEFAULT_LEGAL_FOOTER_LINES: string[] = [
// plus VAT ID once assigned) — not just a friendly "brand · email" line.
// Built from the same company-settings fields the invoice PDFs already
// render (app/lib/invoicePdf.tsx), so there is exactly one source of truth
-// for this business's legal identity. If company-settings ever grows a
-// Handelsregister court/number or Geschäftsführer field (needed once this
-// business is a registered legal form rather than a sole proprietorship),
-// add those lines here too.
+// for this business's legal identity.
+//
+// registerCourt/registerNumber/managingDirector are conditionally required
+// on the Payload side (CompanySettings.ts, gated by legalForm) — only
+// appended here when actually present, so a sole proprietorship's footer
+// stays exactly as short as before this field set existed. Keep this in
+// sync with the Payload backend's own copy in src/lib/sellerInfo.ts.
export function buildLegalFooterLines(seller: CompanySettings | null): string[] {
if (!seller) return DEFAULT_LEGAL_FOOTER_LINES;
const lines = [
@@ -93,6 +96,8 @@ export function buildLegalFooterLines(seller: CompanySettings | null): string[]
`E-Mail: ${seller.sellerEmail}`,
];
if (seller.vatId) lines.push(`USt-IdNr.: ${seller.vatId}`);
+ if (seller.registerCourt && seller.registerNumber) lines.push(`${seller.registerCourt} · ${seller.registerNumber}`);
+ if (seller.managingDirector) lines.push(`Geschäftsführung: ${seller.managingDirector}`);
return lines;
}
diff --git a/app/lib/invoicePdf.tsx b/app/lib/invoicePdf.tsx
index 40f7938..69ece62 100644
--- a/app/lib/invoicePdf.tsx
+++ b/app/lib/invoicePdf.tsx
@@ -119,6 +119,14 @@ export type InvoiceSeller = {
vatId: string;
taxRatePercent: number;
bankDetails?: string | null;
+ // Pflichtangaben in Geschäftsbriefen for registered legal forms (§37a
+ // HGB / §35a GmbHG) — optional because a sole proprietorship (the
+ // default legalForm in company-settings) has neither. See
+ // buildLegalFooterLines() in emailTemplates.ts for the same fields'
+ // equivalent treatment in the email footer.
+ registerCourt?: string | null;
+ registerNumber?: string | null;
+ managingDirector?: string | null;
};
// Used only by /company-settings-preview's Live Preview — a fixed sample
@@ -305,6 +313,8 @@ export function InvoiceDocument({ order, seller }: { order: InvoiceOrder; seller
{seller.sellerName} · {seller.sellerStreet}, {seller.sellerZip} {seller.sellerCity} · {seller.sellerEmail} · USt-IdNr.{" "}
{seller.vatId}
+ {seller.registerCourt && seller.registerNumber ? ` · ${seller.registerCourt} · ${seller.registerNumber}` : ""}
+ {seller.managingDirector ? ` · Geschäftsführung: ${seller.managingDirector}` : ""}
{seller.bankDetails ? Bankverbindung (für Überweisung): {seller.bankDetails} : null}
diff --git a/app/lib/payload.ts b/app/lib/payload.ts
index 64a8c5a..bea3910 100644
--- a/app/lib/payload.ts
+++ b/app/lib/payload.ts
@@ -645,6 +645,13 @@ export async function getEmailTemplate(
export type CompanySettings = {
sellerName: string;
+ // Drives whether registerCourt/registerNumber/managingDirector are
+ // populated — mirrors Payload's CompanySettings.ts collection exactly
+ // (same option values), see buildLegalFooterLines() in emailTemplates.ts.
+ legalForm: "sole-proprietorship" | "e-k" | "gbr" | "ohg" | "kg" | "gmbh" | "ug" | "ag";
+ registerCourt: string | null;
+ registerNumber: string | null;
+ managingDirector: string | null;
sellerStreet: string;
sellerZip: string;
sellerCity: string;