<dtml-comment>
title:
connection_id:erp5_sql_connection
max_rows:1000
max_cache:100
cache_time:0
class_name:
class_file:
</dtml-comment>
<params>query
sort_on</params>
<dtml-if sort_on>
<dtml-if query>
SELECT
  DISTINCT catalog.* , movement.*
FROM
  catalog, movement, category, roles_and_users
WHERE
    catalog.uid=category.uid
AND catalog.uid = movement.uid
AND catalog.uid=roles_and_users.uid
AND <dtml-var query>
ORDER BY <dtml-var sort_on>
<dtml-else>
SELECT
  DISTINCT catalog.* , movement.*
FROM
  catalog, movement
WHERE
  catalog.uid = movement.uid
ORDER BY <dtml-var sort_on>
</dtml-if>
<dtml-else>
<dtml-if query>
SELECT
  DISTINCT catalog.* , movement.*
FROM
  catalog, movement, category, roles_and_users
WHERE
    catalog.uid=category.uid
AND catalog.uid = movement.uid
AND catalog.uid=roles_and_users.uid
AND <dtml-var query>
<dtml-else>
SELECT
  DISTINCT catalog.* , movement.*
FROM
  catalog, movement
WHERE
  catalog.uid = movement.uid
</dtml-if>
</dtml-if>