From 338059f5f56cd17341d60b758ad741429746c926 Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Mon, 25 Jun 2007 10:21:26 +0000
Subject: [PATCH] Fix listbox selection name. Baobab_checkCounterDateOpen must
 raise in case of an error instead of returning a boolean value.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14948 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../Baobab_checkCounterDateOpen.xml               | 15 +++++++++++----
 .../listbox.xml                                   |  2 +-
 bt5/erp5_banking_core/bt/revision                 |  2 +-
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_checkCounterDateOpen.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_checkCounterDateOpen.xml
index 551615385c..3b47ac9d4b 100644
--- a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_checkCounterDateOpen.xml
+++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_checkCounterDateOpen.xml
@@ -65,7 +65,10 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string># return 1 if the counter date is open/closing for the given date and the given site\n
+            <value> <string># Raise ValidationFailed if the counter date not opened for the given date and the given site\n
+\n
+from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
+from Products.ERP5Type.Message import Message\n
 \n
 if date is None:\n
   # get current date\n
@@ -89,9 +92,8 @@ if site is None:\n
 site = context.Baobab_getVaultSite(site)\n
 \n
 if context.portal_catalog.countResults(portal_type=\'Counter Date\', start_date=str(date), site_id=site.getId(), simulation_state="open")[0][0] == 0:\n
-  return 0\n
-else:\n
-  return 1\n
+  msg = Message(domain = "ui", message="Transaction not in the good counter date")\n
+  raise ValidationFailed, (msg,)\n
 </string> </value>
         </item>
         <item>
@@ -150,6 +152,10 @@ else:\n
                           <tuple>
                             <string>site</string>
                             <string>date</string>
+                            <string>Products.DCWorkflow.DCWorkflow</string>
+                            <string>ValidationFailed</string>
+                            <string>Products.ERP5Type.Message</string>
+                            <string>Message</string>
                             <string>None</string>
                             <string>DateTime</string>
                             <string>_getattr_</string>
@@ -158,6 +164,7 @@ else:\n
                             <string>len</string>
                             <string>_getitem_</string>
                             <string>str</string>
+                            <string>msg</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CounterDateModule_viewCounterDateList/listbox.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CounterDateModule_viewCounterDateList/listbox.xml
index 7ae2f20f69..92a86e9b89 100644
--- a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CounterDateModule_viewCounterDateList/listbox.xml
+++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CounterDateModule_viewCounterDateList/listbox.xml
@@ -481,7 +481,7 @@
                 </item>
                 <item>
                     <key> <string>selection_name</string> </key>
-                    <value> <string>accounting_date_list_selection</string> </value>
+                    <value> <string>counter_date_list_selection</string> </value>
                 </item>
                 <item>
                     <key> <string>sort</string> </key>
diff --git a/bt5/erp5_banking_core/bt/revision b/bt5/erp5_banking_core/bt/revision
index 9e6181a6ed..53c731105c 100644
--- a/bt5/erp5_banking_core/bt/revision
+++ b/bt5/erp5_banking_core/bt/revision
@@ -1 +1 @@
-285
\ No newline at end of file
+286
\ No newline at end of file
-- 
2.30.9