Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-22730

/url/view/ shows wrong status for objectversions

    Details

      Description

      when a link type object has multiple versions, if one of the versions is deleted, the url details in link management will show the wrong status, all versions become "drafts".

      test:

      • create one link object with an example url
      • edit the object, publish, repeat one or more times to create some versions
      • go to the "link management" page, find the corresponding url
      • click on the link to open the details: the page opens to show two versions of the object, both have correct status
      • go to the link object again, open "manage versions"
      • remove the first version, in archived state
      • go back to the /url/view page for the link object: all remaining versions show as "drafts"

        Activity

        Hide
        Paulo Bras (Inactive) added a comment -

        a possible solution is this:
        Index: design/admin2/templates/url/view.tpl
        ===================================================================
        — design/admin2/templates/url/view.tpl
        +++ design/admin2/templates/url/view.tpl
        @@ -148,7 +148,7 @@
        </tr>

        {section var=Objects loop=$object_list sequence=array( bglight, bgdark )}

        -

        {let object_version_status=$Objects.item.contentobject.versions[sub($Objects.item.version,1)].status}

        +

        {let object_version_status = $Objects.item.status}
        Show
        Paulo Bras (Inactive) added a comment - a possible solution is this: Index: design/admin2/templates/url/view.tpl =================================================================== — design/admin2/templates/url/view.tpl +++ design/admin2/templates/url/view.tpl @@ -148,7 +148,7 @@ </tr> {section var=Objects loop=$object_list sequence=array( bglight, bgdark )} - {let object_version_status=$Objects.item.contentobject.versions[sub($Objects.item.version,1)].status} + {let object_version_status = $Objects.item.status}
        Hide
        Gunnstein Lye added a comment - - edited

        Not confirmed on current Git, but there is still a bug. I had 3 versions (archived, archived, published), and removed the first. Now the link management shows version 2 as published and 3 as draft, should have been 2: archived, 3: published.
        Edit: Same behaviour & fix on 4.7, except the template folder is admin2, not admin.

        Show
        Gunnstein Lye added a comment - - edited Not confirmed on current Git, but there is still a bug. I had 3 versions (archived, archived, published), and removed the first. Now the link management shows version 2 as published and 3 as draft, should have been 2: archived, 3: published. Edit: Same behaviour & fix on 4.7, except the template folder is admin2, not admin.
        Hide
        Gunnstein Lye added a comment - - edited

        The current code is from
        https://github.com/ezsystems/ezpublish-legacy/commit/9fcace08
        which is from 2006, and contains lots of changes. This particular change does not seem related
        to the main purpose of the commit, which is to add alphabetical navigation. The code assumes
        that object.versions[object.version-1] always exists, which is not the case when versions are
        removed, nor when the current version is 1 (the funny thing is that both cases were
        previously handled, and this commit removes it). The result is that false or null is returned,
        which evaluates to STATUS_DRAFT.

        The fix from Paulo seems OK so far. One wonders why it wasn't like this from the beginning -
        presumably because the API didn't support it.

        Show
        Gunnstein Lye added a comment - - edited The current code is from https://github.com/ezsystems/ezpublish-legacy/commit/9fcace08 which is from 2006, and contains lots of changes. This particular change does not seem related to the main purpose of the commit, which is to add alphabetical navigation. The code assumes that object.versions [object.version-1] always exists, which is not the case when versions are removed, nor when the current version is 1 (the funny thing is that both cases were previously handled, and this commit removes it). The result is that false or null is returned, which evaluates to STATUS_DRAFT. The fix from Paulo seems OK so far. One wonders why it wasn't like this from the beginning - presumably because the API didn't support it.
        Hide
        Gunnstein Lye added a comment - - edited
        Show
        Gunnstein Lye added a comment - - edited Pull request: https://github.com/ezsystems/ezpublish-legacy/pull/949
        Show
        Yannick Roger (Inactive) added a comment - Fixed in master: https://github.com/ezsystems/ezpublish-legacy/commit/bbb1176da29201176b4467262cf42f37da9bb46a
        Hide
        Pedro Resende (Inactive) added a comment -

        Tested and approved by Q.A.

        Show
        Pedro Resende (Inactive) added a comment - Tested and approved by Q.A.

          People

          • Assignee:
            Unassigned
            Reporter:
            Paulo Bras (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 7 hours, 50 minutes
              7h 50m