From 49ad14bf455a283e7b2d98de3e08c8454737cf9f Mon Sep 17 00:00:00 2001
From: Alexandre Boeglin <alex@nexedi.com>
Date: Fri, 10 Jun 2005 16:39:12 +0000
Subject: [PATCH] "jump_allowed" now also inhibits the
 Base_jumpToRelatedDocument link. (Base_jumpToRelatedDocument calls a ListBox
 form, thus displays links to Documents, which we want "jump_allowed" to
 prevent. Documents are still selectable by inputting "%" in the field and
 clicking the Form update button.)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3236 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Form/MultiRelationField.py | 7 ++++---
 product/ERP5Form/RelationField.py      | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/product/ERP5Form/MultiRelationField.py b/product/ERP5Form/MultiRelationField.py
index 95ca1bc074..0a49a1dfe6 100755
--- a/product/ERP5Form/MultiRelationField.py
+++ b/product/ERP5Form/MultiRelationField.py
@@ -149,7 +149,7 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget, RelationField.R
                     # Delete default tales on the fly
                     field.tales['items'] = None
 
-                else:
+                elif field.get_value('jump_allowed') == 1 :
                   html_string += '&nbsp;<input type="image" src="%s/images/exec16.png" value="update..." name="%s/portal_selections/viewSearchRelatedDocumentDialog%s_%s:method">' \
                     %  (portal_url_string, portal_object.getPath(), field.aq_parent._v_relation_field_index, i)
 
@@ -159,8 +159,9 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget, RelationField.R
           # no modification made, we can display only a lines text area widget
           html_string += Widget.LinesTextAreaWidget.render(self, field, key, value_list, REQUEST)
 
-          html_string += '&nbsp;<input type="image" src="%s/images/exec16.png" value="update..." name="%s/portal_selections/viewSearchRelatedDocumentDialog%s:method">' \
-            %  (portal_url_string, portal_object.getPath(), field.aq_parent._v_relation_field_index)
+          if field.get_value('jump_allowed') == 1 :
+            html_string += '&nbsp;<input type="image" src="%s/images/exec16.png" value="update..." name="%s/portal_selections/viewSearchRelatedDocumentDialog%s:method">' \
+              %  (portal_url_string, portal_object.getPath(), field.aq_parent._v_relation_field_index)
 
           if value_list not in ((), [], None, ['']) and value_list == field.get_value('default') and field.get_value('jump_allowed') == 1 :
             if REQUEST.get('selection_name') is not None:
diff --git a/product/ERP5Form/RelationField.py b/product/ERP5Form/RelationField.py
index 4ca31376ae..7e68695965 100755
--- a/product/ERP5Form/RelationField.py
+++ b/product/ERP5Form/RelationField.py
@@ -181,7 +181,7 @@ class RelationStringFieldWidget(Widget.TextWidget, Widget.ListWidget):
         # we compare what has been changed in the relation update script
 
         #elif value != field.get_value('default'):
-        else:
+        elif field.get_value('jump_allowed') == 1 :
             html_string += '&nbsp;<input type="image" src="%s/images/exec16.png" value="update..." name="%s/portal_selections/viewSearchRelatedDocumentDialog%s:method">' \
               %  (portal_url_string, portal_object.getPath(),
                   getattr(field.aq_parent, '_v_relation_field_index', 0))
-- 
2.30.9