From 6ca554ae70f0047c1ae049c4d13d1ed2cb87115c Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Mon, 10 Sep 2007 09:29:19 +0000
Subject: [PATCH] Move hidden fields to right group in fast input form. This
 simplifies field sort and reduces a small gap at top. Make
 my_target_total_price a well-formated float field instead of a string field.
 Translate by hand module title in CashDelivery_generateCashDetailInputDialog
 since transalation accessor does not work on module.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16210 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 ...Delivery_generateCashDetailInputDialog.xml | 10 ++-
 .../CashDetail_viewLineFastInputForm.xml      | 19 ++---
 .../my_target_total_price.xml                 | 74 ++++++++++---------
 bt5/erp5_banking_core/bt/revision             |  2 +-
 4 files changed, 60 insertions(+), 45 deletions(-)

diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CashDelivery_generateCashDetailInputDialog.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CashDelivery_generateCashDetailInputDialog.xml
index e2d96307cca..bcef0773704 100644
--- a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CashDelivery_generateCashDetailInputDialog.xml
+++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CashDelivery_generateCashDetailInputDialog.xml
@@ -89,7 +89,15 @@ if listbox is None:\n
   currency_cash_portal_type = cash_detail_dict[\'currency_cash_portal_type\']\n
 \n
   if fast_input_title is None:\n
-    fast_input_title = \'%s - %s\' % (context.getParentValue().getTranslatedTitle(), context.getSourceReference())\n
+    # Module getTranslatedTitle does not return a translated string.\n
+    # Borrow code from ERP5Site_getModuleItemList to achieve hand translation.\n
+    # XXX: Pass title value as a list to work around an encoding bug in TextWidget:\n
+    #  It renders given value as a list of str, and casting to str throws an error when\n
+    #  encountering UTF-8 chars. This cast is not called when provided value is a tuple\n
+    # or a list...\n
+    fast_input_title = [\'%s - %s\' % \\\n
+      (context.getPortalObject().Localizer.erp5_ui.gettext(context.getParentValue().getTitle()),\n
+       context.getSourceReference())]\n
   if \'target_total_price\' not in kw:\n
     target_total_price = context.getSourceTotalAssetPrice()\n
   else:\n
diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CashDetail_viewLineFastInputForm.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CashDetail_viewLineFastInputForm.xml
index 9ce27f5d814..66c913a82e8 100644
--- a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CashDetail_viewLineFastInputForm.xml
+++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CashDetail_viewLineFastInputForm.xml
@@ -128,22 +128,23 @@
                     <key>                 <string>left</string> </key>
                     <value>
                       <list>
-                        <string>my_variation_list</string>
-                        <string>my_operation_currency</string>
-                        <string>my_cash_status_list</string>
-                        <string>my_emission_letter_list</string>
-                        <string>my_line_portal_type</string>
-                        <string>my_other_parameter</string>
-                        <string>my_calculated_price</string>
-                        <string>my_target_total_price</string>
                         <string>my_fast_input_title</string>
+                        <string>my_target_total_price</string>
+                        <string>my_calculated_price</string>
                       </list>
                     </value>
                 </item>
                 <item>
                     <key>                 <string>right</string> </key>
                     <value>
-                      <list/>
+                      <list>
+                        <string>my_variation_list</string>
+                        <string>my_operation_currency</string>
+                        <string>my_cash_status_list</string>
+                        <string>my_emission_letter_list</string>
+                        <string>my_line_portal_type</string>
+                        <string>my_other_parameter</string>
+                      </list>
                     </value>
                 </item>
               </dictionary>
diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CashDetail_viewLineFastInputForm/my_target_total_price.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CashDetail_viewLineFastInputForm/my_target_total_price.xml
index 89348e03904..f0bb664065f 100644
--- a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CashDetail_viewLineFastInputForm/my_target_total_price.xml
+++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/CashDetail_viewLineFastInputForm/my_target_total_price.xml
@@ -3,7 +3,7 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <global name="StringField" module="Products.Formulator.StandardFields"/>
+        <global name="FloatField" module="Products.Formulator.StandardFields"/>
         <tuple/>
       </tuple>
     </pickle>
@@ -28,12 +28,12 @@
                     <value> <string>The input failed the external validator.</string> </value>
                 </item>
                 <item>
-                    <key> <string>required_not_found</string> </key>
-                    <value> <string>Input is required but no input given.</string> </value>
+                    <key> <string>not_float</string> </key>
+                    <value> <string>You did not enter a floating point number.</string> </value>
                 </item>
                 <item>
-                    <key> <string>too_long</string> </key>
-                    <value> <string>Too much input was given.</string> </value>
+                    <key> <string>required_not_found</string> </key>
+                    <value> <string>Input is required but no input given.</string> </value>
                 </item>
               </dictionary>
             </value>
@@ -87,23 +87,19 @@
                     <value> <string></string> </value>
                 </item>
                 <item>
-                    <key> <string>max_length</string> </key>
-                    <value> <string></string> </value>
-                </item>
-                <item>
-                    <key> <string>required</string> </key>
+                    <key> <string>input_style</string> </key>
                     <value> <string></string> </value>
                 </item>
                 <item>
-                    <key> <string>title</string> </key>
+                    <key> <string>precision</string> </key>
                     <value> <string></string> </value>
                 </item>
                 <item>
-                    <key> <string>truncate</string> </key>
+                    <key> <string>required</string> </key>
                     <value> <string></string> </value>
                 </item>
                 <item>
-                    <key> <string>unicode</string> </key>
+                    <key> <string>title</string> </key>
                     <value> <string></string> </value>
                 </item>
                 <item>
@@ -164,23 +160,21 @@
                     <value> <string></string> </value>
                 </item>
                 <item>
-                    <key> <string>max_length</string> </key>
-                    <value> <string></string> </value>
+                    <key> <string>input_style</string> </key>
+                    <value>
+                      <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
+                    </value>
                 </item>
                 <item>
-                    <key> <string>required</string> </key>
+                    <key> <string>precision</string> </key>
                     <value> <string></string> </value>
                 </item>
                 <item>
-                    <key> <string>title</string> </key>
-                    <value> <string></string> </value>
-                </item>
-                <item>
-                    <key> <string>truncate</string> </key>
+                    <key> <string>required</string> </key>
                     <value> <string></string> </value>
                 </item>
                 <item>
-                    <key> <string>unicode</string> </key>
+                    <key> <string>title</string> </key>
                     <value> <string></string> </value>
                 </item>
                 <item>
@@ -200,7 +194,7 @@
                 </item>
                 <item>
                     <key> <string>css_class</string> </key>
-                    <value> <string></string> </value>
+                    <value> <string>figure</string> </value>
                 </item>
                 <item>
                     <key> <string>default</string> </key>
@@ -232,15 +226,19 @@
                 </item>
                 <item>
                     <key> <string>extra</string> </key>
-                    <value> <string></string> </value>
+                    <value> <string>align="right"</string> </value>
                 </item>
                 <item>
                     <key> <string>hidden</string> </key>
                     <value> <int>0</int> </value>
                 </item>
                 <item>
-                    <key> <string>max_length</string> </key>
-                    <value> <string></string> </value>
+                    <key> <string>input_style</string> </key>
+                    <value> <string>-1 234.5</string> </value>
+                </item>
+                <item>
+                    <key> <string>precision</string> </key>
+                    <value> <int>2</int> </value>
                 </item>
                 <item>
                     <key> <string>required</string> </key>
@@ -250,14 +248,6 @@
                     <key> <string>title</string> </key>
                     <value> <string>Target total price</string> </value>
                 </item>
-                <item>
-                    <key> <string>truncate</string> </key>
-                    <value> <int>0</int> </value>
-                </item>
-                <item>
-                    <key> <string>unicode</string> </key>
-                    <value> <int>0</int> </value>
-                </item>
                 <item>
                     <key> <string>whitespace_preserve</string> </key>
                     <value> <int>0</int> </value>
@@ -284,4 +274,20 @@
       </dictionary>
     </pickle>
   </record>
+  <record id="3" aka="AAAAAAAAAAM=">
+    <pickle>
+      <tuple>
+        <global name="TALESMethod" module="Products.Formulator.TALESField"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <string>string:-1 234.5 | preferences/getPreferredMoneyQuantityStyle</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
 </ZopeData>
diff --git a/bt5/erp5_banking_core/bt/revision b/bt5/erp5_banking_core/bt/revision
index db057cf772e..ac471d3ba0c 100644
--- a/bt5/erp5_banking_core/bt/revision
+++ b/bt5/erp5_banking_core/bt/revision
@@ -1 +1 @@
-354
\ No newline at end of file
+355
\ No newline at end of file
-- 
2.30.9