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

Date properties clone does not clone the value

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 13.10.3, 14.1-rc-1
    • 6.0.1
    • Old Core
    • None
    • Unit
    • Unknown
    • N/A
    • N/A

    Description

      The following script can modify the internal of documents without a save. This is not normal as public API should work of cloned data that should be recloned on every page view so no shared data should happen:

      {{velocity}}
      #set($date1 = $doc.getValue("date1"))
      
      Date: $doc.getValue("date1")
      
      #set($newdate = $date1.getDate() + 1)
      Setting new day: $newdate
      #set($ok = $date1.setDate($newdate))
      New Date after reading $\doc (it should show the same date as before): $doc.getValue("date1")
      
      New Date after re-reading the document using getDocument (it should also show the same): $xwiki.getDocument($doc.fullName).getValue("date1")
      
      The previous data has been displayed using the following script:
      {{/velocity}}
      

      I've attached the xar for a demo since this script needs a class and an object

      Attachments

        Activity

          People

            tmortagne Thomas Mortagne
            ludovic Ludovic Dubost
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: