From c9b33291fe63010efe5f2cfb782983878638c737 Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Wed, 28 Sep 2011 17:17:56 +0200
Subject: [PATCH] support domain_tree and report_tree in
 WebSection_getDocumentValueList.

---
 .../WebSection_zGetDocumentValueList.xml        | 17 +++++++++++++++--
 bt5/erp5_web/bt/change_log                      |  3 +++
 bt5/erp5_web/bt/revision                        |  2 +-
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_zGetDocumentValueList.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_zGetDocumentValueList.xml
index 8fc5900400..1c79c808c3 100644
--- a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_zGetDocumentValueList.xml
+++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_zGetDocumentValueList.xml
@@ -66,7 +66,9 @@ kw</string> </value>
 
 <dtml-let query="buildSQLQuery(query=portal_catalog.getSecurityQuery(**kw), **kw)"\n
           is_translation_order_by="query[\'order_by_expression\'] is not None and\n
-            \'translated_message\' in query[\'order_by_expression\']">\n
+            \'translated_message\' in query[\'order_by_expression\']"\n
+          selection_domain="kw.get(\'selection_domain\', None)"\n
+          selection_report="kw.get(\'selection_report\', None)">\n
 \n
   <dtml-comment>\n
     Currently, there is no other choice to implement this method as an SQL catalog until SQLCatalog\n
@@ -107,6 +109,12 @@ kw</string> </value>
         <dtml-in prefix="table" expr="query[\'from_table_list\']">\n
           <dtml-var table_item> AS <dtml-var table_key>,\n
         </dtml-in>\n
+        <dtml-if selection_domain>\n
+          <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_domain)">,\n
+        </dtml-if>\n
+        <dtml-if selection_report>\n
+          <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_report)">,\n
+        </dtml-if>\n
         versioning AS my_versioning\n
         <dtml-if is_translation_order_by>\n
           , translation AS related_translation_intermediate\n
@@ -116,7 +124,12 @@ kw</string> </value>
         <dtml-if "query[\'where_expression\']">\n
           AND <dtml-var "query[\'where_expression\']">\n
         </dtml-if>\n
-\n
+        <dtml-if selection_domain>\n
+          AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_domain)">\n
+        </dtml-if>\n
+        <dtml-if selection_report>\n
+          AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_report)">\n
+        </dtml-if>\n
         <dtml-if all_languages>\n
         <dtml-else>\n
           AND my_versioning.language IN (<dtml-sqlvar language type="string">, \'\')\n
diff --git a/bt5/erp5_web/bt/change_log b/bt5/erp5_web/bt/change_log
index d7627ed851..2631b247ca 100644
--- a/bt5/erp5_web/bt/change_log
+++ b/bt5/erp5_web/bt/change_log
@@ -1,3 +1,6 @@
+2011-09-28 Kazuhiko
+* support domain_tree and report_tree in WebSection_getDocumentValueList.
+
 2011-02-22 Kazuhiko
 * remove portal_type configuration from listbox of WebSection_viewAsWeb,  WebSection_viewContent and WebSection_viewContentList.
 
diff --git a/bt5/erp5_web/bt/revision b/bt5/erp5_web/bt/revision
index 45bcd720f6..67a2f2abea 100644
--- a/bt5/erp5_web/bt/revision
+++ b/bt5/erp5_web/bt/revision
@@ -1 +1 @@
-1061
\ No newline at end of file
+1062
\ No newline at end of file
-- 
2.30.9