From 76144f20f196a0e352981cb608fb7e9ed73544c8 Mon Sep 17 00:00:00 2001
From: Alexandre Boeglin <alex@nexedi.com>
Date: Wed, 11 May 2005 15:20:44 +0000
Subject: [PATCH] added deliveryLineType related property. added ZSQL method
 z_related_uid_or_parent_uid used by deliveryLineType   (but, is
 movement.is_accountable test useful in this case ?)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3026 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../ERP5Catalog/sql/erp5_mysql/properties.xml |  1 +
 .../sql/erp5_mysql/z_related_resource.zsql    |  4 ++--
 .../z_related_uid_or_parent_uid.zsql          | 20 +++++++++++++++++++
 3 files changed, 23 insertions(+), 2 deletions(-)
 create mode 100755 product/ERP5Catalog/sql/erp5_mysql/z_related_uid_or_parent_uid.zsql

diff --git a/product/ERP5Catalog/sql/erp5_mysql/properties.xml b/product/ERP5Catalog/sql/erp5_mysql/properties.xml
index 81e339769c..f22444edde 100755
--- a/product/ERP5Catalog/sql/erp5_mysql/properties.xml
+++ b/product/ERP5Catalog/sql/erp5_mysql/properties.xml
@@ -133,6 +133,7 @@
   <property id="sql_catalog_related_keys" type="tuple">
     <item type="str">allowedRolesAndUsers | roles_and_users/allowedRolesAndUsers/z_related_security</item>
     <item type="str">resourceType | movement,catalog/portal_type/z_related_resource</item>
+    <item type="str">deliveryLineType | movement,catalog/portal_type/z_related_uid_or_parent_uid</item>
     <item type="str">stock_resourceCategory | category/category_uid/z_related_resource_uid_from_stock</item>
     <item type="str">stock_nodeCategory | category/category_uid/z_related_node_uid_from_stock</item>
     <item type="str">stock_paymentCategory | category/category_uid/z_related_payment_uid_from_stock</item>
diff --git a/product/ERP5Catalog/sql/erp5_mysql/z_related_resource.zsql b/product/ERP5Catalog/sql/erp5_mysql/z_related_resource.zsql
index 096a82cbb8..134e012a32 100755
--- a/product/ERP5Catalog/sql/erp5_mysql/z_related_resource.zsql
+++ b/product/ERP5Catalog/sql/erp5_mysql/z_related_resource.zsql
@@ -1,6 +1,6 @@
 <dtml-comment>
 title:
-connection_id:cmf_activity_sql_connection
+connection_id:erp5_sql_connection
 max_rows:1000
 max_cache:100
 cache_time:0
@@ -10,4 +10,4 @@ class_file:
 <params>table_0
 table_1</params>
 <dtml-var table_0>.uid = catalog.uid
- AND <dtml-var table_1>.uid = <dtml-var table_0>.resource_uid
\ No newline at end of file
+ AND <dtml-var table_1>.uid = <dtml-var table_0>.resource_uid
diff --git a/product/ERP5Catalog/sql/erp5_mysql/z_related_uid_or_parent_uid.zsql b/product/ERP5Catalog/sql/erp5_mysql/z_related_uid_or_parent_uid.zsql
new file mode 100755
index 0000000000..a6f35fb2c2
--- /dev/null
+++ b/product/ERP5Catalog/sql/erp5_mysql/z_related_uid_or_parent_uid.zsql
@@ -0,0 +1,20 @@
+<dtml-comment>
+title:
+connection_id:erp5_sql_connection
+max_rows:1000
+max_cache:100
+cache_time:0
+class_name:
+class_file:
+</dtml-comment>
+<params>table_0
+table_1</params>
+((<dtml-var table_0>.is_accountable = 0
+AND <dtml-var table_0>.uid = catalog.parent_uid
+AND <dtml-var table_0>.uid = <dtml-var table_1>.uid)
+
+OR
+
+(<dtml-var table_0>.is_accountable = 1
+AND <dtml-var table_0>.uid = catalog.uid
+AND <dtml-var table_0>.uid = <dtml-var table_1>.uid))
-- 
2.30.9