From d24842fc178d63459917bae151ec977a16cd293d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julien=20Fastr=C3=A9?=
Date: Wed, 15 Apr 2026 18:10:18 +0200
Subject: [PATCH] Extend document replacement logic to include `storedObject`
and update components
- Updated `replaceDocument` function to handle `storedObject` and ensure proper version assignment.
- Added `@on-stored-object-refresh` event handling in `DocumentsList.vue` for dynamic updates.
- Introduced `refresh-stored-object-auto` prop in various components to control auto-refresh behavior.
---
.../Resources/public/vuejs/DropFileWidget/DropFileWidget.vue | 1 +
.../Resources/public/vuejs/DownloadExport/App.vue | 1 +
.../vuejs/WorkflowAttachment/Component/AttachmentList.vue | 1 +
.../vuejs/WorkflowAttachment/Component/PickGenericDocItem.vue | 1 +
.../AccompanyingCourseWorkEdit/components/DocumentsList.vue | 3 +++
.../Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js | 3 ++-
6 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DropFileWidget/DropFileWidget.vue b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DropFileWidget/DropFileWidget.vue
index bb8b1bafe..f8d432499 100644
--- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DropFileWidget/DropFileWidget.vue
+++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DropFileWidget/DropFileWidget.vue
@@ -13,6 +13,7 @@
:can-download="true"
:dav-link="dav_link_href ?? ''"
:dav-link-expiration="dav_link_expiration ?? 0"
+ :refresh-stored-object-auto="false"
/>
diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/DownloadExport/App.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/DownloadExport/App.vue
index 8cd9397f9..a02e73109 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/DownloadExport/App.vue
+++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/DownloadExport/App.vue
@@ -27,6 +27,7 @@
diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/WorkflowAttachment/Component/AttachmentList.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/WorkflowAttachment/Component/AttachmentList.vue
index f9d29d1b6..090c22594 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/WorkflowAttachment/Component/AttachmentList.vue
+++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/WorkflowAttachment/Component/AttachmentList.vue
@@ -53,6 +53,7 @@ const canRemove = computed((): boolean => {
diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/WorkflowAttachment/Component/PickGenericDocItem.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/WorkflowAttachment/Component/PickGenericDocItem.vue
index 51c7dbc4b..507449868 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/WorkflowAttachment/Component/PickGenericDocItem.vue
+++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/WorkflowAttachment/Component/PickGenericDocItem.vue
@@ -38,6 +38,7 @@ const clickOnAddButton = () => {
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/DocumentsList.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/DocumentsList.vue
index 1a6f428ba..fa55122c8 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/DocumentsList.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/DocumentsList.vue
@@ -106,6 +106,7 @@
@on-stored-object-status-change="
$emit('statusDocumentChanged', $event)
"
+ @on-stored-object-refresh="(newStoredObject) => replaceDocument(d, newStoredObject, newStoredObject.currentVersion)"
>
@@ -318,6 +319,7 @@ async function goToGenerateWorkflowEvaluationDocument({
* @return {void}
*/
async function replaceDocument(oldDocument, storedObject, storedObjectVersion) {
+ console.log('replaceDocument', storedObject, storedObjectVersion);
let document = {
type: "accompanying_period_work_evaluation_document",
storedObject: storedObject,
@@ -328,6 +330,7 @@ async function replaceDocument(oldDocument, storedObject, storedObjectVersion) {
key: props.evaluation.key,
document,
oldDocument: oldDocument,
+ storedObject: storedObject,
stored_object_version: storedObjectVersion,
});
}
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js
index 741c87ddf..2e7cebb1c 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js
@@ -344,7 +344,7 @@ const store = createStore({
* Replaces a document in the state with a new document.
*
* @param {object} state - The current state of the application.
- * @param {{key: number, oldDocument: {key: number}, stored_object_version: StoredObjectVersion}} payload - The object containing the information about the document to be replaced.
+ * @param {{key: number, oldDocument: {key: number}, stored_object_version: StoredObjectVersion, storedObject: StoredObject}} payload - The object containing the information about the document to be replaced.
* @return {void} - returns nothing.
*/
replaceDocument(state, payload) {
@@ -364,6 +364,7 @@ const store = createStore({
return;
}
+ doc.storedObject = payload.storedObject;
doc.storedObject.currentVersion = payload.stored_object_version;
return;
let newDocument = Object.assign(payload.document, {