<dtml-comment>
title:
connection_id:erp5_sql_connection
max_rows:1000
max_cache:100
cache_time:0
class_name:ZSQLBrain
class_file:zsqlbrain.py
</dtml-comment>
<params>portal_type_list=""
</params>
SELECT DISTINCT organisation.id, organisation.title, organisation.relative_url, organisation.path
FROM catalog AS organisation, catalog as resource, category

WHERE resource.uid = category.uid
AND organisation.uid = category.category_uid
AND category.base_category_uid=<dtml-var "portal_categories.source.uid">

<dtml-if expr="_.len(portal_type_list)>0">
AND ( resource.portal_type = "<dtml-var expr="portal_type_list[0]">"
<dtml-in prefix="loop" expr="_.range(_.len(portal_type_list)-1)">
OR resource.portal_type = "<dtml-var expr="portal_type_list[loop_item+1]">"
</dtml-in>
)
</dtml-if>