Phase6c: Optional Company contact name
All checks were successful
Build and Push / build (push) Successful in 1m40s
All checks were successful
Build and Push / build (push) Successful in 1m40s
This commit is contained in:
@@ -80,6 +80,11 @@ interface PdfStrings {
|
||||
dueDate: string;
|
||||
period: string;
|
||||
billTo: string;
|
||||
// Phase 6 fix: prefix shown before the optional contact-person
|
||||
// name on the bill-to block. "z.Hd." (DE) / "Attn:" (EN) /
|
||||
// "À l'attention de" (FR) / "c.a." (IT). Empty/unused when the
|
||||
// invoice has no contactName on its snapshot.
|
||||
attentionPrefix: string;
|
||||
description: string;
|
||||
quantity: string;
|
||||
unitPrice: string;
|
||||
@@ -107,6 +112,7 @@ const MESSAGES: Record<string, PdfStrings> = {
|
||||
dueDate: "Zahlbar bis",
|
||||
period: "Abrechnungsperiode",
|
||||
billTo: "Rechnungsempfänger",
|
||||
attentionPrefix: "z.Hd.",
|
||||
description: "Beschreibung",
|
||||
quantity: "Menge",
|
||||
unitPrice: "Einzelpreis",
|
||||
@@ -139,6 +145,7 @@ const MESSAGES: Record<string, PdfStrings> = {
|
||||
dueDate: "Due date",
|
||||
period: "Billing period",
|
||||
billTo: "Bill to",
|
||||
attentionPrefix: "Attn:",
|
||||
description: "Description",
|
||||
quantity: "Qty",
|
||||
unitPrice: "Unit price",
|
||||
@@ -171,6 +178,7 @@ const MESSAGES: Record<string, PdfStrings> = {
|
||||
dueDate: "Échéance",
|
||||
period: "Période de facturation",
|
||||
billTo: "Destinataire",
|
||||
attentionPrefix: "À l'attention de",
|
||||
description: "Description",
|
||||
quantity: "Qté",
|
||||
unitPrice: "Prix unitaire",
|
||||
@@ -203,6 +211,7 @@ const MESSAGES: Record<string, PdfStrings> = {
|
||||
dueDate: "Scadenza",
|
||||
period: "Periodo di fatturazione",
|
||||
billTo: "Destinatario",
|
||||
attentionPrefix: "c.a.",
|
||||
description: "Descrizione",
|
||||
quantity: "Qtà",
|
||||
unitPrice: "Prezzo unitario",
|
||||
@@ -524,6 +533,15 @@ const InvoicePdf: React.FC<InvoicePdfProps> = ({ invoice, lines }) => {
|
||||
<View style={styles.billToBlock}>
|
||||
<Text style={styles.billToLabel}>{s.billTo}</Text>
|
||||
<Text style={styles.billToName}>{snap.companyName}</Text>
|
||||
{/* Phase 6 fix: optional "z.Hd." / "Attn:" line for routing
|
||||
the printed invoice internally at the customer. Prints
|
||||
between the company name and street address, in the
|
||||
invoice's locale (frozen at issue time). */}
|
||||
{snap.contactName && (
|
||||
<Text>
|
||||
{s.attentionPrefix} {snap.contactName}
|
||||
</Text>
|
||||
)}
|
||||
<Text>{snap.streetAddress}</Text>
|
||||
<Text>
|
||||
{snap.postalCode} {snap.city}
|
||||
|
||||
@@ -645,6 +645,7 @@ export async function computeInvoiceDraft(opts: {
|
||||
}
|
||||
const snapshot: InvoiceBillingSnapshot = {
|
||||
companyName: orgBilling.companyName,
|
||||
contactName: orgBilling.contactName ?? null,
|
||||
streetAddress: orgBilling.streetAddress,
|
||||
postalCode: orgBilling.postalCode,
|
||||
city: orgBilling.city,
|
||||
|
||||
@@ -198,6 +198,12 @@ const MIGRATION_SQL = `
|
||||
CREATE TABLE IF NOT EXISTS org_billing (
|
||||
zitadel_org_id TEXT PRIMARY KEY,
|
||||
company_name TEXT NOT NULL,
|
||||
-- Phase 6 fix: optional contact-person line shown on the
|
||||
-- invoice PDF below the company name (e.g. "z.Hd. Herr Müller").
|
||||
-- Not normally needed since invoices are delivered by email
|
||||
-- link, but useful when customers forward the PDF internally
|
||||
-- for AP routing in larger organizations.
|
||||
contact_name TEXT,
|
||||
street_address TEXT NOT NULL,
|
||||
postal_code TEXT NOT NULL,
|
||||
city TEXT NOT NULL,
|
||||
@@ -208,6 +214,10 @@ const MIGRATION_SQL = `
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
-- Phase 6 fix: ensure the column exists on databases that were
|
||||
-- created before contact_name was added to the base schema above.
|
||||
-- IF NOT EXISTS makes this safe to run repeatedly via ensureSchema.
|
||||
ALTER TABLE org_billing ADD COLUMN IF NOT EXISTS contact_name TEXT;
|
||||
|
||||
-- Feature 5: lightweight customer support / feedback tickets.
|
||||
-- Scoped strictly per-user (zitadel_user_id), not per-org —
|
||||
@@ -1262,6 +1272,7 @@ function rowToOrgBilling(row: any): OrgBilling {
|
||||
return {
|
||||
zitadelOrgId: row.zitadel_org_id,
|
||||
companyName: row.company_name,
|
||||
contactName: row.contact_name ?? null,
|
||||
streetAddress: row.street_address,
|
||||
postalCode: row.postal_code,
|
||||
city: row.city,
|
||||
@@ -1306,12 +1317,13 @@ export async function upsertOrgBilling(
|
||||
await ensureSchema();
|
||||
const result = await getPool().query(
|
||||
`INSERT INTO org_billing (
|
||||
zitadel_org_id, company_name, street_address, postal_code,
|
||||
city, country, vat_number, billing_email, notes
|
||||
zitadel_org_id, company_name, contact_name, street_address,
|
||||
postal_code, city, country, vat_number, billing_email, notes
|
||||
)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
|
||||
ON CONFLICT (zitadel_org_id) DO UPDATE SET
|
||||
company_name = EXCLUDED.company_name,
|
||||
contact_name = EXCLUDED.contact_name,
|
||||
street_address = EXCLUDED.street_address,
|
||||
postal_code = EXCLUDED.postal_code,
|
||||
city = EXCLUDED.city,
|
||||
@@ -1324,6 +1336,7 @@ export async function upsertOrgBilling(
|
||||
[
|
||||
data.zitadelOrgId,
|
||||
data.companyName,
|
||||
data.contactName ?? null,
|
||||
data.streetAddress,
|
||||
data.postalCode,
|
||||
data.city,
|
||||
|
||||
Reference in New Issue
Block a user