فهرست منبع

Print custom field values in the workshop's language and date format (#638)

Bernt Christian Egeland 2 روز پیش
والد
کامیت
502e6fc070
38فایلهای تغییر یافته به همراه693 افزوده شده و 63 حذف شده
  1. 3 1
      messages/de/pdf.json
  2. 3 1
      messages/de/settings.json
  3. 3 1
      messages/en/pdf.json
  4. 3 1
      messages/en/settings.json
  5. 3 1
      messages/es/pdf.json
  6. 3 1
      messages/es/settings.json
  7. 3 1
      messages/fr/pdf.json
  8. 3 1
      messages/fr/settings.json
  9. 3 1
      messages/it/pdf.json
  10. 3 1
      messages/it/settings.json
  11. 3 1
      messages/lt/pdf.json
  12. 3 1
      messages/lt/settings.json
  13. 3 1
      messages/nb/pdf.json
  14. 3 1
      messages/nb/settings.json
  15. 3 1
      messages/nl/pdf.json
  16. 3 1
      messages/nl/settings.json
  17. 3 1
      messages/pl/pdf.json
  18. 3 1
      messages/pl/settings.json
  19. 3 1
      messages/pt-BR/pdf.json
  20. 3 1
      messages/pt-BR/settings.json
  21. 3 1
      messages/pt-PT/pdf.json
  22. 3 1
      messages/pt-PT/settings.json
  23. 3 1
      messages/ru/pdf.json
  24. 3 1
      messages/ru/settings.json
  25. 3 1
      messages/tr/pdf.json
  26. 3 1
      messages/tr/settings.json
  27. 67 0
      src/__tests__/features/custom-fields/form-strings.test.tsx
  28. 403 0
      src/__tests__/features/custom-fields/print-language.test.ts
  29. 3 3
      src/features/custom-fields/Components/CustomFieldsForm.tsx
  30. 107 0
      src/features/custom-fields/Lib/customFieldText.ts
  31. 6 3
      src/features/invoice-designer/Pdf/buildInvoicePrint.ts
  32. 6 3
      src/features/invoice-designer/Pdf/buildQuotePrint.ts
  33. 6 3
      src/features/invoice-designer/Pdf/buildWorkOrderPrint.ts
  34. 8 1
      src/features/invoices/Lib/assembleInvoicePrint.ts
  35. 1 0
      src/features/invoices/Lib/issueInvoice.ts
  36. 6 0
      src/features/invoices/Lib/issuedInvoice.ts
  37. 0 23
      src/features/vehicles/Components/invoice-pdf/CustomFields.tsx
  38. 2 1
      src/features/vehicles/Components/invoice-pdf/types.ts

+ 3 - 1
messages/de/pdf.json

@@ -236,7 +236,9 @@
     "serviceTypeMaintenance": "Wartung",
     "serviceTypeMaintenance": "Wartung",
     "serviceTypeRepair": "Reparatur",
     "serviceTypeRepair": "Reparatur",
     "serviceTypeUpgrade": "Verbesserung",
     "serviceTypeUpgrade": "Verbesserung",
-    "serviceTypeInspection": "Überprüfung"
+    "serviceTypeInspection": "Überprüfung",
+    "customFieldYes": "Ja",
+    "customFieldNo": "Nein"
   },
   },
   "workOrder": {
   "workOrder": {
     "title": "ARBEITSAUFTRAG",
     "title": "ARBEITSAUFTRAG",

+ 3 - 1
messages/de/settings.json

@@ -1195,7 +1195,9 @@
     "placement": "Position auf dem Dokument",
     "placement": "Position auf dem Dokument",
     "placementHidden": "Wird nicht gedruckt",
     "placementHidden": "Wird nicht gedruckt",
     "placementHint": "In welchem Abschnitt der Rechnung oder des Angebots dieses Feld gedruckt wird. Im Designer kann es zusätzlich in weiteren Abschnitten aktiviert werden.",
     "placementHint": "In welchem Abschnitt der Rechnung oder des Angebots dieses Feld gedruckt wird. Im Designer kann es zusätzlich in weiteren Abschnitten aktiviert werden.",
-    "failedSavePlacement": "Feldposition konnte nicht gespeichert werden"
+    "failedSavePlacement": "Feldposition konnte nicht gespeichert werden",
+    "formTitle": "Benutzerdefinierte Felder",
+    "requiredError": "{label} ist erforderlich"
   },
   },
   "workshop": {
   "workshop": {
     "title": "Werkstatt-Standards",
     "title": "Werkstatt-Standards",

+ 3 - 1
messages/en/pdf.json

@@ -236,7 +236,9 @@
     "serviceTypeMaintenance": "Maintenance",
     "serviceTypeMaintenance": "Maintenance",
     "serviceTypeRepair": "Repair",
     "serviceTypeRepair": "Repair",
     "serviceTypeUpgrade": "Upgrade",
     "serviceTypeUpgrade": "Upgrade",
-    "serviceTypeInspection": "Inspection"
+    "serviceTypeInspection": "Inspection",
+    "customFieldYes": "Yes",
+    "customFieldNo": "No"
   },
   },
   "workOrder": {
   "workOrder": {
     "title": "WORK ORDER",
     "title": "WORK ORDER",

+ 3 - 1
messages/en/settings.json

@@ -1195,7 +1195,9 @@
     "placement": "Placement on document",
     "placement": "Placement on document",
     "placementHidden": "Not printed",
     "placementHidden": "Not printed",
     "placementHint": "Which section of the invoice or quote this field prints in. In the designer you can also switch it on in more sections.",
     "placementHint": "Which section of the invoice or quote this field prints in. In the designer you can also switch it on in more sections.",
-    "failedSavePlacement": "Failed to save field placement"
+    "failedSavePlacement": "Failed to save field placement",
+    "formTitle": "Custom Fields",
+    "requiredError": "{label} is required"
   },
   },
   "workshop": {
   "workshop": {
     "title": "Workshop Defaults",
     "title": "Workshop Defaults",

+ 3 - 1
messages/es/pdf.json

@@ -236,7 +236,9 @@
     "serviceTypeMaintenance": "Mantenimiento",
     "serviceTypeMaintenance": "Mantenimiento",
     "serviceTypeRepair": "Reparación",
     "serviceTypeRepair": "Reparación",
     "serviceTypeUpgrade": "Mejora",
     "serviceTypeUpgrade": "Mejora",
-    "serviceTypeInspection": "Inspección"
+    "serviceTypeInspection": "Inspección",
+    "customFieldYes": "Sí",
+    "customFieldNo": "No"
   },
   },
   "workOrder": {
   "workOrder": {
     "title": "ORDEN DE TRABAJO",
     "title": "ORDEN DE TRABAJO",

+ 3 - 1
messages/es/settings.json

@@ -1195,7 +1195,9 @@
     "placement": "Ubicación en el documento",
     "placement": "Ubicación en el documento",
     "placementHidden": "No se imprime",
     "placementHidden": "No se imprime",
     "placementHint": "En qué sección de la factura o del presupuesto se imprime este campo. En el diseñador también puedes activarlo en más secciones.",
     "placementHint": "En qué sección de la factura o del presupuesto se imprime este campo. En el diseñador también puedes activarlo en más secciones.",
-    "failedSavePlacement": "No se pudo guardar la ubicación del campo"
+    "failedSavePlacement": "No se pudo guardar la ubicación del campo",
+    "formTitle": "Campos personalizados",
+    "requiredError": "El campo {label} es obligatorio"
   },
   },
   "workshop": {
   "workshop": {
     "title": "Valores predeterminados del taller",
     "title": "Valores predeterminados del taller",

+ 3 - 1
messages/fr/pdf.json

@@ -236,7 +236,9 @@
     "serviceTypeMaintenance": "Maintenance",
     "serviceTypeMaintenance": "Maintenance",
     "serviceTypeRepair": "Réparation",
     "serviceTypeRepair": "Réparation",
     "serviceTypeUpgrade": "Mise à Niveau",
     "serviceTypeUpgrade": "Mise à Niveau",
-    "serviceTypeInspection": "Inspection"
+    "serviceTypeInspection": "Inspection",
+    "customFieldYes": "Oui",
+    "customFieldNo": "Non"
   },
   },
   "workOrder": {
   "workOrder": {
     "title": "ORDRE DE TRAVAIL",
     "title": "ORDRE DE TRAVAIL",

+ 3 - 1
messages/fr/settings.json

@@ -1195,7 +1195,9 @@
     "placement": "Emplacement sur le document",
     "placement": "Emplacement sur le document",
     "placementHidden": "Non imprimé",
     "placementHidden": "Non imprimé",
     "placementHint": "Dans quelle section de la facture ou du devis ce champ est imprimé. Dans le designer, vous pouvez aussi l'activer dans d'autres sections.",
     "placementHint": "Dans quelle section de la facture ou du devis ce champ est imprimé. Dans le designer, vous pouvez aussi l'activer dans d'autres sections.",
-    "failedSavePlacement": "Impossible d'enregistrer l'emplacement du champ"
+    "failedSavePlacement": "Impossible d'enregistrer l'emplacement du champ",
+    "formTitle": "Champs personnalisés",
+    "requiredError": "Le champ {label} est obligatoire"
   },
   },
   "workshop": {
   "workshop": {
     "title": "Valeurs par défaut de l'atelier",
     "title": "Valeurs par défaut de l'atelier",

+ 3 - 1
messages/it/pdf.json

@@ -236,7 +236,9 @@
     "serviceTypeMaintenance": "Manutenzione",
     "serviceTypeMaintenance": "Manutenzione",
     "serviceTypeRepair": "Riparazione",
     "serviceTypeRepair": "Riparazione",
     "serviceTypeUpgrade": "Aggiornamento",
     "serviceTypeUpgrade": "Aggiornamento",
-    "serviceTypeInspection": "Ispezione"
+    "serviceTypeInspection": "Ispezione",
+    "customFieldYes": "Sì",
+    "customFieldNo": "No"
   },
   },
   "workOrder": {
   "workOrder": {
     "title": "ORDINE DI LAVORO",
     "title": "ORDINE DI LAVORO",

+ 3 - 1
messages/it/settings.json

@@ -1195,7 +1195,9 @@
     "placement": "Posizione sul documento",
     "placement": "Posizione sul documento",
     "placementHidden": "Non stampato",
     "placementHidden": "Non stampato",
     "placementHint": "In quale sezione della fattura o del preventivo viene stampato questo campo. Nel designer puoi attivarlo anche in altre sezioni.",
     "placementHint": "In quale sezione della fattura o del preventivo viene stampato questo campo. Nel designer puoi attivarlo anche in altre sezioni.",
-    "failedSavePlacement": "Impossibile salvare la posizione del campo"
+    "failedSavePlacement": "Impossibile salvare la posizione del campo",
+    "formTitle": "Campi personalizzati",
+    "requiredError": "Il campo {label} è obbligatorio"
   },
   },
   "workshop": {
   "workshop": {
     "title": "Predefiniti officina",
     "title": "Predefiniti officina",

+ 3 - 1
messages/lt/pdf.json

@@ -236,7 +236,9 @@
     "serviceTypeMaintenance": "Priežiūra",
     "serviceTypeMaintenance": "Priežiūra",
     "serviceTypeRepair": "Remontas",
     "serviceTypeRepair": "Remontas",
     "serviceTypeUpgrade": "Pagerinimas",
     "serviceTypeUpgrade": "Pagerinimas",
-    "serviceTypeInspection": "Apžiūra"
+    "serviceTypeInspection": "Apžiūra",
+    "customFieldYes": "Taip",
+    "customFieldNo": "Ne"
   },
   },
   "workOrder": {
   "workOrder": {
     "title": "DARBO UŽSAKYMAS",
     "title": "DARBO UŽSAKYMAS",

+ 3 - 1
messages/lt/settings.json

@@ -1195,7 +1195,9 @@
     "placement": "Vieta dokumente",
     "placement": "Vieta dokumente",
     "placementHidden": "Nespausdinama",
     "placementHidden": "Nespausdinama",
     "placementHint": "Kurioje sąskaitos arba pasiūlymo dalyje spausdinamas šis laukas. Dizaineryje jį galima įjungti ir kitose dalyse.",
     "placementHint": "Kurioje sąskaitos arba pasiūlymo dalyje spausdinamas šis laukas. Dizaineryje jį galima įjungti ir kitose dalyse.",
-    "failedSavePlacement": "Nepavyko išsaugoti lauko vietos"
+    "failedSavePlacement": "Nepavyko išsaugoti lauko vietos",
+    "formTitle": "Pasirinktiniai laukai",
+    "requiredError": "{label}: būtina užpildyti"
   },
   },
   "workshop": {
   "workshop": {
     "title": "Dirbtuvių numatytosios reikšmės",
     "title": "Dirbtuvių numatytosios reikšmės",

+ 3 - 1
messages/nb/pdf.json

@@ -236,7 +236,9 @@
     "serviceTypeMaintenance": "Vedlikehold",
     "serviceTypeMaintenance": "Vedlikehold",
     "serviceTypeRepair": "Reparasjon",
     "serviceTypeRepair": "Reparasjon",
     "serviceTypeUpgrade": "Oppgradering",
     "serviceTypeUpgrade": "Oppgradering",
-    "serviceTypeInspection": "Inspeksjon"
+    "serviceTypeInspection": "Inspeksjon",
+    "customFieldYes": "Ja",
+    "customFieldNo": "Nei"
   },
   },
   "workOrder": {
   "workOrder": {
     "title": "ARBEIDSORDRE",
     "title": "ARBEIDSORDRE",

+ 3 - 1
messages/nb/settings.json

@@ -1195,7 +1195,9 @@
     "placement": "Plassering på dokumentet",
     "placement": "Plassering på dokumentet",
     "placementHidden": "Skrives ikke ut",
     "placementHidden": "Skrives ikke ut",
     "placementHint": "Hvilken del av fakturaen eller tilbudet dette feltet skrives ut i. I designeren kan du også slå det på i flere seksjoner.",
     "placementHint": "Hvilken del av fakturaen eller tilbudet dette feltet skrives ut i. I designeren kan du også slå det på i flere seksjoner.",
-    "failedSavePlacement": "Kunne ikke lagre feltplasseringen"
+    "failedSavePlacement": "Kunne ikke lagre feltplasseringen",
+    "formTitle": "Egendefinerte felter",
+    "requiredError": "{label} er påkrevd"
   },
   },
   "workshop": {
   "workshop": {
     "title": "Verkstedstandarder",
     "title": "Verkstedstandarder",

+ 3 - 1
messages/nl/pdf.json

@@ -236,7 +236,9 @@
     "serviceTypeMaintenance": "Onderhoud",
     "serviceTypeMaintenance": "Onderhoud",
     "serviceTypeRepair": "Reparatie",
     "serviceTypeRepair": "Reparatie",
     "serviceTypeUpgrade": "Upgrade",
     "serviceTypeUpgrade": "Upgrade",
-    "serviceTypeInspection": "Inspectie"
+    "serviceTypeInspection": "Inspectie",
+    "customFieldYes": "Ja",
+    "customFieldNo": "Nee"
   },
   },
   "workOrder": {
   "workOrder": {
     "title": "WERKORDER",
     "title": "WERKORDER",

+ 3 - 1
messages/nl/settings.json

@@ -1195,7 +1195,9 @@
     "placement": "Plaats op het document",
     "placement": "Plaats op het document",
     "placementHidden": "Wordt niet afgedrukt",
     "placementHidden": "Wordt niet afgedrukt",
     "placementHint": "In welke sectie van de factuur of offerte dit veld wordt afgedrukt. In de designer kun je het ook in meer secties inschakelen.",
     "placementHint": "In welke sectie van de factuur of offerte dit veld wordt afgedrukt. In de designer kun je het ook in meer secties inschakelen.",
-    "failedSavePlacement": "Kan de veldplaatsing niet opslaan"
+    "failedSavePlacement": "Kan de veldplaatsing niet opslaan",
+    "formTitle": "Aangepaste velden",
+    "requiredError": "{label} is verplicht"
   },
   },
   "workshop": {
   "workshop": {
     "title": "Werkplaatsstandaarden",
     "title": "Werkplaatsstandaarden",

+ 3 - 1
messages/pl/pdf.json

@@ -236,7 +236,9 @@
     "serviceTypeMaintenance": "Konserwacja",
     "serviceTypeMaintenance": "Konserwacja",
     "serviceTypeRepair": "Naprawa",
     "serviceTypeRepair": "Naprawa",
     "serviceTypeUpgrade": "Modernizacja",
     "serviceTypeUpgrade": "Modernizacja",
-    "serviceTypeInspection": "Inspekcja"
+    "serviceTypeInspection": "Inspekcja",
+    "customFieldYes": "Tak",
+    "customFieldNo": "Nie"
   },
   },
   "workOrder": {
   "workOrder": {
     "title": "ZLECENIE",
     "title": "ZLECENIE",

+ 3 - 1
messages/pl/settings.json

@@ -1195,7 +1195,9 @@
     "placement": "Miejsce na dokumencie",
     "placement": "Miejsce na dokumencie",
     "placementHidden": "Nie jest drukowane",
     "placementHidden": "Nie jest drukowane",
     "placementHint": "W której sekcji faktury lub wyceny drukowane jest to pole. W projektancie można je włączyć także w innych sekcjach.",
     "placementHint": "W której sekcji faktury lub wyceny drukowane jest to pole. W projektancie można je włączyć także w innych sekcjach.",
-    "failedSavePlacement": "Nie udało się zapisać miejsca pola"
+    "failedSavePlacement": "Nie udało się zapisać miejsca pola",
+    "formTitle": "Pola niestandardowe",
+    "requiredError": "Pole {label} jest wymagane"
   },
   },
   "workshop": {
   "workshop": {
     "title": "Domyślne warsztatu",
     "title": "Domyślne warsztatu",

+ 3 - 1
messages/pt-BR/pdf.json

@@ -236,7 +236,9 @@
     "serviceTypeMaintenance": "Manutenção",
     "serviceTypeMaintenance": "Manutenção",
     "serviceTypeRepair": "Reparo",
     "serviceTypeRepair": "Reparo",
     "serviceTypeUpgrade": "Atualização",
     "serviceTypeUpgrade": "Atualização",
-    "serviceTypeInspection": "Inspeção"
+    "serviceTypeInspection": "Inspeção",
+    "customFieldYes": "Sim",
+    "customFieldNo": "Não"
   },
   },
   "workOrder": {
   "workOrder": {
     "title": "ORDEM DE SERVIÇO",
     "title": "ORDEM DE SERVIÇO",

+ 3 - 1
messages/pt-BR/settings.json

@@ -1195,7 +1195,9 @@
     "placement": "Posição no documento",
     "placement": "Posição no documento",
     "placementHidden": "Não é impresso",
     "placementHidden": "Não é impresso",
     "placementHint": "Em qual seção da fatura ou do orçamento este campo é impresso. No designer você também pode ativá-lo em mais seções.",
     "placementHint": "Em qual seção da fatura ou do orçamento este campo é impresso. No designer você também pode ativá-lo em mais seções.",
-    "failedSavePlacement": "Não foi possível salvar a posição do campo"
+    "failedSavePlacement": "Não foi possível salvar a posição do campo",
+    "formTitle": "Campos personalizados",
+    "requiredError": "O campo {label} é obrigatório"
   },
   },
   "workshop": {
   "workshop": {
     "title": "Padrões da oficina",
     "title": "Padrões da oficina",

+ 3 - 1
messages/pt-PT/pdf.json

@@ -236,7 +236,9 @@
     "serviceTypeMaintenance": "Manutenção",
     "serviceTypeMaintenance": "Manutenção",
     "serviceTypeRepair": "Reparação",
     "serviceTypeRepair": "Reparação",
     "serviceTypeUpgrade": "Melhoria",
     "serviceTypeUpgrade": "Melhoria",
-    "serviceTypeInspection": "Inspeção"
+    "serviceTypeInspection": "Inspeção",
+    "customFieldYes": "Sim",
+    "customFieldNo": "Não"
   },
   },
   "workOrder": {
   "workOrder": {
     "title": "ORDEM DE TRABALHO",
     "title": "ORDEM DE TRABALHO",

+ 3 - 1
messages/pt-PT/settings.json

@@ -1195,7 +1195,9 @@
     "placement": "Posição no documento",
     "placement": "Posição no documento",
     "placementHidden": "Não é impresso",
     "placementHidden": "Não é impresso",
     "placementHint": "Em que secção da fatura ou do orçamento este campo é impresso. No editor também pode ativá-lo em mais secções.",
     "placementHint": "Em que secção da fatura ou do orçamento este campo é impresso. No editor também pode ativá-lo em mais secções.",
-    "failedSavePlacement": "Não foi possível guardar a posição do campo"
+    "failedSavePlacement": "Não foi possível guardar a posição do campo",
+    "formTitle": "Campos personalizados",
+    "requiredError": "O campo {label} é obrigatório"
   },
   },
   "workshop": {
   "workshop": {
     "title": "Predefinições da oficina",
     "title": "Predefinições da oficina",

+ 3 - 1
messages/ru/pdf.json

@@ -236,7 +236,9 @@
     "serviceTypeMaintenance": "Техобслуживание",
     "serviceTypeMaintenance": "Техобслуживание",
     "serviceTypeRepair": "Ремонт",
     "serviceTypeRepair": "Ремонт",
     "serviceTypeUpgrade": "Модернизация",
     "serviceTypeUpgrade": "Модернизация",
-    "serviceTypeInspection": "Осмотр"
+    "serviceTypeInspection": "Осмотр",
+    "customFieldYes": "Да",
+    "customFieldNo": "Нет"
   },
   },
   "workOrder": {
   "workOrder": {
     "title": "ЗАКАЗ-НАРЯД",
     "title": "ЗАКАЗ-НАРЯД",

+ 3 - 1
messages/ru/settings.json

@@ -1195,7 +1195,9 @@
     "placement": "Расположение в документе",
     "placement": "Расположение в документе",
     "placementHidden": "Не печатается",
     "placementHidden": "Не печатается",
     "placementHint": "В каком разделе счёта или сметы печатается это поле. В дизайнере его можно включить и в других разделах.",
     "placementHint": "В каком разделе счёта или сметы печатается это поле. В дизайнере его можно включить и в других разделах.",
-    "failedSavePlacement": "Не удалось сохранить расположение поля"
+    "failedSavePlacement": "Не удалось сохранить расположение поля",
+    "formTitle": "Пользовательские поля",
+    "requiredError": "Поле {label} обязательно для заполнения"
   },
   },
   "workshop": {
   "workshop": {
     "title": "Настройки мастерской",
     "title": "Настройки мастерской",

+ 3 - 1
messages/tr/pdf.json

@@ -236,7 +236,9 @@
     "serviceTypeMaintenance": "Bakım",
     "serviceTypeMaintenance": "Bakım",
     "serviceTypeRepair": "Onarım",
     "serviceTypeRepair": "Onarım",
     "serviceTypeUpgrade": "Yükseltme",
     "serviceTypeUpgrade": "Yükseltme",
-    "serviceTypeInspection": "Muayene"
+    "serviceTypeInspection": "Muayene",
+    "customFieldYes": "Evet",
+    "customFieldNo": "Hayır"
   },
   },
   "workOrder": {
   "workOrder": {
     "title": "İŞ EMRİ",
     "title": "İŞ EMRİ",

+ 3 - 1
messages/tr/settings.json

@@ -1195,7 +1195,9 @@
     "placement": "Belgedeki konum",
     "placement": "Belgedeki konum",
     "placementHidden": "Yazdırılmaz",
     "placementHidden": "Yazdırılmaz",
     "placementHint": "Bu alanın faturanın veya teklifin hangi bölümünde yazdırılacağı. Tasarımcıda başka bölümlerde de açabilirsiniz.",
     "placementHint": "Bu alanın faturanın veya teklifin hangi bölümünde yazdırılacağı. Tasarımcıda başka bölümlerde de açabilirsiniz.",
-    "failedSavePlacement": "Alan konumu kaydedilemedi"
+    "failedSavePlacement": "Alan konumu kaydedilemedi",
+    "formTitle": "Özel alanlar",
+    "requiredError": "{label} zorunludur"
   },
   },
   "workshop": {
   "workshop": {
     "title": "Atölye Varsayılanları",
     "title": "Atölye Varsayılanları",

+ 67 - 0
src/__tests__/features/custom-fields/form-strings.test.tsx

@@ -0,0 +1,67 @@
+/**
+ * The custom fields card on a work order or a quote reads its title and its
+ * "required" message from the translations, not from English in the code.
+ */
+import { act, render, screen } from '@testing-library/react'
+import { describe, expect, it, vi } from 'vitest'
+
+vi.mock('@/features/custom-fields/Actions/customFieldActions', () => ({
+  getCustomFieldValues: vi.fn(async () => ({
+    success: true,
+    data: [
+      {
+        id: 'f1',
+        name: 'key_number',
+        label: 'Key number',
+        fieldType: 'text',
+        options: null,
+        required: true,
+        value: '',
+      },
+      {
+        id: 'f2',
+        name: 'courtesy_car',
+        label: 'Courtesy car',
+        fieldType: 'checkbox',
+        options: null,
+        required: true,
+        value: 'false',
+      },
+    ],
+  })),
+  getFieldDefinitions: vi.fn(async () => ({ success: true, data: [] })),
+  saveCustomFieldValues: vi.fn(async () => ({ success: true })),
+}))
+
+import { CustomFieldsForm } from '@/features/custom-fields/Components/CustomFieldsForm'
+import en from '../../../../messages/en/settings.json'
+
+describe('the custom fields card', () => {
+  it('keeps its English words in the translations', () => {
+    expect(en.customFields.formTitle).toBe('Custom Fields')
+    expect(en.customFields.requiredError).toBe('{label} is required')
+  })
+
+  it('shows its title and names the empty required field when saving', async () => {
+    let save: (() => Promise<{ valid: boolean }>) | undefined
+    render(
+      <CustomFieldsForm
+        entityId="rec-1"
+        entityType="service_record"
+        onValuesReady={(fn) => {
+          save = fn
+        }}
+      />
+    )
+    expect(await screen.findByText('Custom Fields')).toBeInTheDocument()
+
+    let result: { valid: boolean } | undefined
+    await act(async () => {
+      result = await save?.()
+    })
+    expect(result).toEqual({ valid: false })
+    expect(screen.getByText('Key number is required')).toBeInTheDocument()
+    // A checkbox left unticked is an answer, never a missing one.
+    expect(screen.queryByText('Courtesy car is required')).not.toBeInTheDocument()
+  })
+})

+ 403 - 0
src/__tests__/features/custom-fields/print-language.test.ts

@@ -0,0 +1,403 @@
+// @vitest-environment node
+/**
+ * A custom field on paper a customer holds.
+ *
+ * A checkbox prints the workshop's word for yes or no and a date prints in
+ * the workshop's date format, as the calendar day that was picked, on the
+ * invoice, the quote and the work order alike. Text and numbers print as
+ * typed. An invoice issued while every document said "Yes" and "March 10,
+ * 2026" keeps saying that when it is printed again.
+ */
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+
+const db = {
+  serviceRecord: { findUnique: vi.fn() },
+  appSetting: { findMany: vi.fn() },
+  organization: { findUnique: vi.fn() },
+  vehicleFinding: { findMany: vi.fn() },
+  documentDesign: { findFirst: vi.fn() },
+  inspection: { findFirst: vi.fn() },
+}
+const liveCustomFields = vi.fn(async (): Promise<unknown[]> => [])
+vi.mock('@/lib/db', () => ({ db }))
+vi.mock('@/features/custom-fields/Lib/getCustomFieldsForPrint', () => ({
+  getCustomFieldsForPrint: () => liveCustomFields(),
+}))
+vi.mock('@/features/invoice-designer/Lib/designRules.server', () => ({
+  designRuleSubjectOf: () => ({}),
+  findRuleDesign: async () => null,
+}))
+vi.mock('@/features/signatures/Lib/memberSignature.server', () => ({
+  memberSignatureDataUri: async () => undefined,
+}))
+vi.mock('@/features/condition-map/Lib/loadMarks.server', () => ({
+  loadVisitConditionMap: async () => null,
+  loadMarkTypeRows: async () => [],
+}))
+
+const { customFieldText, legacyCustomFieldText } = await import(
+  '@/features/custom-fields/Lib/customFieldText'
+)
+const { loadPrintLabels } = await import('@/features/invoice-designer/Pdf/printLabels')
+const { buildInvoicePrintSpec } = await import('@/features/invoice-designer/Pdf/buildInvoicePrint')
+const { buildQuotePrintSpec } = await import('@/features/invoice-designer/Pdf/buildQuotePrint')
+const { buildWorkOrderPrintSpec } = await import(
+  '@/features/invoice-designer/Pdf/buildWorkOrderPrint'
+)
+const { assembleInvoicePrint } = await import('@/features/invoices/Lib/assembleInvoicePrint')
+const { buildIssuedInvoiceData } = await import('@/features/invoices/Lib/issueInvoice')
+const { DESIGNER_LAYOUT_VERSION, getDefaultLayout } = await import(
+  '@/features/settings/Schema/invoiceLayoutSchema'
+)
+
+/* eslint-disable @typescript-eslint/no-explicit-any */
+
+/** A Norwegian workshop a long way west of Greenwich, on a server further east still. */
+const WORKSHOP_ZONE = 'America/Los_Angeles'
+const SERVER_ZONES = ['Pacific/Kiritimati', 'Pacific/Pago_Pago', 'UTC']
+const originalTz = process.env.TZ
+afterEach(() => {
+  process.env.TZ = originalTz
+})
+
+const fields = () => [
+  { fieldId: 'cf1', label: 'Lånebil', value: 'true', fieldType: 'checkbox' },
+  { fieldId: 'cf2', label: 'Hjul lagret', value: 'false', fieldType: 'checkbox' },
+  { fieldId: 'cf3', label: 'Neste EU-kontroll', value: '2026-03-10', fieldType: 'date' },
+  { fieldId: 'cf4', label: 'Nøkkelnummer', value: '0042', fieldType: 'text' },
+  { fieldId: 'cf5', label: 'Dekktrykk', value: '2.40', fieldType: 'number' },
+  { fieldId: 'cf6', label: 'Kilde', value: 'true', fieldType: 'select' },
+]
+
+const invoice = (customFields: unknown[] = fields()) =>
+  ({
+    id: 'svc_1',
+    title: 'Service',
+    description: null,
+    type: 'repair',
+    serviceDate: new Date('2026-09-18T10:00:00Z'),
+    invoiceDate: new Date('2026-09-18T10:00:00Z'),
+    invoiceDueDate: null,
+    shopName: 'Verksted',
+    techName: null,
+    mileage: 1000,
+    diagnosticNotes: null,
+    invoiceNotes: null,
+    subtotal: 100,
+    taxRate: 0,
+    taxAmount: 0,
+    totalAmount: 100,
+    cost: 100,
+    invoiceNumber: 'INV-1',
+    discountValue: 0,
+    partItems: [],
+    laborItems: [{ description: 'Arbeid', hours: 1, rate: 100, total: 100 }],
+    customFields,
+    findings: [],
+    customer: { name: 'Zz Test', email: null, phone: null, address: null, company: null },
+    vehicle: {
+      make: 'Volvo',
+      model: 'V60',
+      year: 2020,
+      vin: null,
+      licensePlate: 'AB 12345',
+      mileage: 1000,
+      customer: null,
+    },
+  }) as any
+
+const quote = () =>
+  ({
+    quoteNumber: 'Q-1',
+    title: 'Service',
+    description: null,
+    validUntil: null,
+    createdAt: new Date('2026-09-10T10:00:00Z'),
+    subtotal: 100,
+    taxRate: 0,
+    taxAmount: 0,
+    taxInclusive: false,
+    discountType: null,
+    discountValue: 0,
+    discountAmount: 0,
+    totalAmount: 100,
+    notes: null,
+    partItems: [],
+    laborItems: [{ description: 'Arbeid', hours: 1, rate: 100, total: 100 }],
+    customer: { name: 'Zz Test', email: null, phone: null, address: null, company: null },
+    vehicle: { make: 'Volvo', model: 'V60', year: 2020, vin: null, licensePlate: 'AB 12345' },
+  }) as any
+
+/** A design with the panel custom fields print in switched on; it is off until a field is placed. */
+function design(type: 'invoice' | 'quote' | 'work_order') {
+  const layout = getDefaultLayout(type)
+  return {
+    ...layout,
+    version: DESIGNER_LAYOUT_VERSION,
+    sections: layout.sections.map((s) => (s.id === 'general' ? { ...s, visible: true } : s)),
+  }
+}
+
+/** Everything a sheet says, as one string. */
+const said = (spec: unknown) => JSON.stringify(spec)
+
+const settings = { currencyCode: 'NOK', dateFormat: 'dd.MM.yyyy', timezone: WORKSHOP_ZONE }
+
+async function sheets(locale: string) {
+  const [invoiceLabels, quoteLabels, workOrderLabels] = await Promise.all([
+    loadPrintLabels(locale, {}, 'invoice'),
+    loadPrintLabels(locale, {}, 'quote'),
+    loadPrintLabels(locale, {}, 'work_order'),
+  ])
+  return {
+    invoice: said(
+      buildInvoicePrintSpec({
+        data: invoice(),
+        labels: invoiceLabels,
+        invoiceSettings: settings,
+        template: { layoutConfig: design('invoice') } as any,
+      })
+    ),
+    quote: said(
+      buildQuotePrintSpec({
+        data: quote(),
+        labels: quoteLabels,
+        customFields: fields(),
+        layoutConfig: design('quote') as any,
+        dateFormat: settings.dateFormat,
+        timezone: settings.timezone,
+      })
+    ),
+    workOrder: said(
+      buildWorkOrderPrintSpec({
+        data: invoice(),
+        job: {
+          orderNumber: '1',
+          statusLabel: 'Pågår',
+          workBay: null,
+          helperNames: [],
+          promisedAt: null,
+          concerns: [],
+          qrDataUri: null,
+          printedAt: new Date('2026-09-25T10:00:00Z'),
+        } as any,
+        labels: workOrderLabels,
+        invoiceSettings: settings,
+        template: { layoutConfig: design('work_order') } as any,
+      })
+    ),
+  }
+}
+
+describe("a custom field on a customer's document", () => {
+  for (const serverZone of SERVER_ZONES) {
+    it(`prints in the workshop's language and date format on every sheet (server in ${serverZone})`, async () => {
+      process.env.TZ = serverZone
+      const printed = await sheets('nb')
+      for (const [name, text] of Object.entries(printed)) {
+        expect(text, name).toContain('Lånebil: Ja')
+        expect(text, name).toContain('Hjul lagret: Nei')
+        expect(text, name).toContain('Neste EU-kontroll: 10.03.2026')
+        expect(text, name).not.toContain('Lånebil: Yes')
+        expect(text, name).not.toContain('March 10, 2026')
+      }
+    })
+  }
+
+  it('prints text, numbers and choices exactly as they were typed', async () => {
+    const printed = await sheets('nb')
+    for (const [name, text] of Object.entries(printed)) {
+      expect(text, name).toContain('Nøkkelnummer: 0042')
+      expect(text, name).toContain('Dekktrykk: 2.40')
+      // Only a checkbox turns "true" into a word.
+      expect(text, name).toContain('Kilde: true')
+    }
+  })
+
+  it('still says Yes and No for an English workshop', async () => {
+    const printed = await sheets('en')
+    for (const [name, text] of Object.entries(printed)) {
+      expect(text, name).toContain('Lånebil: Yes')
+      expect(text, name).toContain('Hjul lagret: No')
+    }
+  })
+
+  it('has a word for yes and no in every language a document prints in', async () => {
+    const locales = ['de', 'es', 'fr', 'it', 'lt', 'nb', 'nl', 'pl', 'pt-BR', 'pt-PT', 'ru', 'tr']
+    for (const locale of locales) {
+      const labels = await loadPrintLabels(locale, {}, 'invoice')
+      expect(labels.customFieldYes, locale).toBeTruthy()
+      expect(labels.customFieldNo, locale).toBeTruthy()
+      expect(labels.customFieldYes, locale).not.toBe(labels.customFieldNo)
+    }
+  })
+})
+
+describe('a date custom field', () => {
+  it('is the calendar day that was picked, whatever zone the server and the workshop are in', () => {
+    for (const serverZone of SERVER_ZONES) {
+      process.env.TZ = serverZone
+      for (const timezone of [WORKSHOP_ZONE, 'Pacific/Auckland', undefined]) {
+        const ctx = { dateFormat: 'dd.MM.yyyy', timezone }
+        expect(customFieldText('2026-03-10', 'date', ctx)).toBe('10.03.2026')
+        expect(customFieldText('2026-01-01', 'date', ctx)).toBe('01.01.2026')
+        expect(customFieldText('2026-12-31', 'date', ctx)).toBe('31.12.2026')
+      }
+    }
+  })
+
+  it("follows the workshop's date format", () => {
+    expect(customFieldText('2026-03-10', 'date', { dateFormat: 'MM/dd/yyyy' })).toBe('03/10/2026')
+    expect(customFieldText('2026-03-10', 'date', { dateFormat: 'yyyy-MM-dd' })).toBe('2026-03-10')
+  })
+
+  it("puts a value that names an instant on the workshop's clock", () => {
+    process.env.TZ = 'UTC'
+    const ctx = { dateFormat: 'dd.MM.yyyy', timezone: WORKSHOP_ZONE }
+    // Early on the 11th in UTC is still the 10th in Los Angeles.
+    expect(customFieldText('2026-03-11T03:00:00Z', 'date', ctx)).toBe('10.03.2026')
+  })
+
+  it('prints what was stored when it is not a date', () => {
+    expect(customFieldText('next spring', 'date', { dateFormat: 'dd.MM.yyyy' })).toBe('next spring')
+    expect(customFieldText('2026-02-31', 'date', { dateFormat: 'dd.MM.yyyy' })).toBe('2026-02-31')
+    expect(customFieldText('', 'date', { dateFormat: 'dd.MM.yyyy' })).toBe('')
+  })
+})
+
+describe('an invoice that was already issued', () => {
+  const record = (over: Record<string, unknown> = {}) => ({
+    id: 'rec-1',
+    organizationId: 'org-1',
+    vehicleId: 'veh-1',
+    inspectionId: null,
+    designId: null,
+    title: 'Service',
+    type: 'repair',
+    serviceDate: new Date('2026-09-24T09:00:00Z'),
+    invoiceNumber: '2026-0042',
+    subtotal: 100,
+    taxRate: 0,
+    taxAmount: 0,
+    totalAmount: 100,
+    cost: 100,
+    discountValue: 0,
+    manuallyPaid: false,
+    conditionMapOnInvoice: null,
+    techName: null,
+    issuedAt: null,
+    issuedData: null,
+    editUnlockedAt: null,
+    partItems: [],
+    laborItems: [{ description: 'Arbeid', hours: 1, rate: 100, total: 100 }],
+    attachments: [],
+    payments: [],
+    technician: null,
+    customer: { name: 'Zz Test', invoiceDesignId: null },
+    vehicle: {
+      customerId: 'cust-1',
+      make: 'Volvo',
+      model: 'V60',
+      year: 2020,
+      vin: null,
+      licensePlate: 'AB 12345',
+      hsn: null,
+      tsn: null,
+      mileage: 1000,
+      customer: null,
+    },
+    issuedDesignSnapshot: null,
+    issuedLogoSnapshot: null,
+    issuedSignatureSnapshot: null,
+    createdBy: { id: 'user-1', name: 'Kari' },
+    ...over,
+  })
+
+  /** What the column held for an invoice issued before this wording changed. */
+  const OLD_SNAPSHOT = {
+    version: 1,
+    workshop: { name: 'Verksted', address: '', phone: '', email: '' },
+    invoiceSettings: { dateFormat: 'dd.MM.yyyy', timezone: 'Europe/Oslo' },
+    serviceType: 'automotive',
+    customer: { name: 'Zz Test' },
+    vehicle: { make: 'Volvo', model: 'V60', year: 2020 },
+    technicianName: null,
+    findings: [],
+    customFields: [
+      { fieldId: 'cf1', label: 'Lånebil', value: 'true', fieldType: 'checkbox' },
+      { fieldId: 'cf3', label: 'Neste EU-kontroll', value: '2026-03-10', fieldType: 'date' },
+      { fieldId: 'cf4', label: 'Nøkkelnummer', value: '0042', fieldType: 'text' },
+    ],
+    conditionMap: null,
+  }
+
+  beforeEach(() => {
+    vi.clearAllMocks()
+    process.env.TZ = 'UTC'
+    db.organization.findUnique.mockResolvedValue({ name: 'Verksted', portalSlug: null })
+    db.vehicleFinding.findMany.mockResolvedValue([])
+    db.documentDesign.findFirst.mockResolvedValue(null)
+    db.appSetting.findMany.mockResolvedValue([
+      { key: 'workshop.dateFormat', value: 'dd.MM.yyyy' },
+      { key: 'workshop.timezone', value: 'Europe/Oslo' },
+      { key: 'invoice.layoutConfig', value: JSON.stringify(design('invoice')) },
+    ])
+    db.inspection.findFirst.mockResolvedValue(null)
+    liveCustomFields.mockResolvedValue([])
+  })
+
+  const print = async (assembly: any) =>
+    said(
+      buildInvoicePrintSpec({
+        data: assembly.data,
+        template: assembly.template,
+        invoiceSettings: assembly.invoiceSettings,
+        labels: await loadPrintLabels('nb', {}, 'invoice'),
+      })
+    )
+
+  it('issued before the change reprints with the words it was sent with', async () => {
+    db.serviceRecord.findUnique.mockResolvedValue(
+      record({
+        issuedAt: new Date('2026-05-01T10:00:00Z'),
+        issuedData: OLD_SNAPSHOT,
+        issuedDesignSnapshot: { layout: design('invoice'), template: {} },
+      })
+    )
+    const text = await print(await assembleInvoicePrint('rec-1'))
+    expect(text).toContain('Lånebil: Yes')
+    expect(text).toContain('Neste EU-kontroll: March 10, 2026')
+    expect(text).toContain('Nøkkelnummer: 0042')
+    // The old wording is exactly what the previous formatter produced.
+    expect(legacyCustomFieldText('true', 'checkbox')).toBe('Yes')
+    expect(legacyCustomFieldText('2026-03-10', 'date')).toBe('March 10, 2026')
+  })
+
+  it("issued today freezes the raw value and reprints in the workshop's language", async () => {
+    liveCustomFields.mockResolvedValue(fields())
+    db.serviceRecord.findUnique.mockResolvedValue(record())
+    const live = await assembleInvoicePrint('rec-1', { mode: 'live', inspectionResults: 'rows' })
+    const issuedData = JSON.parse(JSON.stringify(buildIssuedInvoiceData(live!)))
+    expect(issuedData.customFields[0]).toEqual({
+      fieldId: 'cf1',
+      label: 'Lånebil',
+      value: 'true',
+      fieldType: 'checkbox',
+      format: 'workshop',
+    })
+
+    // The live fields are gone; only the snapshot can answer.
+    liveCustomFields.mockResolvedValue([])
+    db.serviceRecord.findUnique.mockResolvedValue(
+      record({
+        issuedAt: new Date('2026-11-19T10:00:00Z'),
+        issuedData,
+        issuedDesignSnapshot: { layout: design('invoice'), template: {} },
+      })
+    )
+    const text = await print(await assembleInvoicePrint('rec-1'))
+    expect(text).toContain('Lånebil: Ja')
+    expect(text).toContain('Hjul lagret: Nei')
+    expect(text).toContain('Neste EU-kontroll: 10.03.2026')
+  })
+})

+ 3 - 3
src/features/custom-fields/Components/CustomFieldsForm.tsx

@@ -77,12 +77,12 @@ export function CustomFieldsForm({
       if (field.required && field.fieldType !== 'checkbox') {
       if (field.required && field.fieldType !== 'checkbox') {
         const val = values[field.id] ?? field.value ?? ''
         const val = values[field.id] ?? field.value ?? ''
         if (!val.trim()) {
         if (!val.trim()) {
-          newErrors[field.id] = `${field.label} is required`
+          newErrors[field.id] = tSettings('requiredError', { label: field.label })
         }
         }
       }
       }
     }
     }
     return newErrors
     return newErrors
-  }, [fields, values])
+  }, [fields, values, tSettings])
 
 
   useEffect(() => {
   useEffect(() => {
     if (onValuesReady) {
     if (onValuesReady) {
@@ -127,7 +127,7 @@ export function CustomFieldsForm({
   if (fields.length === 0) return null
   if (fields.length === 0) return null
 
 
   return (
   return (
-    <AppCard title="Custom Fields" contentClassName="space-y-4">
+    <AppCard title={tSettings('formTitle')} contentClassName="space-y-4">
       {fields.map((field) => {
       {fields.map((field) => {
         const val = values[field.id] ?? field.value ?? ''
         const val = values[field.id] ?? field.value ?? ''
         const hasError = !!errors[field.id]
         const hasError = !!errors[field.id]

+ 107 - 0
src/features/custom-fields/Lib/customFieldText.ts

@@ -0,0 +1,107 @@
+import { DEFAULT_DATE_FORMAT, formatDateForPdf } from '@/lib/format'
+
+/**
+ * How a custom field's stored value reads on a document a customer receives:
+ * the invoice, the quote, the work order, and the share and portal pages that
+ * draw the same sheets.
+ *
+ * What is stored never changes here. A checkbox holds 'true' or 'false' and
+ * prints as the workshop's word for yes or no; a date holds a calendar day
+ * (YYYY-MM-DD) and prints in the workshop's date format. Every other type
+ * prints exactly what was typed.
+ */
+
+export interface CustomFieldTextContext {
+  /** The document's labels, already in the workshop's language. */
+  labels?: Record<string, string>
+  /** The date format the rest of the document prints its dates in. */
+  dateFormat?: string
+  /** The workshop's zone, for the rare value that carries a time. */
+  timezone?: string
+}
+
+const DATE_ONLY = /^(\d{4})-(\d{2})-(\d{2})$/
+
+function isChecked(value: string): boolean {
+  return value === 'true' || value === '1'
+}
+
+/**
+ * A date field's value in the workshop's date format.
+ *
+ * The form stores a calendar day with no time, so it is printed as that day
+ * and never moved through a zone: 2026-03-10 read as UTC midnight is still
+ * the 9th in a workshop west of Greenwich. Only a value that names an instant
+ * (an ISO timestamp, from an import) is put on the workshop's clock.
+ */
+function dateText(value: string, ctx: CustomFieldTextContext): string {
+  const format = ctx.dateFormat || DEFAULT_DATE_FORMAT
+  const day = DATE_ONLY.exec(value.trim())
+  if (day) {
+    const [year, month, date] = [Number(day[1]), Number(day[2]), Number(day[3])]
+    const local = new Date(year, month - 1, date)
+    // 2026-02-31 rolls over to March; print what was stored instead.
+    if (local.getMonth() !== month - 1 || local.getDate() !== date) return value
+    return formatDateForPdf(local, format)
+  }
+
+  const parsed = new Date(value)
+  if (Number.isNaN(parsed.getTime())) return value
+  // "2026-03-10T23:30:00Z" is an instant; "March 10, 2026" is a wall-clock day
+  // the runtime already read in its own zone.
+  const isInstant = /T\d{2}:\d{2}/.test(value)
+  return formatDateForPdf(parsed, format, isInstant ? ctx.timezone : undefined)
+}
+
+export function customFieldText(
+  value: string,
+  fieldType: string,
+  ctx: CustomFieldTextContext = {}
+): string {
+  if (fieldType === 'checkbox') {
+    return isChecked(value)
+      ? ctx.labels?.customFieldYes || 'Yes'
+      : ctx.labels?.customFieldNo || 'No'
+  }
+  if (fieldType === 'date' && value) return dateText(value, ctx)
+  return value
+}
+
+/**
+ * The wording every document used before custom fields followed the workshop:
+ * English "Yes"/"No" and a US long date. Kept only for invoices issued back
+ * then, whose snapshot holds the raw value, so a reprint reads as the sheet
+ * the customer was given.
+ */
+export function legacyCustomFieldText(value: string, fieldType: string): string {
+  if (fieldType === 'checkbox') return isChecked(value) ? 'Yes' : 'No'
+
+  if (fieldType === 'date' && value) {
+    const date = new Date(value)
+    if (!Number.isNaN(date.getTime())) {
+      return date.toLocaleDateString('en-US', {
+        year: 'numeric',
+        month: 'long',
+        day: 'numeric',
+      })
+    }
+  }
+
+  return value
+}
+
+/** A custom field as a document builder receives it. */
+export interface PrintableCustomField {
+  fieldId: string
+  label: string
+  value: string
+  fieldType: string
+  /** Text settled before the builder ran (an old issued invoice); printed as is. */
+  display?: string
+}
+
+/** The "Label: value" line a document prints for one custom field. */
+export function customFieldLine(field: PrintableCustomField, ctx: CustomFieldTextContext): string {
+  const text = field.display ?? customFieldText(field.value, field.fieldType, ctx)
+  return `${field.label}: ${text}`
+}

+ 6 - 3
src/features/invoice-designer/Pdf/buildInvoicePrint.ts

@@ -15,7 +15,7 @@ import {
   toCustomFieldId,
   toCustomFieldId,
   type InvoiceLayoutConfig,
   type InvoiceLayoutConfig,
 } from '@/features/settings/Schema/invoiceLayoutSchema'
 } from '@/features/settings/Schema/invoiceLayoutSchema'
-import { formatFieldValue } from '@/features/vehicles/Components/invoice-pdf/CustomFields'
+import { customFieldLine } from '@/features/custom-fields/Lib/customFieldText'
 import { BASE_FONT_SIZE } from '@/features/vehicles/Components/invoice-pdf/styles'
 import { BASE_FONT_SIZE } from '@/features/vehicles/Components/invoice-pdf/styles'
 import type {
 import type {
   InvoiceData,
   InvoiceData,
@@ -269,8 +269,11 @@ export function buildInvoicePrintSpec(input: InvoicePrintInput): DocumentSpec {
   }
   }
   for (const cfEntry of data.customFields ?? []) {
   for (const cfEntry of data.customFields ?? []) {
     if (cfEntry.value === '' || cfEntry.value == null) continue
     if (cfEntry.value === '' || cfEntry.value == null) continue
-    fields[toCustomFieldId(cfEntry.fieldId)] =
-      `${cfEntry.label}: ${formatFieldValue(cfEntry.value, cfEntry.fieldType)}`
+    fields[toCustomFieldId(cfEntry.fieldId)] = customFieldLine(cfEntry, {
+      labels,
+      dateFormat: df,
+      timezone: tz,
+    })
   }
   }
 
 
   // -------------------------------------------------------------------------
   // -------------------------------------------------------------------------

+ 6 - 3
src/features/invoice-designer/Pdf/buildQuotePrint.ts

@@ -15,7 +15,7 @@ import {
   toCustomFieldId,
   toCustomFieldId,
   type InvoiceLayoutConfig,
   type InvoiceLayoutConfig,
 } from '@/features/settings/Schema/invoiceLayoutSchema'
 } from '@/features/settings/Schema/invoiceLayoutSchema'
-import { formatFieldValue } from '@/features/vehicles/Components/invoice-pdf/CustomFields'
+import { customFieldLine } from '@/features/custom-fields/Lib/customFieldText'
 import { BASE_FONT_SIZE } from '@/features/vehicles/Components/invoice-pdf/styles'
 import { BASE_FONT_SIZE } from '@/features/vehicles/Components/invoice-pdf/styles'
 import type { TemplateConfig } from '@/features/vehicles/Components/invoice-pdf/types'
 import type { TemplateConfig } from '@/features/vehicles/Components/invoice-pdf/types'
 import {
 import {
@@ -254,8 +254,11 @@ export function buildQuotePrintSpec(input: QuotePrintInput): DocumentSpec {
   }
   }
   for (const cfEntry of input.customFields ?? []) {
   for (const cfEntry of input.customFields ?? []) {
     if (cfEntry.value === '' || cfEntry.value == null) continue
     if (cfEntry.value === '' || cfEntry.value == null) continue
-    fields[toCustomFieldId(cfEntry.fieldId)] =
-      `${cfEntry.label}: ${formatFieldValue(cfEntry.value, cfEntry.fieldType)}`
+    fields[toCustomFieldId(cfEntry.fieldId)] = customFieldLine(cfEntry, {
+      labels,
+      dateFormat: df,
+      timezone: tz,
+    })
   }
   }
 
 
   const items: DocumentData['items'] = [
   const items: DocumentData['items'] = [

+ 6 - 3
src/features/invoice-designer/Pdf/buildWorkOrderPrint.ts

@@ -20,7 +20,7 @@ import {
   toCustomFieldId,
   toCustomFieldId,
   type InvoiceLayoutConfig,
   type InvoiceLayoutConfig,
 } from '@/features/settings/Schema/invoiceLayoutSchema'
 } from '@/features/settings/Schema/invoiceLayoutSchema'
-import { formatFieldValue } from '@/features/vehicles/Components/invoice-pdf/CustomFields'
+import { customFieldLine } from '@/features/custom-fields/Lib/customFieldText'
 import { BASE_FONT_SIZE } from '@/features/vehicles/Components/invoice-pdf/styles'
 import { BASE_FONT_SIZE } from '@/features/vehicles/Components/invoice-pdf/styles'
 import type {
 import type {
   InvoiceData,
   InvoiceData,
@@ -295,8 +295,11 @@ export function buildWorkOrderPrintSpec(input: WorkOrderPrintInput): DocumentSpe
   }
   }
   for (const cfEntry of data.customFields ?? []) {
   for (const cfEntry of data.customFields ?? []) {
     if (cfEntry.value === '' || cfEntry.value == null) continue
     if (cfEntry.value === '' || cfEntry.value == null) continue
-    fields[toCustomFieldId(cfEntry.fieldId)] =
-      `${cfEntry.label}: ${formatFieldValue(cfEntry.value, cfEntry.fieldType)}`
+    fields[toCustomFieldId(cfEntry.fieldId)] = customFieldLine(cfEntry, {
+      labels,
+      dateFormat: df,
+      timezone: tz,
+    })
   }
   }
 
 
   const items: DocumentData['items'] = [
   const items: DocumentData['items'] = [

+ 8 - 1
src/features/invoices/Lib/assembleInvoicePrint.ts

@@ -27,6 +27,7 @@ import { SETTING_KEYS } from '@/features/settings/Schema/settingsSchema'
 import { resolveUploadPath } from '@/lib/resolve-upload-path'
 import { resolveUploadPath } from '@/lib/resolve-upload-path'
 import { isOwnUploadUrl } from '@/lib/upload-url'
 import { isOwnUploadUrl } from '@/lib/upload-url'
 import { formatDateForPdf } from '@/lib/format'
 import { formatDateForPdf } from '@/lib/format'
+import { legacyCustomFieldText } from '@/features/custom-fields/Lib/customFieldText'
 import { getCustomFieldsForPrint } from '@/features/custom-fields/Lib/getCustomFieldsForPrint'
 import { getCustomFieldsForPrint } from '@/features/custom-fields/Lib/getCustomFieldsForPrint'
 import {
 import {
   type InvoiceLayoutConfig,
   type InvoiceLayoutConfig,
@@ -555,7 +556,13 @@ async function assembleFrozen(
           customer: null,
           customer: null,
         }
         }
       : null,
       : null,
-    customFields: frozen.customFields ?? [],
+    // The snapshot holds the raw value. One issued before custom fields
+    // followed the workshop's language keeps the wording it was sent with.
+    customFields: (frozen.customFields ?? []).map((cf) =>
+      cf.format === 'workshop'
+        ? cf
+        : { ...cf, display: legacyCustomFieldText(cf.value, cf.fieldType) }
+    ),
     findings: (frozen.findings ?? []).map((f) => ({ ...f, notes: f.notes ?? null })),
     findings: (frozen.findings ?? []).map((f) => ({ ...f, notes: f.notes ?? null })),
   }
   }
 
 

+ 1 - 0
src/features/invoices/Lib/issueInvoice.ts

@@ -61,6 +61,7 @@ export function buildIssuedInvoiceData(a: InvoicePrintAssembly): IssuedInvoiceDa
       label: cf.label,
       label: cf.label,
       value: cf.value,
       value: cf.value,
       fieldType: cf.fieldType,
       fieldType: cf.fieldType,
+      format: 'workshop',
     })),
     })),
     conditionMap: freezeConditionMap(a.conditionMap),
     conditionMap: freezeConditionMap(a.conditionMap),
     inspectionResults: freezeInspectionResults(a.inspectionResults),
     inspectionResults: freezeInspectionResults(a.inspectionResults),

+ 6 - 0
src/features/invoices/Lib/issuedInvoice.ts

@@ -110,6 +110,12 @@ export const issuedInvoiceDataSchema = z
             label: z.string(),
             label: z.string(),
             value: z.string(),
             value: z.string(),
             fieldType: z.string(),
             fieldType: z.string(),
+            /**
+             * 'workshop' when the value prints in the workshop's language and
+             * date format. Absent on invoices issued while every document
+             * printed "Yes"/"No" and a US long date; those keep that wording.
+             */
+            format: z.string().optional(),
           })
           })
           .passthrough()
           .passthrough()
       )
       )

+ 0 - 23
src/features/vehicles/Components/invoice-pdf/CustomFields.tsx

@@ -1,23 +0,0 @@
-/**
- * How a custom field's stored value reads on paper. The panels themselves are
- * drawn by the document model; this stays because the mappers still need to
- * turn a checkbox into a word and a date into a date.
- */
-export function formatFieldValue(value: string, fieldType: string): string {
-  if (fieldType === 'checkbox') {
-    return value === 'true' || value === '1' ? 'Yes' : 'No'
-  }
-
-  if (fieldType === 'date' && value) {
-    const date = new Date(value)
-    if (!isNaN(date.getTime())) {
-      return date.toLocaleDateString('en-US', {
-        year: 'numeric',
-        month: 'long',
-        day: 'numeric',
-      })
-    }
-  }
-
-  return value
-}

+ 2 - 1
src/features/vehicles/Components/invoice-pdf/types.ts

@@ -1,3 +1,4 @@
+import type { PrintableCustomField } from '@/features/custom-fields/Lib/customFieldText'
 import type { InvoiceLayoutConfig } from '@/features/settings/Schema/invoiceLayoutSchema'
 import type { InvoiceLayoutConfig } from '@/features/settings/Schema/invoiceLayoutSchema'
 
 
 export interface TemplateConfig {
 export interface TemplateConfig {
@@ -87,7 +88,7 @@ export interface InvoiceData {
     /** False when the document's tax is not charged on the line. */
     /** False when the document's tax is not charged on the line. */
     taxable?: boolean | null
     taxable?: boolean | null
   }[]
   }[]
-  customFields?: Array<{ fieldId: string; label: string; value: string; fieldType: string }>
+  customFields?: PrintableCustomField[]
   findings?: Array<{ description: string; severity: string; notes: string | null }>
   findings?: Array<{ description: string; severity: string; notes: string | null }>
   /** 'included', 'not_included' or null; see src/lib/warranty.ts. */
   /** 'included', 'not_included' or null; see src/lib/warranty.ts. */
   warrantyStatus?: string | null
   warrantyStatus?: string | null