- 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>
130 lines
3.8 KiB
Markdown
Executable file
130 lines
3.8 KiB
Markdown
Executable file
# DeliveryInvoiceAddress
|
|
|
|
Dolibarr-Modul zur Verwendung von Rechnungs-, Liefer- und Serviceadressen in ODT-Vorlagen.
|
|
|
|
## Funktionen
|
|
|
|
- Separate Rechnungsadresse in Angeboten, Aufträgen und Rechnungen
|
|
- Lieferadresse für Versanddokumente
|
|
- Serviceadresse für Servicedokumente
|
|
- Automatische Erkennung des Dokumenttyps (Angebot/Auftrag/Rechnung)
|
|
- CUSTOMER-Kontakt als Fallback für BILLING bei Angeboten/Aufträgen
|
|
|
|
## Installation
|
|
|
|
1. Modul-Ordner nach `htdocs/custom/deliveryinvoiceaddress/` kopieren
|
|
2. In Dolibarr: Home → Setup → Modules → DeliveryInvoiceAddress aktivieren
|
|
|
|
## Unterstützte Dokumenttypen
|
|
|
|
| Dokumenttyp | Element | Kontakttypen |
|
|
|-------------|---------|--------------|
|
|
| Angebot (Propal) | `propal` | BILLING, CUSTOMER |
|
|
| Auftrag (Commande) | `commande` | BILLING, CUSTOMER, SERVICE, SHIPPING |
|
|
| Rechnung (Facture) | `facture` | BILLING, SERVICE, SHIPPING |
|
|
|
|
## Verfügbare ODT-Tags
|
|
|
|
### Rechnungsadresse (Billing)
|
|
|
|
| Tag | Beschreibung |
|
|
|-----|--------------|
|
|
| `{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)
|
|
|
|
| Tag | Beschreibung |
|
|
|-----|--------------|
|
|
| `{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)
|
|
|
|
| Tag | Beschreibung |
|
|
|-----|--------------|
|
|
| `{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: Rechnungsadresse mit Fallback auf Kundenadresse
|
|
|
|
```
|
|
[!-- IF {billing_contact_fullname} --]
|
|
{billing_contact_fullname}
|
|
{billing_contact_address}
|
|
{billing_contact_zip} {billing_contact_town}
|
|
[!-- ELSE {billing_contact_fullname} --]
|
|
{company_name}
|
|
{company_address}
|
|
{company_zip} {company_town}
|
|
[!-- ENDIF {billing_contact_fullname} --]
|
|
```
|
|
|
|
### Beispiel: 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}
|
|
```
|
|
|
|
## Kontakte zuordnen
|
|
|
|
1. Öffne das Dokument (Angebot/Auftrag/Rechnung)
|
|
2. Gehe zum Tab "Kontakte/Adressen"
|
|
3. Füge einen Kontakt hinzu und wähle die entsprechende Rolle:
|
|
- **Kundenkontakt für Rechnungen** (BILLING) → `billing_contact_*`
|
|
- **Kundenkontakt für Lieferung** (SHIPPING) → `delivery_contact_*`
|
|
- **Kundenkontakt für Service** (SERVICE) → `service_contact_*`
|
|
|
|
## Technische Details
|
|
|
|
### Datenbankstruktur
|
|
|
|
| Tabelle | Beschreibung |
|
|
|---------|--------------|
|
|
| `llx_element_contact` | Verknüpfung Dokument ↔ Kontakt |
|
|
| `llx_c_type_contact` | Kontakttyp-Definitionen |
|
|
| `llx_socpeople` | Kontaktdaten |
|
|
| `llx_c_country` | Länderbezeichnung |
|
|
|
|
### Hauptfunktion
|
|
|
|
```
|
|
deliveryinvoiceaddress_completesubstitutionarray()
|
|
```
|
|
|
|
Datei: `core/substitutions/functions_deliveryinvoiceaddress.lib.php`
|
|
|
|
## Autor
|
|
|
|
Eduard Wisch - DATA IT Solution
|
|
https://data-it-solution.de
|
|
|
|
## Lizenz
|
|
|
|
GPL v3 oder höher
|
|
|
|
## Version
|
|
|
|
- **Version:** 1.2
|
|
- **Dolibarr:** 15.0+
|
|
- **PHP:** 7.1+
|