5.7 KiB
Executable file
5.7 KiB
Executable file
SubtotalTitle - Dolibarr Modul
Erweitert Rechnungen, Angebote und Kundenaufträge um Sections, Textzeilen und Zwischensummen.
🔑 ODT Template Schlüsselwörter
Diese Variablen stehen in ODT-Templates zur Verfügung:
| Variable | Wert | Beschreibung |
|---|---|---|
{line_is_section} |
1/0 | Zeile ist eine Section (Überschrift) |
{line_is_textline} |
1/0 | Zeile ist eine Textzeile |
{line_is_subtotal} |
1/0 | Zeile ist eine Zwischensumme |
{line_is_product} |
1/0 | Zeile ist ein Produkt (inkl. Sections/Text/Subtotals) |
{line_is_normal} |
1/0 | Zeile ist ein normales Produkt (KEIN Section/Text/Subtotal) |
{line_is_special} |
1/0 | Zeile ist Section, Text ODER Subtotal |
{line_special_code} |
0-102 | special_code Wert der Zeile |
special_code Werte
| Typ | special_code |
|---|---|
| Normales Produkt | 0 |
| Section (Überschrift) | 100 |
| Textzeile | 101 |
| Zwischensumme | 102 |
ODT Template Beispiel
[!-- BEGIN row.lines --]
[!-- IF {line_is_section} --]
═══════════════════════════════════════
{line_desc}
═══════════════════════════════════════
[!-- ENDIF {line_is_section} --]
[!-- IF {line_is_textline} --]
{line_desc}
[!-- ENDIF {line_is_textline} --]
[!-- IF {line_is_normal} --]
{line_pos} {line_qty} {line_desc} {line_up_locale} € {line_price_ht_locale} €
[!-- ENDIF {line_is_normal} --]
[!-- IF {line_is_subtotal} --]
───────────────────────────────────────
Zwischensumme: {line_price_ht_locale} €
───────────────────────────────────────
[!-- ENDIF {line_is_subtotal} --]
[!-- END row.lines --]
📋 Modul-Funktionen
Sections (Überschriften)
- Erstellen von Überschriften zur Strukturierung
- Produkte können per Drag & Drop oder Link-Button zugeordnet werden
- Optional: Zwischensumme für jede Section anzeigen
- Ein-/Ausklappen von Sections
Textzeilen
- Freie Textzeilen ohne Preis
- Ideal für Hinweise, Bedingungen oder Erklärungen
Zwischensummen
- Automatische Berechnung der Summe aller Produkte in einer Section
- Checkbox zum Ein-/Ausschalten pro Section
Dokument-Synchronisation
- 📄 Checkbox bei jeder Section/Textzeile/Subtotal: Element zum Dokument hinzufügen
- → Zum Dokument / ← Aus Dokument Buttons: Alle Elemente auf einmal synchronisieren
- Grüner Rand = Element ist im Dokument/PDF enthalten
- Buttons werden nur angezeigt wenn Sections oder Textzeilen vorhanden sind
Unterstützte Dokumenttypen
- Rechnungen (Factures)
- Angebote (Propals)
- Kundenaufträge (Commandes)
🔧 Installation
1. Dateien kopieren
htdocs/custom/subtotaltitle/
├── class/
│ ├── actions_subtotaltitle.class.php
│ └── DocumentTypeHelper.class.php
├── ajax/
│ ├── add_to_section.php
│ ├── assign_last_product.php
│ ├── cleanup_subtotals.php
│ ├── create_section.php
│ ├── create_textline.php
│ ├── get_textlines.php
│ ├── move_section.php
│ ├── reorder_all.php
│ ├── sync_to_facturedet.php
│ └── toggle_subtotal.php
├── core/
│ ├── modules/
│ │ └── modSubtotalTitle.class.php
│ └── substitutions/
│ └── functions_subtotaltitle.lib.php
├── js/
│ └── subtotaltitle.js
├── css/
│ └── subtotaltitle.css
├── lib/
│ └── subtotaltitle.lib.php
└── sql/
└── llx_facture_lines_manager.sql
2. Modul aktivieren
Im Dolibarr Backend unter Home → Setup → Modules das Modul SubtotalTitle aktivieren.
Die Datenbanktabelle llx_facture_lines_manager wird automatisch erstellt.
3. Modul-Konfiguration
In core/modules/modSubtotalTitle.class.php muss folgendes gesetzt sein:
$this->module_parts = array(
'substitutions' => 1, // Für ODT-Variablen
'hooks' => array(
'data' => array('invoicecard', 'propalcard', 'ordercard'),
'entity' => '0'
)
);
🗄️ Datenbank
Tabelle: llx_facture_lines_manager
| Feld | Typ | Beschreibung |
|---|---|---|
| rowid | INT | Primary Key |
| fk_facture | INT | FK zu Rechnung |
| fk_propal | INT | FK zu Angebot |
| fk_commande | INT | FK zu Kundenauftrag |
| document_type | VARCHAR(20) | 'invoice', 'propal', 'order' |
| line_type | VARCHAR(20) | 'section', 'product', 'text', 'subtotal' |
| fk_facturedet | INT | FK zu llx_facturedet |
| fk_propaldet | INT | FK zu llx_propaldet |
| fk_commandedet | INT | FK zu llx_commandedet |
| title | VARCHAR(255) | Titel für Sections/Text |
| parent_section | INT | FK zur übergeordneten Section |
| line_order | INT | Sortierreihenfolge |
| show_subtotal | TINYINT | Zwischensumme anzeigen (0/1) |
| collapsed | TINYINT | Section eingeklappt (0/1) |
| in_facturedet | TINYINT | Im Dokument enthalten (0/1) |
📝 Changelog
Version 1.0
- Initiale Version mit Section-, Text- und Subtotal-Unterstützung
- ODT-Substitutionsvariablen
- Multi-Dokument-Support (Rechnungen, Angebote, Kundenaufträge)
- Drag & Drop Sortierung
- Dokument-Synchronisation
📄 Lizenz
Copyright (C) 2026 Eduard Wisch data@data-it-solution.de
Dieses Programm ist freie Software: Sie können es unter den Bedingungen der GNU General Public License, wie von der Free Software Foundation veröffentlicht, weitergeben und/oder modifizieren, entweder Version 3 der Lizenz oder (nach Ihrer Wahl) jede spätere Version.