<dtml-comment>
title:
connection_id:erp5_sql_connection
max_rows:0
max_cache:0
cache_time:0
class_name:ZSQLBrain
class_file:zsqlbrain.py
</dtml-comment>
<params>order_list</params>
SELECT commande.id, commande.default_destination_title, commande.path, SUM(movement.quantity) AS quantity
FROM catalog AS ligne_cde, catalog AS commande, movement
WHERE commande.portal_type="Samples Order"
AND ligne_cde.parent_uid=commande.uid
AND ligne_cde.portal_type="Sample Order Line"
AND movement.uid=ligne_cde.uid
AND (commande.id = "<dtml-var expr="order_list[0]">"
<dtml-in prefix="loop" expr="_.range(_.len(order_list)-1)">
OR commande.id = "<dtml-var expr="order_list[loop_item+1]">"
</dtml-in>
)
GROUP BY commande.id
ORDER BY commande.id
