Update documentation for Junction Table UI-Integration and document propagation patterns; include new features and best practices for sync status management

This commit is contained in:
2026-03-11 20:38:45 +01:00
parent e7b14406fb
commit b2c391539d
3 changed files with 622 additions and 5 deletions

View File

@@ -301,6 +301,60 @@ cat custom/docs/ESPOCRM_BEST_PRACTICES.md | grep -A 200 "Troubleshooting"
- i18n fehlt → beide Sprachen anlegen
- Relationship kaputt → bidirektional prüfen
- ACL 403 → Rechte in Admin UI
- Rebuild schlägt fehl mit "Column does not exist" → Index auf gelöschtes Feld prüfen
---
## 🆕 Neueste Patterns & Best Practices (März 2026)
### Junction Table UI-Integration
**Pattern:** `columnAttributeMap` + `notStorable` Felder
**Use Case:** Junction-Spalten (wie `hnr`, `syncstatus`, `lastSync`) im Relationship-Panel anzeigen.
**Implementierung:**
- notStorable Felder als UI-Placeholder
- columnAttributeMap für bidirektionales Mapping
- Custom List Layouts für Relationship-Panels
- Hooks für automatische Updates
**Dokumentiert in:** [ESPOCRM_BEST_PRACTICES.md](ESPOCRM_BEST_PRACTICES.md#junction-spalten-im-ui-anzeigen-columnattributemap--notstorable) & [TESTERGEBNISSE_JUNCTION_TABLE.md](TESTERGEBNISSE_JUNCTION_TABLE.md)
### Dokumenten-Propagierung mit Loop-Schutz
**Pattern:** AfterRelate/AfterUnrelate Hooks mit statischem Processing-Array
**Use Case:** Automatische Verknüpfung von Dokumenten zwischen hierarchisch verbundenen Entities.
**Hierarchie-Beispiel:**
```
Räumungsklage ←→ AdvowareAkten ←→ AIKnowledge
Mietinkasso ←→ AdvowareAkten ←→ AIKnowledge
↓ ↓ ↓
Dokumente (automatisch synchronisiert)
```
**Loop-Schutz:** Statisches Array mit Key `{EntityID}-{DokumentID}-{Aktion}` verhindert Endlos-Rekursion.
**Implementiert in:** `custom/Espo/Custom/Hooks/{CVmhRumungsklage,CMietinkasso,CAdvowareAkten,CAIKnowledge}/Propagate*.php`
**Dokumentiert in:** [ESPOCRM_BEST_PRACTICES.md - Hook-Entwicklung](ESPOCRM_BEST_PRACTICES.md#hook-pattern-dokumenten-propagierung-mit-loop-schutz)
### Sync-Status-Management
**Pattern:** Globaler + Junction-level Status mit automatischer Propagierung
**Struktur:**
- **Global (Parent):** `syncStatus` (synced/unclean), `lastSync`
- **Junction (pro Dokument):** `syncstatus` (new/unclean/synced/failed), `lastSync`
**Hooks:**
- **BeforeSave:** Berechnet globalen Status aus allen Junction-Einträgen
- **AfterRelate:** Setzt Junction-Status auf "new"
- **AfterSave (CDokumente):** Markiert alle Junction-Einträge als "unclean" bei Dokumentänderung
**Real-World:** CAdvowareAkten & CAIKnowledge tracken Sync-Status ihrer verknüpften Dokumente.
---
@@ -314,6 +368,7 @@ cat custom/docs/ESPOCRM_BEST_PRACTICES.md | grep -A 200 "Troubleshooting"
---
**Letzte Aktualisierung:** 9. März 2026
**Letzte Aktualisierung:** 11. März 2026
**Version:** 2.3 (Junction Table UI-Integration, Dokumenten-Propagierung, Sync-Status-Management)
**Für Fragen oder Updates:** Siehe `custom/docs/ESPOCRM_BEST_PRACTICES.md`