From 677269833fe69f238729497658b5c80bb494fb8d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Thu, 14 Dec 2006 13:48:05 +0000
Subject: [PATCH] fix parent related key, and add a test this time

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11725 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_mysql/z_related_parent.xml             |  4 ++--
 product/ERP5/bootstrap/erp5_core/bt/revision    |  2 +-
 product/ERP5Catalog/tests/testERP5Catalog.py    | 17 ++++++++++++++++-
 3 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_core/CatalogMethodTemplateItem/portal_catalog/erp5_mysql/z_related_parent.xml b/product/ERP5/bootstrap/erp5_core/CatalogMethodTemplateItem/portal_catalog/erp5_mysql/z_related_parent.xml
index 1d7b38a435..a7d01d772d 100644
--- a/product/ERP5/bootstrap/erp5_core/CatalogMethodTemplateItem/portal_catalog/erp5_mysql/z_related_parent.xml
+++ b/product/ERP5/bootstrap/erp5_core/CatalogMethodTemplateItem/portal_catalog/erp5_mysql/z_related_parent.xml
@@ -78,7 +78,7 @@ query_table</string> </value>
             <key> <string>src</string> </key>
             <value> <string encoding="cdata"><![CDATA[
 
-<dtml-var table_0>.parent_uid = <dtml_var query_table>.uid\n
+<dtml-var table_0>.uid = <dtml-var query_table>.parent_uid\n
 
 
 ]]></string> </value>
@@ -117,7 +117,7 @@ query_table</string> </value>
                         <key> <string>raw</string> </key>
                         <value> <string encoding="cdata"><![CDATA[
 
-<dtml-var table_0>.parent_uid = <dtml_var query_table>.uid\n
+<dtml-var table_0>.uid = <dtml-var query_table>.parent_uid\n
 
 
 ]]></string> </value>
diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision
index e99fdcc524..cc4f7f3feb 100644
--- a/product/ERP5/bootstrap/erp5_core/bt/revision
+++ b/product/ERP5/bootstrap/erp5_core/bt/revision
@@ -1 +1 @@
-217
\ No newline at end of file
+218
\ No newline at end of file
diff --git a/product/ERP5Catalog/tests/testERP5Catalog.py b/product/ERP5Catalog/tests/testERP5Catalog.py
index b8ce86a837..fdb203f344 100644
--- a/product/ERP5Catalog/tests/testERP5Catalog.py
+++ b/product/ERP5Catalog/tests/testERP5Catalog.py
@@ -1241,4 +1241,19 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
     path_list = [new_person.getRelativeUrl()]
     self.checkRelativeUrlInSqlPathList(path_list)
 
-
+  def test_44_ParentRelatedKeys(self, quiet=quiet, run=run_all_test):
+    if not run: return
+    if not quiet:
+      message = 'Parent related keys'
+      ZopeTestCase._print('\n%s ' % message)
+      LOG('Testing... ',0,message)
+    portal_catalog = self.getCatalogTool()
+    person_module = self.getPersonModule()
+    person_module.reindexObject()
+    person = person_module.newContent(id='1',portal_type='Person')
+    get_transaction().commit()
+    self.tic()
+    self.assertEquals([person],
+        [x.getObject() for x in self.getCatalogTool()(
+               parent_title=person_module.getTitle())])
+    
-- 
2.30.9