From 2c306c259c7d2d43899b17395c23cc3438b29648 Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Tue, 25 Jul 2006 08:06:59 +0000
Subject: [PATCH] Fix form_id base_edit redirects to being empty when submiting
 from a dialog. Thanks Bartek for reporting this bug.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8730 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../portal_skins/erp5_core/Base_edit.xml            | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_edit.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_edit.xml
index d29827ed89..92a0591454 100644
--- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_edit.xml
+++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_edit.xml
@@ -76,6 +76,10 @@ request=context.REQUEST\n
 portal = context.getPortalObject()\n
 N_ = portal.Base_translateString\n
 \n
+# Use dialog_id if present, otherwise fall back on form_id.\n
+if dialog_id not in (\'\', None):\n
+  form_id = dialog_id\n
+\n
 # Prevent users who don\'t have rights to edit the object from\n
 # editing it by calling the Base_edit script with correct \n
 # parameters directly.\n
@@ -83,11 +87,8 @@ if not request.AUTHENTICATED_USER.has_permission(\'Modify portal content\', cont
   redirect_url = \'%s/%s?selection_index=%s&selection_name=%s&%s\' % (context.absolute_url(), form_id, selection_index, selection_name, \'portal_status_message=You+don\\\'t+have+the+permissions+to+edit+the+object.\')\n
   return request[\'RESPONSE\'].redirect(redirect_url)\n
 \n
-# Define form\n
-if dialog_id==\'\' or dialog_id is None:\n
-  form = getattr(context,form_id)\n
-else:\n
-  form = getattr(context,dialog_id)\n
+# Get the form\n
+form = getattr(context,form_id)\n
 \n
 try:\n
   # Validate\n
@@ -320,9 +321,9 @@ return request[\'RESPONSE\'].redirect(redirect_url)\n
                             <string>request</string>
                             <string>portal</string>
                             <string>N_</string>
+                            <string>None</string>
                             <string>redirect_url</string>
                             <string>_getitem_</string>
-                            <string>None</string>
                             <string>getattr</string>
                             <string>form</string>
                             <string>validation_errors</string>
-- 
2.30.9