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

ezarchive doesn't take into account the visibility nor the version of the object

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • 4.4.0beta1
    • 4.3.0, 4.4.0alpha1, extension/ezwebin 1.3-2
    • None
    • Operating System: Linux
      PHP Version: 5.2.9
      Database and version: MySQL 5.0.45
      Browser (and version): Any

    Description

      When using ezarchive - operator to display different months for which for example blog entries exist, if the publish_date of the blog_post has been modified, it displays all versions of that blog_post instead of just the newest.

      And also the operator does not care about the visibility status of the node. If it is hidden, the month for that object is still displayed in the listing.

      To fix this you can change the SQL query in ezarchive.php to the following:

      $rs = $db->arrayQuery(
              "SELECT MONTH( FROM_UNIXTIME( ezcontentobject_attribute.data_int ) ) AS month,
              YEAR( FROM_UNIXTIME( ezcontentobject_attribute.data_int ) ) AS year,
              UNIX_TIMESTAMP( CONCAT( YEAR( FROM_UNIXTIME( ezcontentobject_attribute.data_int ) ) , '-', MONTH( FROM_UNIXTIME( ezcontentobject_attribute.data_int ) ) , '-', 01 ) ) AS timestamp
              FROM ezcontentobject_attribute,
                  ezcontentclass,
                  ezcontentclass_attribute,
                  ezcontentobject_tree
              WHERE ezcontentclass_attribute.contentclass_id = ezcontentclass.id
                  AND ezcontentclass.identifier = '" . $classIdentifier ."'
                  AND ezcontentclass_attribute.id = ezcontentobject_attribute.contentclassattribute_id
                  AND ezcontentclass_attribute.identifier = 'publication_date'
                  AND ezcontentobject_attribute.contentobject_id = ezcontentobject_tree.contentobject_id
                  AND ezcontentobject_attribute.version = ezcontentobject_tree.contentobject_version
                  AND ezcontentobject_tree.is_hidden = 0
                  AND ezcontentobject_tree.parent_node_id = " . $parentNodeID . "
              GROUP BY YEAR( FROM_UNIXTIME( ezcontentobject_attribute.data_int ) ) DESC,
                  MONTH( FROM_UNIXTIME( ezcontentobject_attribute.data_int ) ) DESC" );
      

      So in effect adding the following two AND clauses:

      AND ezcontentobject_attribute.version = ezcontentobject_tree.contentobject_version
      AND ezcontentobject_tree.is_hidden = 0
      

      Attachments

        Activity

          People

            patrick.allaert patrick.allaert
            tuomo tuomo
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: