Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-22663

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 16.9.0
    • Old Core
    • None
    • Unknown

    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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            tmortagne Thomas Mortagne
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: