From 077155dc500d935898285e1e62a08493ce539fd1 Mon Sep 17 00:00:00 2001
From: Romain Courteaud <romain@nexedi.com>
Date: Fri, 14 Mar 2008 17:12:18 +0000
Subject: [PATCH] Fix TaskModule_generateProjectDomain in order to display
 correctly related Projects

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19936 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../TaskModule_generateProjectDomain.xml      | 28 +++++++++++++------
 bt5/erp5_project/bt/revision                  |  2 +-
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskModule_generateProjectDomain.xml b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskModule_generateProjectDomain.xml
index 99ab7b4bb9..c6205c6933 100644
--- a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskModule_generateProjectDomain.xml
+++ b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskModule_generateProjectDomain.xml
@@ -70,18 +70,25 @@ domain_list = []\n
 \n
 \n
 if depth == 0:\n
-  category_list = [ ]\n
-  for i in context.portal_selections.getSelectionValueList(context=context,\n
-                                                                   selection_name= \'task_module_selection\'):\n
-    category_list.extend([j for j in i.getSourceProjectValueList(portal_type="Project") if j not in category_list])\n
+  category_list = []\n
+  for task in context.portal_selections.getSelectionValueList(context=context,\n
+                                                           selection_name=\'task_module_selection\'):\n
+    source_project_value_list = \\\n
+      task.getSourceProjectValueList(portal_type=["Project", "Project Line"])\n
+    for source_project_value in source_project_value_list:\n
+      if source_project_value.getPortalType() == \'Project\':\n
+        category = source_project_value\n
+      else:\n
+        category = source_project_value.getExplanationValue()\n
+      if category not in category_list:\n
+        category_list.append(category)\n
   \n
 else:\n
-  category_list = [ ]\n
+  category_list = []\n
   for i in context.portal_selections.getSelectionValueList(context=context,\n
-                                                                   selection_name=\'task_module_selection\'):\n
+                                                           selection_name=\'task_module_selection\'):\n
     category_list.extend([j for j in i.getSourceProjectValueList(portal_type=["Project Line", "Project Milestones"]) \\\n
-                                                            if (j not in category_list) and ( j.getParentRelativeUrl() in parent.getMembershipCriterionCategoryList()) ])\n
-\n
+                                                            if (j not in category_list) and (j.getParentRelativeUrl() in parent.getMembershipCriterionCategoryList())])\n
 \n
 \n
 for category in category_list:\n
@@ -146,11 +153,14 @@ return domain_list\n
                             <string>domain_list</string>
                             <string>category_list</string>
                             <string>_getiter_</string>
+                            <string>task</string>
+                            <string>source_project_value_list</string>
+                            <string>source_project_value</string>
+                            <string>category</string>
                             <string>i</string>
                             <string>append</string>
                             <string>$append0</string>
                             <string>j</string>
-                            <string>category</string>
                             <string>domain</string>
                             <string>script</string>
                           </tuple>
diff --git a/bt5/erp5_project/bt/revision b/bt5/erp5_project/bt/revision
index 1fde7522a7..5a40cf687a 100644
--- a/bt5/erp5_project/bt/revision
+++ b/bt5/erp5_project/bt/revision
@@ -1 +1 @@
-434
\ No newline at end of file
+435
\ No newline at end of file
-- 
2.30.9