This issue has been created
 
 
XWiki Platform / cid:jira-generated-image-avatar-a9f66be1-ba82-40ae-a81d-cca0920897f1 XWIKI-22663 Open

When modifying and saving $doc in a script macro the second script macro ends up with the unmodified version of $doc

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-658d3d8e-ef05-42a6-a1a2-1ac682770359 Thomas Mortagne created this issue on 16/Nov/24 13:03
 
Summary: When modifying and saving $doc in a script macro the second script macro ends up with the unmodified version of $doc
Issue Type: cid:jira-generated-image-avatar-a9f66be1-ba82-40ae-a81d-cca0920897f1 Bug
Affects Versions: 16.9.0
Assignee: Unassigned
Components: Old Core
Created: 16/Nov/24 13:03
Priority: cid:jira-generated-image-static-major-6a424596-c671-4f72-95e6-cac3cc17a8af Major
Reporter: Thomas Mortagne
Description:

To reproduce:

  • create a document with the following content:
{{velocity}}
#set ($titleDate = $datetool.date)
$doc.setTitle("$titleDate")
$doc.save()
{{/velocity}}

{{velocity}}
Expected title: $titleDate
Title in \$doc: $doc.title
{{/velocity}}

-> the display actually show the version before the modification and the save instead of the current state of the document

Paradoxically, if the document is *not* saved, then the second macros end up with the modified version of $doc.