From efed45a63dcd35528ed479c28c15ba1f6c38f0ac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Thu, 17 Jul 2008 17:15:38 +0000
Subject: [PATCH] similar to: URL: http://svn.erp5.org?rev=22514&view=rev Log:
 only add visible and not invalidated organisations in
 Delivery_get*SectionItemList

... this is a duplicated script

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22529 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 ...ntingTransaction_getDestinationSectionItemList.xml | 11 ++++++++---
 ...AccountingTransaction_getSourceSectionItemList.xml | 10 +++++++---
 bt5/erp5_accounting/bt/revision                       |  2 +-
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getDestinationSectionItemList.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getDestinationSectionItemList.xml
index fe8ac51afe..5654841b7a 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getDestinationSectionItemList.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getDestinationSectionItemList.xml
@@ -75,14 +75,18 @@ if section is not None:\n
   section_value = context.portal_categories.resolveCategory(section)\n
 \n
 if section_value is not None:\n
-  result = section_value.getGroupRelatedValueList(portal_type=\'Organisation\')\n
+  result = section_value.getGroupRelatedValueList(portal_type=\'Organisation\',\n
+                                                  checked_permission=\'View\')\n
+  result = [r for r in result\n
+            if r.getProperty(\'validation_state\') not in (\'invalidated\', \'deleted\')]\n
+\n
 \n
 current_destination_section = context.getDestinationSectionValue()\n
 \n
 if current_destination_section is not None and current_destination_section not in result:\n
   result.append(current_destination_section)\n
 \n
-return [(\'\', \'\')]+[(i.getTitle(), i.getRelativeUrl()) for i in result]\n
+return [(\'\', \'\')] + [(i.getTitle(), i.getRelativeUrl()) for i in result]\n
 </string> </value>
         </item>
         <item>
@@ -131,10 +135,11 @@ return [(\'\', \'\')]+[(i.getTitle(), i.getRelativeUrl()) for i in result]\n
                             <string>None</string>
                             <string>section_value</string>
                             <string>result</string>
-                            <string>current_destination_section</string>
                             <string>append</string>
                             <string>$append0</string>
                             <string>_getiter_</string>
+                            <string>r</string>
+                            <string>current_destination_section</string>
                             <string>i</string>
                           </tuple>
                         </value>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getSourceSectionItemList.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getSourceSectionItemList.xml
index bd5b05939a..670f800cd9 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getSourceSectionItemList.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getSourceSectionItemList.xml
@@ -77,14 +77,17 @@ if section_cat is not None:\n
   section_cat_obj = context.portal_categories.resolveCategory(section_cat)\n
 \n
 if section_cat_obj is not None:\n
-  result = section_cat_obj.getGroupRelatedValueList(portal_type=\'Organisation\')\n
+  result = section_cat_obj.getGroupRelatedValueList(portal_type=\'Organisation\',\n
+                                                    checked_permission=\'View\')\n
+  result = [r for r in result\n
+            if r.getProperty(\'validation_state\') not in (\'invalidated\', \'deleted\')]\n
 \n
 current_source_section = context.getSourceSectionValue()\n
 if current_source_section is not None and current_source_section not in result:\n
   result.append(current_source_section)\n
 \n
 # convert to ListField format\n
-return [(\'\', \'\')]+[(i.getTitle(), i.getRelativeUrl()) for i in result]\n
+return [(\'\', \'\')] + [(i.getTitle(), i.getRelativeUrl()) for i in result]\n
 </string> </value>
         </item>
         <item>
@@ -133,10 +136,11 @@ return [(\'\', \'\')]+[(i.getTitle(), i.getRelativeUrl()) for i in result]\n
                             <string>None</string>
                             <string>section_cat_obj</string>
                             <string>result</string>
-                            <string>current_source_section</string>
                             <string>append</string>
                             <string>$append0</string>
                             <string>_getiter_</string>
+                            <string>r</string>
+                            <string>current_source_section</string>
                             <string>i</string>
                           </tuple>
                         </value>
diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision
index af718cd15f..1d88773811 100644
--- a/bt5/erp5_accounting/bt/revision
+++ b/bt5/erp5_accounting/bt/revision
@@ -1 +1 @@
-726
\ No newline at end of file
+727
\ No newline at end of file
-- 
2.30.9