From ee7fa194a25e0de4e6c3c25ca0557e3646f9281b Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Tue, 10 May 2005 12:59:47 +0000
Subject: [PATCH] first submission

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3011 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../z_catalog_predicate_category_list.zsql    | 32 +++++++++++++++++++
 .../erp5_mysql/z_catalog_predicate_list.zsql  | 23 +++++++++++++
 2 files changed, 55 insertions(+)
 create mode 100755 product/ERP5Catalog/sql/erp5_mysql/z_catalog_predicate_category_list.zsql
 create mode 100755 product/ERP5Catalog/sql/erp5_mysql/z_catalog_predicate_list.zsql

diff --git a/product/ERP5Catalog/sql/erp5_mysql/z_catalog_predicate_category_list.zsql b/product/ERP5Catalog/sql/erp5_mysql/z_catalog_predicate_category_list.zsql
new file mode 100755
index 0000000000..24df693c15
--- /dev/null
+++ b/product/ERP5Catalog/sql/erp5_mysql/z_catalog_predicate_category_list.zsql
@@ -0,0 +1,32 @@
+<dtml-comment>
+title:
+connection_id:erp5_sql_connection
+max_rows:1000
+max_cache:100
+cache_time:0
+class_name:
+class_file:
+</dtml-comment>
+<params>uid
+getMembershipCriterionCategoryList
+isPredicate</params>
+INSERT INTO predicate_category VALUES 
+<dtml-in prefix="loop" expr="_.range(_.len(uid))">
+<dtml-if sequence-start><dtml-else>,</dtml-if>
+<dtml-if isPredicate[loop_item]>
+<dtml-if getMembershipCriterionCategoryList[loop_item]>
+<dtml-let uid_list="portal_categories.getCategoryParentUidList(getMembershipCriterionCategoryList[loop_item])">
+<dtml-if uid_list>
+<dtml-in "uid_list">
+(<dtml-sqlvar uid type="int">, <dtml-var "_['sequence-item'][0]" >, <dtml-var "_['sequence-item'][1]" >, <dtml-var "_['sequence-item'][2]" >)
+<dtml-if sequence-end><dtml-else>,</dtml-if>
+</dtml-in> 
+<dtml-else>
+(<dtml-sqlvar uid[loop_item] type="int">, NULL, NULL,1),
+</dtml-if>
+</dtml-let>
+<dtml-else>
+(<dtml-sqlvar uid[loop_item] type="int">, NULL, NULL,1),
+</dtml-if>
+</dtml-if>
+</dtml-in>
diff --git a/product/ERP5Catalog/sql/erp5_mysql/z_catalog_predicate_list.zsql b/product/ERP5Catalog/sql/erp5_mysql/z_catalog_predicate_list.zsql
new file mode 100755
index 0000000000..296cd5203e
--- /dev/null
+++ b/product/ERP5Catalog/sql/erp5_mysql/z_catalog_predicate_list.zsql
@@ -0,0 +1,23 @@
+<dtml-comment>
+title:
+connection_id:erp5_sql_connection
+max_rows:1000
+max_cache:100
+cache_time:0
+class_name:
+class_file:
+</dtml-comment>
+<params>uid
+isPredicate
+predicate_property_dict</params>
+INSERT INTO predicate VALUES 
+<dtml-in prefix="loop" expr="_.range(_.len(uid))">
+<dtml-if sequence-start><dtml-else>,</dtml-if>
+<dtml-if isPredicate[loop_item]>( 
+  <dtml-sqlvar uid[loop_item] type="int">,
+    <dtml-if expr="predicate_property_dict[loop_item].has_key('quantity')"><dtml-sqlvar expr="predicate_property_dict[loop_item]['quantity']" type="float"><dtml-else>NULL</dtml-if>,
+    <dtml-if expr="predicate_property_dict[loop_item].has_key('quantity_min')"><dtml-sqlvar expr="predicate_property_dict[loop_item]['quantity_min']" type="float"><dtml-else>NULL</dtml-if>,
+    <dtml-if expr="predicate_property_dict[loop_item].has_key('quantity_max')"><dtml-sqlvar expr="predicate_property_dict[loop_item]['quantity_max']" type="float"><dtml-else>NULL</dtml-if>
+  )
+</dtml-if>
+</dtml-in>
-- 
2.30.9