christian bencivenni
|
Monday 28 January 2008 11:32:54 pm
I found this code in event_view_calendar.tpl:
{def $events=fetch( 'content', 'list', hash(
'parent_node_id', $event_node_id,
'sort_by', array( 'attribute', true(), 'event/from_time'),
'class_filter_type', 'include',
'class_filter_array', array( 'event' ),
'main_node_only', true(),
'attribute_filter',
array( 'or',
array( 'event/from_time', 'between', array( sum($first_ts,1), sub($last_ts,1) )),
array( 'event/to_time', 'between', array( sum($first_ts,1), sub($last_ts,1) )) )
))}
but it seems don't work with my installation of ez 3.10.0 I try with:
{def $eventi=fetch( 'content', 'list', hash(
'parent_node_id', $event_node_id,
'sort_by', array( 'attribute', false(), 'from_time'),
'class_filter_type', 'include',
'class_filter_array', array( 'event' ) ))}
but it still don't work. So I try with:
{def $eventi=fetch( 'content', 'list', hash(
'parent_node_id', $event_node_id,
'class_filter_type', 'include',
'class_filter_array', array( 'event' ) ))}
and it works!
Where is my error? Thank you
|
Stéphane Bullier
|
Tuesday 29 January 2008 1:29:25 am
Hello,
I think you make a mistake in your fetch list with parameter sort_by : You forgot 'event' in line 3.
1 {def $eventi=fetch( 'content', 'list', hash(
2 'parent_node_id', $event_node_id,
3 'sort_by', array( 'attribute', false(), 'from_time'),
4 'class_filter_type', 'include',
5 'class_filter_array', array( 'event' ) ))}
You have to write 'event/from_time'.
Stéphane
|
christian bencivenni
|
Wednesday 30 January 2008 12:19:24 am
Thanks Lukasz. I tried with this simple template:
{*?template charset=utf-8?*}
{* Event Calendar - Full Calendar view *}
{def
$event_node = $node
$event_node_id = $event_node.node_id
}
{def $events=fetch( 'content', 'list', hash(
'parent_node_id', $event_node_id,
'sort_by', array( 'attribute', true(), 'event/from_time'),
'class_filter_type', 'include',
'class_filter_array', array( 'event' ) ))
}
But activating the SQL debug I can read an incredible number of query notice. I tried to decode the most of them and I found two interesting things. The first one is a PHP Warning:
Warning: PHP Jan 30 2008 08:21:42
pg_exec() [<a href='function.pg-exec'>function.pg-exec</a>]: Query failed: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list in /home/xtian/3.10.0/lib/ezdb/classes/ezpostgresqldb.php on line 164
And the second one in an SQL error. Unfortunately it seems to be a little bit complex for me but I think it is the center of the problem because I can read a0.contentclassattribute_id = 297
which is the attribute I use to make the order_by. This is the entire Error code:
Error: eZPostgreSQLDB Jan 30 2008 08:21:42
Error: error executing query:
SELECT DISTINCT
ezcontentobject.*, ezcontentobject_tree.*, ezcontentclass.serialized_name_list as class_serialized_name_list, ezcontentclass.identifier as class_identifier, ezcontentclass.is_container as is_container, ezcontentobject_name.name as name, ezcontentobject_name.real_translation
FROM
ezcontentobject_tree, ezcontentobject,ezcontentclass, ezcontentobject_name, ezcontentobject_attribute a0
WHERE
ezcontentobject_tree.path_string like '/1/2/236/%'
and
ezcontentobject_tree.depth <= 3
and
a0.contentobject_id = ezcontentobject.id
AND
a0.contentclassattribute_id = 297
AND
a0.version = ezcontentobject_name.content_version
AND
( a0.language_id & ezcontentobject.language_mask > 0
AND
( ( ezcontentobject.language_mask - ( ezcontentobject.language_mask & a0.language_id ) ) & 1 )
+ ( ( ( ezcontentobject.language_mask - ( ezcontentobject.language_mask & a0.language_id ) ) & 2 ) )
<
( a0.language_id & 1 )
+ ( ( a0.language_id & 2 ) ) )
AND
ezcontentclass.version=0
AND
ezcontentobject_tree.node_id != 236
AND
ezcontentobject_tree.contentobject_id = ezcontentobject.id
AND
ezcontentclass.id = ezcontentobject.contentclass_id
AND
ezcontentobject.contentclass_id IN ( 38 )
AND
ezcontentobject_tree.contentobject_id = ezcontentobject_name.contentobject_id
and
ezcontentobject_tree.contentobject_version = ezcontentobject_name.content_version
and
( ezcontentobject_name.language_id & ezcontentobject.language_mask > 0
AND
( ( ezcontentobject.language_mask - ( ezcontentobject.language_mask & ezcontentobject_name.language_id ) ) & 1 )
+ ( ( ( ezcontentobject.language_mask - ( ezcontentobject.language_mask & ezcontentobject_name.language_id ) ) & 2 ) )
<
( ezcontentobject_name.language_id & 1 )
+ ( ( ezcontentobject_name.language_id & 2 ) ) )
AND ezcontentobject_tree.is_invisible = 0
AND ((ezcontentobject.section_id in (1))
OR (ezcontentobject.contentclass_id in (29, 30, 31, 32, 33, 40)
AND ezcontentobject.section_id in (3))
OR (( ( ezcontentobject_tree.node_id in (226) ) )))
AND
ezcontentobject.language_mask & 3 > 0
ORDER BY
a0.sort_key_int ASC ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
Someone can tell me if it is a server problem or an ez bug and, if possible, a solution? Thank you in advance.
|