diff --git a/custom/Espo/Custom/Hooks/CDokumente/UpdateJunctionSyncStatus.php b/custom/Espo/Custom/Hooks/CDokumente/UpdateJunctionSyncStatus.php index 6a5ec281..71bb550c 100644 --- a/custom/Espo/Custom/Hooks/CDokumente/UpdateJunctionSyncStatus.php +++ b/custom/Espo/Custom/Hooks/CDokumente/UpdateJunctionSyncStatus.php @@ -61,20 +61,24 @@ class UpdateJunctionSyncStatus implements AfterSave, AfterRemove } // Fall 3: Relevante Feldänderungen (Datei, Name, Beschreibung, …) - if (!$this->hasRelevantChanges($entity)) { + if ($this->hasRelevantChanges($entity)) { + if (!$entity->get('cAktenId')) { + return; + } + $entity->set('syncStatus', 'unclean'); + $entity->set('aiSyncStatus', 'unclean'); + $entity->set('aiParsingStatus', 'unknown'); + $this->entityManager->saveEntity($entity, ['silent' => true, 'skipHooks' => true]); + $this->triggerAkteUpdate($entity->get('cAktenId')); return; } - if (!$entity->get('cAktenId')) { - return; + // Fall 4: aiParsingStatus geändert (z.B. durch externen Parsing-Service) + // → Akte neu berechnen, aber KEIN unclean setzen (Inhalt ist unverändert) + if ($entity->isAttributeChanged('aiParsingStatus') && $entity->get('cAktenId')) { + $this->triggerAkteUpdate($entity->get('cAktenId')); } - $entity->set('syncStatus', 'unclean'); - $entity->set('aiSyncStatus', 'unclean'); - $entity->set('aiParsingStatus', 'unknown'); - $this->entityManager->saveEntity($entity, ['silent' => true, 'skipHooks' => true]); - $this->triggerAkteUpdate($entity->get('cAktenId')); - } catch (\Exception $e) { $GLOBALS['log']->error('CDokumente UpdateJunctionSyncStatus afterSave Error: ' . $e->getMessage()); } diff --git a/custom/Espo/Custom/Resources/metadata/entityDefs/CAkten.json b/custom/Espo/Custom/Resources/metadata/entityDefs/CAkten.json index 9f9f0f34..7d764ca7 100644 --- a/custom/Espo/Custom/Resources/metadata/entityDefs/CAkten.json +++ b/custom/Espo/Custom/Resources/metadata/entityDefs/CAkten.json @@ -171,13 +171,18 @@ }, "aiProvider": { "type": "enum", - "required": false, + "required": true, "options": [ "ragflow", "xai" ], "default": "ragflow", - "isCustom": true + "isCustom": true, + "style": { + "ragflow": null, + "xai": null + }, + "audited": true }, "globalSyncStatus": { "type": "enum", @@ -233,9 +238,10 @@ "complete_with_failures": "warning" }, "default": "unknown", - "readOnly": true, + "readOnly": false, "tooltip": true, - "isCustom": true + "isCustom": true, + "audited": true }, "graphParsingStatus": { "type": "enum", diff --git a/data/config.php b/data/config.php index 2b39b6ea..a6e57dba 100644 --- a/data/config.php +++ b/data/config.php @@ -359,7 +359,7 @@ return [ 0 => 'youtube.com', 1 => 'google.com' ], - 'microtime' => 1774604561.068253, + 'microtime' => 1774606534.98333, '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 fccaf198..28b89059 100644 --- a/data/state.php +++ b/data/state.php @@ -1,7 +1,7 @@ 1774604771, - 'microtimeState' => 1774604771.465835, + 'cacheTimestamp' => 1774606535, + 'microtimeState' => 1774606535.168197, 'currencyRates' => [ 'EUR' => 1.0 ],