diff --git a/custom/Espo/Custom/Resources/i18n/de_DE/CAIKnowledge.json b/custom/Espo/Custom/Resources/i18n/de_DE/CAIKnowledge.json index aad8d87d..dae22366 100644 --- a/custom/Espo/Custom/Resources/i18n/de_DE/CAIKnowledge.json +++ b/custom/Espo/Custom/Resources/i18n/de_DE/CAIKnowledge.json @@ -23,7 +23,8 @@ "options": { "syncStatus": { "synced": "Synchronisiert", - "unclean": "Nicht synchronisiert" + "unclean": "Nicht synchronisiert", + "pending_sync": "Synchronisierung ausstehend" }, "aktivierungsstatus": { "new": "Neu", @@ -40,7 +41,7 @@ } }, "tooltips": { - "syncStatus": "Globaler Synchronisationsstatus: synced = Alle Dokumente synchronisiert, unclean = Mindestens ein Dokument ist neu oder hat Änderungen. Wird automatisch basierend auf den Dokumenten-Status aktualisiert.", + "syncStatus": "Globaler Synchronisationsstatus: synced = Alle Dokumente synchronisiert, unclean = Mindestens ein Dokument ist neu oder hat Änderungen, pending_sync = Synchronisierung wurde gestartet aber noch nicht abgeschlossen. Wird automatisch basierend auf den Dokumenten-Status aktualisiert.", "lastSync": "Zeitpunkt der letzten erfolgreichen Synchronisation aller Dokumente", "aktivierungsstatus": "Aktivierungsstatus des AI Knowledge Entries: new = Neu angelegt, active = Aktiv synchronisiert, paused = Synchronisation pausiert, deactivated = Synchronisation deaktiviert", "datenbankId": "Eindeutige ID in der AI-Datenbank" diff --git a/custom/Espo/Custom/Resources/i18n/de_DE/CAdvowareAkten.json b/custom/Espo/Custom/Resources/i18n/de_DE/CAdvowareAkten.json index 27616823..19f86a81 100644 --- a/custom/Espo/Custom/Resources/i18n/de_DE/CAdvowareAkten.json +++ b/custom/Espo/Custom/Resources/i18n/de_DE/CAdvowareAkten.json @@ -27,7 +27,8 @@ "options": { "syncStatus": { "synced": "Synchronisiert", - "unclean": "Nicht synchronisiert" + "unclean": "Nicht synchronisiert", + "pending_sync": "Synchronisierung ausstehend" }, "aktivierungsstatus": { "new": "Neu", @@ -37,7 +38,7 @@ } }, "tooltips": { - "syncStatus": "Globaler Synchronisationsstatus: synced = Alle Dokumente synchronisiert, unclean = Mindestens ein Dokument ist neu oder hat Änderungen. Wird automatisch basierend auf den Dokumenten-Status aktualisiert.", + "syncStatus": "Globaler Synchronisationsstatus: synced = Alle Dokumente synchronisiert, unclean = Mindestens ein Dokument ist neu oder hat Änderungen, pending_sync = Synchronisierung wurde gestartet aber noch nicht abgeschlossen. Wird automatisch basierend auf den Dokumenten-Status aktualisiert.", "lastSync": "Zeitpunkt der letzten erfolgreichen Synchronisation aller Dokumente", "aktivierungsstatus": "Aktivierungsstatus der Akte: new = Neu angelegt, active = Aktiv synchronisiert, paused = Synchronisation pausiert, deactivated = Synchronisation deaktiviert", "aktenpfad": "Windows-Dateipfad zur Akte in Advoware" diff --git a/custom/Espo/Custom/Resources/i18n/en_US/CAIKnowledge.json b/custom/Espo/Custom/Resources/i18n/en_US/CAIKnowledge.json index 84e71b1c..a6d65a34 100644 --- a/custom/Espo/Custom/Resources/i18n/en_US/CAIKnowledge.json +++ b/custom/Espo/Custom/Resources/i18n/en_US/CAIKnowledge.json @@ -23,7 +23,8 @@ "options": { "syncStatus": { "synced": "Synchronized", - "unclean": "Not Synchronized" + "unclean": "Not Synchronized", + "pending_sync": "Synchronization Pending" }, "aktivierungsstatus": { "new": "New", @@ -40,7 +41,7 @@ } }, "tooltips": { - "syncStatus": "Global synchronization status: synced = All documents synchronized, unclean = At least one document is new or has changes. Updated automatically based on document status.", + "syncStatus": "Global synchronization status: synced = All documents synchronized, unclean = At least one document is new or has changes, pending_sync = Synchronization started but not yet completed. Updated automatically based on document status.", "lastSync": "Timestamp of the last successful synchronization of all documents", "aktivierungsstatus": "Activation status of the AI Knowledge entry: new = Newly created, active = Actively synchronized, paused = Synchronization paused, deactivated = Synchronization deactivated", "datenbankId": "Unique ID in the AI database" diff --git a/custom/Espo/Custom/Resources/i18n/en_US/CAdvowareAkten.json b/custom/Espo/Custom/Resources/i18n/en_US/CAdvowareAkten.json index 26ce0d29..328415a6 100644 --- a/custom/Espo/Custom/Resources/i18n/en_US/CAdvowareAkten.json +++ b/custom/Espo/Custom/Resources/i18n/en_US/CAdvowareAkten.json @@ -28,7 +28,8 @@ "options": { "syncStatus": { "synced": "Synchronized", - "unclean": "Not Synchronized" + "unclean": "Not Synchronized", + "pending_sync": "Synchronization Pending" }, "aktivierungsstatus": { "new": "New", @@ -38,7 +39,7 @@ } }, "tooltips": { - "syncStatus": "Global synchronization status: synced = All documents synchronized, unclean = At least one document is new or has changes. Updated automatically based on document status.", + "syncStatus": "Global synchronization status: synced = All documents synchronized, unclean = At least one document is new or has changes, pending_sync = Synchronization started but not yet completed. Updated automatically based on document status.", "lastSync": "Timestamp of the last successful synchronization of all documents", "aktivierungsstatus": "Activation status of the file: new = Newly created, active = Actively synchronized, paused = Synchronization paused, deactivated = Synchronization deactivated", "aktenpfad": "Windows file path to the file in Advoware" diff --git a/custom/Espo/Custom/Resources/metadata/entityDefs/CAIKnowledge.json b/custom/Espo/Custom/Resources/metadata/entityDefs/CAIKnowledge.json index 2788e70e..9e995f81 100644 --- a/custom/Espo/Custom/Resources/metadata/entityDefs/CAIKnowledge.json +++ b/custom/Espo/Custom/Resources/metadata/entityDefs/CAIKnowledge.json @@ -52,11 +52,13 @@ "required": false, "options": [ "synced", - "unclean" + "unclean", + "pending_sync" ], "style": { "synced": "success", - "unclean": "warning" + "unclean": "warning", + "pending_sync": "info" }, "default": "unclean", "tooltip": true, diff --git a/custom/Espo/Custom/Resources/metadata/entityDefs/CAdvowareAkten.json b/custom/Espo/Custom/Resources/metadata/entityDefs/CAdvowareAkten.json index ea0d3de1..f8369c29 100644 --- a/custom/Espo/Custom/Resources/metadata/entityDefs/CAdvowareAkten.json +++ b/custom/Espo/Custom/Resources/metadata/entityDefs/CAdvowareAkten.json @@ -67,11 +67,13 @@ "required": false, "options": [ "synced", - "unclean" + "unclean", + "pending_sync" ], "style": { "synced": "success", - "unclean": "warning" + "unclean": "warning", + "pending_sync": "info" }, "default": "unclean", "tooltip": true, diff --git a/custom/docs/API_ENDPOINTS.md b/custom/docs/API_ENDPOINTS.md index 271ce538..3883c85b 100644 --- a/custom/docs/API_ENDPOINTS.md +++ b/custom/docs/API_ENDPOINTS.md @@ -1,10 +1,11 @@ # REST API Endpunkte - EspoCRM Custom Entities -**Version:** 1.2 +**Version:** 1.3 **Datum:** 11. März 2026 **Base URL:** `https://your-crm.com/api/v1` **Changelog:** +- v1.3 (11. März 2026): pending_sync Status zu globalem syncStatus hinzugefügt - v1.2 (11. März 2026): syncedHash-Feld zu Junction-Tables hinzugefügt - v1.1 (11. März 2026): Aktivierungsstatus-Feld hinzugefügt (new, active, paused, deactivated) - v1.0 (11. März 2026): Initiale Version @@ -236,6 +237,11 @@ GET /api/v1/CAdvowareAkten?where[0][type]=equals&where[0][attribute]=aktivierung GET /api/v1/CAdvowareAkten?where[0][type]=equals&where[0][attribute]=syncStatus&where[0][value]=unclean ``` +**Verfügbare Werte:** +- `synced` - Alle Dokumente synchronisiert (grüne Badge) +- `unclean` - Mindestens ein Dokument neu oder geändert (gelbe Badge) +- `pending_sync` - Synchronisierung läuft (blaue Badge) + #### Nach Aktenzeichen suchen ```http GET /api/v1/CAdvowareAkten?where[0][type]=contains&where[0][attribute]=aktenzeichen&where[0][value]=2026 @@ -374,6 +380,11 @@ GET /api/v1/CAIKnowledge?where[0][type]=equals&where[0][attribute]=datenbankId&w GET /api/v1/CAIKnowledge?where[0][type]=equals&where[0][attribute]=syncStatus&where[0][value]=unclean ``` +**Verfügbare syncStatus Werte:** +- `synced` - Alle Dokumente synchronisiert (grüne Badge) +- `unclean` - Mindestens ein Dokument neu oder geändert (gelbe Badge) +- `pending_sync` - Synchronisierung läuft (blaue Badge) + --- ## Junction Tables @@ -789,6 +800,42 @@ curl -X PUT "https://crm.example.com/api/v1/CAdvowareAkten/akte-123" \ }' ``` +### Beispiel 9: Synchronisations-Workflow mit pending_sync + +```bash +# Schritt 1: Hole alle Akten mit Status "unclean" die synchronisiert werden müssen +AKTEN=$(curl -s -X GET "https://crm.example.com/api/v1/CAdvowareAkten?where[0][type]=equals&where[0][attribute]=syncStatus&where[0][value]=unclean&where[1][type]=equals&where[1][attribute]=aktivierungsstatus&where[1][value]=active" \ + -H "X-Api-Key: your-api-key") + +# Schritt 2: Setze Status auf "pending_sync" vor Synchronisation +curl -X PUT "https://crm.example.com/api/v1/CAdvowareAkten/akte-123" \ + -H "X-Api-Key: your-api-key" \ + -H "Content-Type: application/json" \ + -d '{ + "syncStatus": "pending_sync" + }' + +# Schritt 3: Führe Synchronisation durch... +# (Hole Junction-Einträge, synchronisiere mit Advoware, etc.) + +# Schritt 4: Nach erfolgreicher Synchronisation +curl -X PUT "https://crm.example.com/api/v1/CAdvowareAkten/akte-123" \ + -H "X-Api-Key: your-api-key" \ + -H "Content-Type: application/json" \ + -d '{ + "syncStatus": "synced", + "lastSync": "2026-03-11T20:00:00+00:00" + }' + +# Schritt 5: Bei Fehler während Synchronisation +curl -X PUT "https://crm.example.com/api/v1/CAdvowareAkten/akte-123" \ + -H "X-Api-Key: your-api-key" \ + -H "Content-Type: application/json" \ + -d '{ + "syncStatus": "unclean" + }' +``` + --- ## 🎯 Wichtige Hinweise @@ -846,6 +893,50 @@ Das Feld wird automatisch in der Link-Multiple-Spalte "Dokumente" angezeigt: - `paused` - Synchronisation temporär pausiert, kann wieder aktiviert werden - `deactivated` - Synchronisation dauerhaft deaktiviert +### Globaler syncStatus + +**Zweck:** Übersicht über den Synchronisationszustand aller Dokumente einer Akte/eines AI Knowledge Entries + +**Verfügbare Status:** +- `synced` (grün) - Alle Dokumente vollständig synchronisiert +- `unclean` (gelb) - Mindestens ein Dokument ist neu, geändert oder gelöscht +- `pending_sync` (blau) - Synchronisierung wurde gestartet aber noch nicht abgeschlossen + +**Status-Übergänge:** +``` +unclean → pending_sync (beim Start der Synchronisation) +pending_sync → synced (nach erfolgreicher Synchronisation aller Dokumente) +pending_sync → unclean (bei Fehler oder wenn ein Dokument während Sync geändert wurde) +synced → unclean (wenn ein Dokument geändert/hinzugefügt/gelöscht wird) +``` + +**Verwendung:** +```bash +# 1. Vor Synchronisation: Status auf pending_sync setzen +PUT /api/v1/CAdvowareAkten/{id} { "syncStatus": "pending_sync" } + +# 2. Nach erfolgreicher Synchronisation: Status auf synced setzen +PUT /api/v1/CAdvowareAkten/{id} { + "syncStatus": "synced", + "lastSync": "2026-03-11T20:00:00+00:00" +} + +# 3. Bei Fehler: Zurück auf unclean +PUT /api/v1/CAdvowareAkten/{id} { "syncStatus": "unclean" } +``` + +**Filterung:** +```bash +# Alle Akten die auf Synchronisation warten +GET /api/v1/CAdvowareAkten?where[0][type]=equals&where[0][attribute]=syncStatus&where[0][value]=unclean + +# Alle Akten bei denen gerade eine Synchronisation läuft +GET /api/v1/CAdvowareAkten?where[0][type]=equals&where[0][attribute]=syncStatus&where[0][value]=pending_sync + +# Alle erfolgreich synchronisierten Akten +GET /api/v1/CAdvowareAkten?where[0][type]=equals&where[0][attribute]=syncStatus&where[0][value]=synced +``` + **Anwendungsfälle:** ```bash # Neue Akte anlegen (automatisch status="new") @@ -924,6 +1015,6 @@ WHERE name = 'Your Role Name'; --- **Letzte Aktualisierung:** 11. März 2026 -**Version:** 1.2 +**Version:** 1.3 Für weitere Fragen: Siehe `custom/docs/ESPOCRM_BEST_PRACTICES.md` diff --git a/data/config.php b/data/config.php index 964bcf06..3ec8ad72 100644 --- a/data/config.php +++ b/data/config.php @@ -360,7 +360,7 @@ return [ 0 => 'youtube.com', 1 => 'google.com' ], - 'microtime' => 1773262342.780449, + 'microtime' => 1773262547.930204, 'siteUrl' => 'https://crm.bitbylaw.com', 'fullTextSearchMinLength' => 4, 'webSocketUrl' => 'ws://api.bitbylaw.com:5000/espocrm/ws', diff --git a/data/state.php b/data/state.php index a2a65502..55f522e2 100644 --- a/data/state.php +++ b/data/state.php @@ -1,7 +1,7 @@ 1773262342, - 'microtimeState' => 1773262342.914738, + 'cacheTimestamp' => 1773262548, + 'microtimeState' => 1773262548.062426, 'currencyRates' => [ 'EUR' => 1.0 ],