Hello,

There is a problem in the mechanism of filtering of the container list
whenever one employs a clause of the 'range' type.
This problem stands in the generation of the SQL request, more precisely
in the brackets balancing (an exemple of bad generated request is shown
at the end of this mail)

This bug occurs in 4.1 branch in the cvs in the class
'org.jahia.data.containers.ContainerFilterBean' in the method 'public
String getSelect(int ctnListID)' :
the line at line 643 should be moved at line 649 as

      if ( !fClause.isRangeClause() )
      {
         ... skipped code
      } else {

         String val = fClause.getLowerValue();

         clauseBuff.append("(");

clauseBuff.append(getMultilangAndStagingFiltering(this.entryLoadRequest));
clauseBuff.append(" AND ");
clauseBuff.append(FIELD_VALUE);
clauseBuff.append(fClause.getLowerComp());
clauseBuff.append("'");
clauseBuff.append(JahiaTools.quote(val));
clauseBuff.append("' AND ");
clauseBuff.append(FIELD_VALUE);
clauseBuff.append(fClause.getUpperComp());
clauseBuff.append("'");
643: clauseBuff.append(")"); <---- this line should be placed
just before next bracket


                                              below at line 649

         val = fClause.getUpperValue();

         clauseBuff.append(JahiaTools.quote(val));
648:     clauseBuff.append("')");
649:                                    <--- line move here
      }


Regards,

Emmanuel

-------- BAD GENERATED REQUEST ---------

SELECT DISTINCT

   id_jahia_ctn_entries,

   b.id_jahia_fields_data,

   b.workflow_state

FROM

   jahia_ctn_entries a,

   jahia_fields_data b,

   jahia_fields_def c

WHERE

   listid_jahia_ctn_entries=34

   AND (        a.id_jahia_ctn_entries = b.ctnid_jahia_fields_data

       AND     b.fielddefid_jahia_fields_data = c.id_jahia_fields_def

       AND     c.name_jahia_fields_def='date'

       AND     (((

               b.workflow_state>0

           AND b.version_id <> -1

           AND (b.language_code='fr_FR' OR b.language_code='shared')

           AND b.value_jahia_fields_data>='1104534000000'

AND b.value_jahia_fields_data<')1136070000000' <--- HERE !

           )))



ORDER BY b.id_jahia_fields_data,b.workflow_state





Reply via email to