Commit 30c238ce authored by Jean-Paul Smets's avatar Jean-Paul Smets

transfered in coramy_list_method


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@150 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 382c682e
<dtml-comment>
title:
connection_id:MySQL
max_rows:1000
max_cache:100
cache_time:0
class_name:ZSQLBrain
class_file:zsqlbrain.py
</dtml-comment>
<params>sort_on
resource_id_list=""
variante_id_list=""
id
default_source_title
default_source_reference</params>
SELECT DISTINCT
item.uid, item.id, item.path, item.Description, item.simulation_state, item.default_destination_title
FROM
catalog AS item
<dtml-if expr="_.len(resource_id_list)>0">
, catalog AS resource
, category AS cat1
</dtml-if>
<dtml-if expr="_.len(variante_id_list)>0">
, catalog as variante
, category AS cat2
</dtml-if>
LEFT JOIN category
ON (category.category_uid=item.uid
AND category.base_category_uid = <dtml-var "portal_categories.aggregate.getUid()">)
LEFT JOIN stock
ON (stock.uid = category.uid
AND stock.node_uid = <dtml-var "portal_categories.site.Stock_MP.Gravelines.getUid()">
AND stock.quantity < 0)
LEFT JOIN category AS other_category
ON (other_category.category_uid=item.uid
AND other_category.base_category_uid = <dtml-var "portal_categories.aggregate.getUid()">
AND other_category.uid <> category.uid)
LEFT JOIN stock AS other_stock
ON (other_stock.uid = other_category.uid
AND NOT (other_stock.node_uid = <dtml-var "portal_categories.site.Stock_MP.Gravelines.getUid()">
AND other_stock.quantity < 0))
WHERE item.portal_type = "Piece Tissu"
AND stock.node_uid IS NULL
AND other_stock.node_uid IS NULL
<dtml-if expr="_.len(resource_id_list)>0">
AND ( resource.id LIKE "<dtml-var expr="resource_id_list[0]">"
<dtml-in prefix="loop" expr="_.range(_.len(resource_id_list)-1)">
OR resource.id LIKE "<dtml-var expr="resource_id_list[loop_item+1]">"
</dtml-in>
)
AND cat1.uid=item.uid
AND cat1.category_uid=resource.uid
AND cat1.base_category_uid=<dtml-var "portal_categories.resource.uid">
</dtml-if>
<dtml-if expr="_.len(variante_id_list)>0">
AND ( variante.id LIKE "<dtml-var expr="variante_id_list[0]">"
<dtml-in prefix="loop" expr="_.range(_.len(variante_id_list)-1)">
OR variante.id LIKE "<dtml-var expr="variante_id_list[loop_item+1]">"
</dtml-in>
)
AND cat2.uid=item.uid
AND cat2.category_uid=variante.uid
AND cat2.base_category_uid=<dtml-var "portal_categories.coloris.uid">
</dtml-if>
<dtml-if id>
AND item.id LIKE <dtml-sqlvar id type="string">
</dtml-if>
<dtml-if default_source_title>
AND item.default_source_title LIKE <dtml-sqlvar default_source_title type="string">
</dtml-if>
<dtml-if default_source_reference>
AND item.default_source_reference LIKE <dtml-sqlvar default_source_reference type="string">
</dtml-if>
<dtml-if sort_on>ORDER BY
<dtml-var sort_on>
</dtml-if>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment