From 7c4c9c1ae2180bd5340908ac9ccb7fccd8b5bed7 Mon Sep 17 00:00:00 2001
From: Romain Courteaud <romain@nexedi.com>
Date: Tue, 18 Sep 2007 13:58:33 +0000
Subject: [PATCH] Fix incompatibility with proxyfield.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16459 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_item/Item_getResourceTitle.xml       |  9 ++++---
 .../my_resource_title.xml                     | 26 +++++++++++++++----
 bt5/erp5_item/bt/revision                     |  2 +-
 3 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_getResourceTitle.xml b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_getResourceTitle.xml
index 7c69414a88..4422ca502b 100644
--- a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_getResourceTitle.xml
+++ b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_getResourceTitle.xml
@@ -75,9 +75,11 @@
 \n
 # movement list should not be empty, as Item should always be created\n
 # from movement\n
-last_movement = movement_list[0]\n
-resource_uid = last_movement.resource_uid\n
-return context.portal_catalog(uid=resource_uid)[0].title\n
+# But, if it raises an error, ProxyField may be broken\n
+if len(movement_list) == 1:\n
+  last_movement = movement_list[0]\n
+  resource_uid = last_movement.resource_uid\n
+  return context.portal_catalog(uid=resource_uid)[0].title\n
 </string> </value>
         </item>
         <item>
@@ -124,6 +126,7 @@ return context.portal_catalog(uid=resource_uid)[0].title\n
                             <string>context</string>
                             <string>DateTime</string>
                             <string>movement_list</string>
+                            <string>len</string>
                             <string>_getitem_</string>
                             <string>last_movement</string>
                             <string>resource_uid</string>
diff --git a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_viewFieldLibrary/my_resource_title.xml b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_viewFieldLibrary/my_resource_title.xml
index ca1656eaaf..a7b5c75089 100644
--- a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_viewFieldLibrary/my_resource_title.xml
+++ b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_viewFieldLibrary/my_resource_title.xml
@@ -17,9 +17,9 @@
             <value>
               <list>
                 <string>title</string>
-                <string>editable</string>
-                <string>display_width</string>
                 <string>default</string>
+                <string>display_width</string>
+                <string>editable</string>
               </list>
             </value>
         </item>
@@ -67,6 +67,14 @@
                       <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
                     </value>
                 </item>
+                <item>
+                    <key>                 <string>display_width</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key>                 <string>editable</string> </key>
+                    <value> <string></string> </value>
+                </item>
                 <item>
                     <key> <string>field_id</string> </key>
                     <value> <string></string> </value>
@@ -79,6 +87,10 @@
                     <key> <string>target</string> </key>
                     <value> <string></string> </value>
                 </item>
+                <item>
+                    <key>                 <string>title</string> </key>
+                    <value> <string></string> </value>
+                </item>
               </dictionary>
             </value>
         </item>
@@ -87,11 +99,15 @@
             <value>
               <dictionary>
                 <item>
-                    <key>                 <string>display_width</string> </key>
+                    <key>                 <string>default</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>display_width</string> </key>
                     <value> <int>20</int> </value>
                 </item>
                 <item>
-                    <key>                 <string>editable</string> </key>
+                    <key> <string>editable</string> </key>
                     <value> <int>0</int> </value>
                 </item>
                 <item>
@@ -107,7 +123,7 @@
                     <value> <string>Click to edit the target</string> </value>
                 </item>
                 <item>
-                    <key>                 <string>title</string> </key>
+                    <key> <string>title</string> </key>
                     <value> <string>Resource</string> </value>
                 </item>
               </dictionary>
diff --git a/bt5/erp5_item/bt/revision b/bt5/erp5_item/bt/revision
index 8fdd954df9..b393560759 100644
--- a/bt5/erp5_item/bt/revision
+++ b/bt5/erp5_item/bt/revision
@@ -1 +1 @@
-22
\ No newline at end of file
+23
\ No newline at end of file
-- 
2.30.9