From bfbaf8d88d149364d92a702a813cc6c8e95fdbd0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Tue, 13 Apr 2010 15:01:12 +0000
Subject: [PATCH] Sometime the cancel_url already contains
 selection_name/selection_index, in that case we should not use
 ERP5Site_redirect that would add it again

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34519 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../portal_skins/erp5_xhtml_style/Base_cancel.xml  | 14 +++++++++++---
 .../ERP5/bootstrap/erp5_xhtml_style/bt/revision    |  2 +-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_cancel.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_cancel.xml
index 73ebadabf3..859aa8b5a7 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_cancel.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_cancel.xml
@@ -53,8 +53,16 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>return context.ERP5Site_redirect(cancel_url, **kw)\n
-</string> </value>
+            <value> <string encoding="cdata"><![CDATA[
+
+if \'?selection_name=\' in cancel_url or \'&selection_name=\' in cancel_url:\n
+  # if selection_name is already present in the cancel URL, we do not\n
+  # use erp5_xhtml_style script that would add it again.\n
+  return context.REQUEST.RESPONSE.redirect(cancel_url)\n
+return context.ERP5Site_redirect(cancel_url, **kw)\n
+
+
+]]></string> </value>
         </item>
         <item>
             <key> <string>_code</string> </key>
@@ -92,9 +100,9 @@
                           <tuple>
                             <string>cancel_url</string>
                             <string>kw</string>
-                            <string>_apply_</string>
                             <string>_getattr_</string>
                             <string>context</string>
+                            <string>_apply_</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
index 2b15d82dc7..707001d7af 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
@@ -1 +1 @@
-926
\ No newline at end of file
+927
\ No newline at end of file
-- 
2.30.9