<dtml-comment>
title:
connection_id:erp5_sql_connection
max_rows:2000
max_cache:100
cache_time:0
class_name:ZSQLBrain
class_file:zsqlbrain.py
</dtml-comment>
<params></params>
SELECT DISTINCT modele.id, ligne_cde.uid, ligne_cde.path, ligne_cde.relative_url, ligne_cde.parent_uid, ligne_cde.Description
FROM catalog AS ligne_cde, catalog AS modele, catalog AS commande, category AS cat1
LEFT JOIN category AS cat2
ON (cat2.uid=modele.uid
AND cat2.category_uid = <dtml-var "portal_categories.modele_origine.Reconduction.Cognis.uid">)
LEFT JOIN category AS cat3
ON (cat3.uid=modele.uid
AND cat3.category_uid = <dtml-var "portal_categories.collection['2004'].Coramy.Planches.uid">)
WHERE ligne_cde.portal_type="Sample Order Line"
AND cat2.uid IS NULL
AND cat3.uid IS NULL
AND ligne_cde.uid=cat1.uid
AND commande.portal_type="Samples Order"
AND ligne_cde.parent_uid=commande.uid
AND commande.order_state='active'
AND modele.uid=cat1.category_uid
AND ( modele.modele_state="demande_etude"
OR modele.modele_state="prototypage"
OR modele.modele_state="brouillon"
OR modele.modele_state="etude_modelisme" )