From 550798382ab3780b610422adcdff4b3a0f71b57c Mon Sep 17 00:00:00 2001
From: Lucas Carvalho <lucas@nexedi.com>
Date: Thu, 7 Apr 2011 19:58:16 +0000
Subject: [PATCH] 2011-04-07 lucas * The
 ConfiguratorTool_getAvailableBusinessConfigurationList must return a list of
 tuples following the appropriated order, such list is used to render the
 business configuration in the new user interface.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45203 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 ..._getAvailableBusinessConfigurationList.xml | 23 +++++++++++--------
 bt5/erp5_configurator/bt/change_log           |  3 +++
 bt5/erp5_configurator/bt/revision             |  2 +-
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/bt5/erp5_configurator/SkinTemplateItem/portal_skins/erp5_configurator_wizard/ConfiguratorTool_getAvailableBusinessConfigurationList.xml b/bt5/erp5_configurator/SkinTemplateItem/portal_skins/erp5_configurator_wizard/ConfiguratorTool_getAvailableBusinessConfigurationList.xml
index 8f79fb8c95..6a7eb0dfc8 100644
--- a/bt5/erp5_configurator/SkinTemplateItem/portal_skins/erp5_configurator_wizard/ConfiguratorTool_getAvailableBusinessConfigurationList.xml
+++ b/bt5/erp5_configurator/SkinTemplateItem/portal_skins/erp5_configurator_wizard/ConfiguratorTool_getAvailableBusinessConfigurationList.xml
@@ -51,19 +51,22 @@
         <item>
             <key> <string>_body</string> </key>
             <value> <string>"""\n
- We should exclude configurations which already used. A workflow \n
- could help on this situation.\n
+ Returns a list of tuple with max three business configuration for each tuple.\n
+ The business configurations without Resource and with the state of the related workflow\n
+ equals to \'End\' are just ignored.\n
 """\n
-\n
 bc_list = context.business_configuration_module.searchFolder(portal_type="Business Configuration")\n
-result_list = []\n
-for business_configuration in bc_list:\n
-  if None not in [business_configuration.getResource()]:\n
-    title = business_configuration.getTitle()\n
-    relative_url = business_configuration.getRelativeUrl()\n
-    result_list.append((title, relative_url))\n
+bc_list = [bc for bc in bc_list if bc.getResource() is not None and bc.getCurrentStateTitle() not in ("End",)]\n
 \n
-return result_list\n
+bc_tuple_list = []\n
+index = 0\n
+while True:\n
+  part = bc_list[index:index+3]\n
+  if not part:\n
+    return bc_tuple_list\n
+  else:\n
+    bc_tuple_list.append(tuple(part))\n
+    index+=3\n
 </string> </value>
         </item>
         <item>
diff --git a/bt5/erp5_configurator/bt/change_log b/bt5/erp5_configurator/bt/change_log
index 40a65c8a68..a1dc67f4f8 100644
--- a/bt5/erp5_configurator/bt/change_log
+++ b/bt5/erp5_configurator/bt/change_log
@@ -1,3 +1,6 @@
+2011-04-07 lucas
+* The ConfiguratorTool_getAvailableBusinessConfigurationList must return a list of tuples following the appropriated order, such list is used to render the business configuration in the new user interface.
+
 2011-04-07 lucas
 * Removed obsolete Start button.
 
diff --git a/bt5/erp5_configurator/bt/revision b/bt5/erp5_configurator/bt/revision
index 39886ae89b..88bc40f5cc 100644
--- a/bt5/erp5_configurator/bt/revision
+++ b/bt5/erp5_configurator/bt/revision
@@ -1 +1 @@
-512
\ No newline at end of file
+513
\ No newline at end of file
-- 
2.30.9