dolibarr.deliveryinvoiceadd.../README.md
data 67b9384a98 v1.2: Fix name-Substitution, neuer fullname-Platzhalter, Code-Refactoring
- Fix: {*_contact_name} liefert jetzt Nachname statt Vorname
- Neu: {*_contact_fullname} (Vorname + Nachname, MAIN_FIRSTNAME_NAME_POSITION)
- Refactoring: eine JOIN-Query statt N+1, Mapping-Array, Elementtyp-Check
- Dokumentation aktualisiert

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 18:20:32 +01:00

99 lines
3.3 KiB
Markdown
Executable file

# Delivery Invoice Address Module
Dolibarr-Modul zur Anzeige von Rechnungs-, Liefer- und Serviceadressen in ODT-Vorlagen.
## Installation
1. Modul-Ordner nach `htdocs/custom/deliveryinvoiceaddress/` kopieren
2. In Dolibarr: Home → Setup → Modules → DeliveryInvoiceAddress aktivieren
## Verfügbare ODT-Tags
### Rechnungsadresse (Billing Address)
Kontakt mit Rolle "BILLING" (Rechnungsadresse)
- `{billing_contact_firstname}` - Vorname
- `{billing_contact_name}` - Nachname
- `{billing_contact_fullname}` - Vorname + Nachname (berücksichtigt `MAIN_FIRSTNAME_NAME_POSITION`)
- `{billing_contact_address}` - Straße und Hausnummer
- `{billing_contact_zip}` - Postleitzahl
- `{billing_contact_town}` - Ort
- `{billing_contact_country}` - Land
### Lieferadresse (Delivery/Shipping Address)
Kontakt mit Rolle "SHIPPING" (Lieferadresse)
- `{delivery_contact_firstname}` - Vorname
- `{delivery_contact_name}` - Nachname
- `{delivery_contact_fullname}` - Vorname + Nachname
- `{delivery_contact_address}` - Straße und Hausnummer
- `{delivery_contact_zip}` - Postleitzahl
- `{delivery_contact_town}` - Ort
- `{delivery_contact_country}` - Land
### Serviceadresse (Service Address)
Kontakt mit Rolle "SERVICE" (Serviceadresse)
- `{service_contact_firstname}` - Vorname
- `{service_contact_name}` - Nachname
- `{service_contact_fullname}` - Vorname + Nachname
- `{service_contact_address}` - Straße und Hausnummer
- `{service_contact_zip}` - Postleitzahl
- `{service_contact_town}` - Ort
- `{service_contact_country}` - Land
## Verwendung in ODT-Vorlagen
### Beispiel 1: Voller Name
```
Rechnungsadresse:
{billing_contact_fullname}
{billing_contact_address}
{billing_contact_zip} {billing_contact_town}
```
### Beispiel 2: Vorname und Nachname getrennt
```
Rechnungsadresse:
{billing_contact_firstname} {billing_contact_name}
{billing_contact_address}
{billing_contact_zip} {billing_contact_town}
```
### Beispiel 3: Zwei Adressen nebeneinander
```
Rechnungsadresse: Lieferadresse:
{billing_contact_fullname} {delivery_contact_fullname}
{billing_contact_address} {delivery_contact_address}
{billing_contact_zip} {billing_contact_town} {delivery_contact_zip} {delivery_contact_town}
```
## Wichtige Hinweise
- **Kontaktrollen**: Die Kontakte müssen die richtigen Rollen haben (BILLING, SHIPPING, SERVICE)
- **Nur Rechnungen**: Das Modul funktioniert nur bei Rechnungen (`Facture`), nicht bei Angeboten oder Aufträgen
- **Leere Felder**: Wenn kein Kontakt mit der entsprechenden Rolle zugeordnet ist, bleiben die Tags leer
- **Mehrere Kontakte**: Pro Rolle wird nur der erste zugeordnete Kontakt verwendet
- **Namensreihenfolge**: `{xxx_contact_fullname}` berücksichtigt die Dolibarr-Einstellung `MAIN_FIRSTNAME_NAME_POSITION`
## Technische Details
### Datenbankstruktur
Das Modul liest Kontakte per JOIN aus folgenden Tabellen:
- `llx_element_contact` - Verknüpfung Rechnung ↔ Kontakt
- `llx_c_type_contact` - Kontakttyp-Definitionen (element = 'facture')
- `llx_socpeople` - Kontaktdaten (firstname, lastname, address, etc.)
- `llx_c_country` - Länderbezeichnung
### Code-Referenz
Hauptfunktion: `deliveryinvoiceaddress_completesubstitutionarray()`
Datei: `core/substitutions/functions_deliveryinvoiceaddress.lib.php`
## Lizenz
GPL v3 oder höher
## Version
Version: 1.2
Dolibarr-Kompatibilität: 19.0+