From e499eb5147d5a226b19ee83ea76448ce331fdebc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Wed, 14 May 2008 12:30:52 +0000
Subject: [PATCH] 2008-05-14 jerome * Use absolute_url when necessary to
 produce URLs compatible with virtual hosting.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20960 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 ...odule_jumpToActiveAccountingPreference.xml |  2 +-
 ...ingTransactionModule_jumpToBankAccount.xml | 33 ++++++++++---------
 ...gTransaction_createReversalTransaction.xml |  2 +-
 ...AccountingTransaction_deleteEmptyLines.xml |  2 +-
 bt5/erp5_accounting/bt/change_log             |  3 ++
 bt5/erp5_accounting/bt/revision               |  2 +-
 6 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_jumpToActiveAccountingPreference.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_jumpToActiveAccountingPreference.xml
index 4b9a738e51..837c1c19be 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_jumpToActiveAccountingPreference.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_jumpToActiveAccountingPreference.xml
@@ -67,7 +67,7 @@
             <key> <string>_body</string> </key>
             <value> <string>request = context.REQUEST\n
 return request.RESPONSE.redirect( "%s/Preference_viewAccounting" %\n
-  context.portal_preferences.getActivePreference().getPath())\n
+  context.portal_preferences.getActivePreference().absolute_url())\n
 \n
 # vim: syntax=python\n
 </string> </value>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_jumpToBankAccount.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_jumpToBankAccount.xml
index 837fc29bf9..25aad36fb0 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_jumpToBankAccount.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_jumpToBankAccount.xml
@@ -66,27 +66,26 @@
         <item>
             <key> <string>_body</string> </key>
             <value> <string># Jump to a bank account of the current organisation\n
-\n
+N_ = context.Base_translateString\n
 request=context.REQUEST\n
-organisation = context.restrictedTraverse(\n
-          context.getPortalObject().portal_preferences.\\\n
-          getPreferredAccountingTransactionSourceSection())\n
+portal = context.getPortalObject()\n
+organisation = portal.restrictedTraverse(\n
+          portal.portal_preferences.getPreferredAccountingTransactionSourceSection())\n
 \n
 if organisation is not None :\n
   selection_uid_list = [ bank_account.getUid() for bank_account \\\n
-     in organisation.searchFolder(portal_type = [\'Bank Account\', \'Cash Register\', \'Credit Card\']) ]\n
+     in organisation.searchFolder(portal_type=portal.getPortalPaymentNodeTypeList()) ]\n
   if len(selection_uid_list) != 0 : \n
     kw = {\'uid\': selection_uid_list}\n
-    context.portal_selections.setSelectionParamsFor(\'Base_jumpToRelatedObjectList\', kw)\n
+    portal.portal_selections.setSelectionParamsFor(\'Base_jumpToRelatedObjectList\', kw)\n
     request.set(\'object_uid\', context.getUid())\n
     request.set(\'uids\', selection_uid_list)\n
     return context.Base_jumpToRelatedObjectList(\n
           uids=selection_uid_list, REQUEST=request)\n
 \n
-redirect_url = \'%s/view?%s\' % (context.getPath(),\n
-            \'portal_status_message=No+Bank+Account+For+Current+Organisation\')\n
-return context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n
-# vim: syntax=python\n
+return context.Base_redirect(form_id,\n
+          keep_items=dict(portal_status_message=\n
+                             N_(\'No Bank Account For Current Organisation\')))\n
 </string> </value>
         </item>
         <item>
@@ -103,7 +102,7 @@ return context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string></string> </value>
+            <value> <string>form_id=\'view\'</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -123,15 +122,18 @@ return context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n
                   <dictionary>
                     <item>
                         <key> <string>co_argcount</string> </key>
-                        <value> <int>0</int> </value>
+                        <value> <int>1</int> </value>
                     </item>
                     <item>
                         <key> <string>co_varnames</string> </key>
                         <value>
                           <tuple>
+                            <string>form_id</string>
                             <string>_getattr_</string>
                             <string>context</string>
+                            <string>N_</string>
                             <string>request</string>
+                            <string>portal</string>
                             <string>organisation</string>
                             <string>None</string>
                             <string>append</string>
@@ -141,8 +143,7 @@ return context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n
                             <string>selection_uid_list</string>
                             <string>len</string>
                             <string>kw</string>
-                            <string>redirect_url</string>
-                            <string>_getitem_</string>
+                            <string>dict</string>
                           </tuple>
                         </value>
                     </item>
@@ -154,7 +155,9 @@ return context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n
         <item>
             <key> <string>func_defaults</string> </key>
             <value>
-              <none/>
+              <tuple>
+                <string>view</string>
+              </tuple>
             </value>
         </item>
         <item>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_createReversalTransaction.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_createReversalTransaction.xml
index d3fe05f410..dda4cdb55e 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_createReversalTransaction.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_createReversalTransaction.xml
@@ -138,7 +138,7 @@ for line in line_list:\n
       new_line.setProperty(prop, line.getProperty(prop))\n
 \n
 return context.REQUEST.RESPONSE.redirect("%s/view?portal_status_message=%s" %\n
-              (reversal.getPath(),\n
+              (reversal.absolute_url(),\n
                N_("Reversal Transaction for ${specific_reference} created.",\n
              mapping={\'specific_reference\': specific_reference})))\n
 </string> </value>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_deleteEmptyLines.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_deleteEmptyLines.xml
index 68dba1ea32..2c0c6245a7 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_deleteEmptyLines.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_deleteEmptyLines.xml
@@ -92,7 +92,7 @@ if len(id_to_delete_list) != len(transaction_lines):\n
 \n
 if redirect:\n
   context.REQUEST.RESPONSE.redirect("%s/view?portal_status_message=%s" % (\n
-      transaction.getPath(), N_(\'Empty+Lines+Deleted.\')))\n
+      transaction.absolute_url(), N_(\'Empty+Lines+Deleted.\')))\n
 </string> </value>
         </item>
         <item>
diff --git a/bt5/erp5_accounting/bt/change_log b/bt5/erp5_accounting/bt/change_log
index 6819f721bb..1a17a49e7c 100644
--- a/bt5/erp5_accounting/bt/change_log
+++ b/bt5/erp5_accounting/bt/change_log
@@ -1,3 +1,6 @@
+2008-05-14 jerome
+* Use absolute_url when necessary to produce URLs compatible with virtual hosting.
+
 2008-04-19 yo
 * Bump to 5.0.
 
diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision
index 8b49166353..02d9616fbc 100644
--- a/bt5/erp5_accounting/bt/revision
+++ b/bt5/erp5_accounting/bt/revision
@@ -1 +1 @@
-695
\ No newline at end of file
+697
\ No newline at end of file
-- 
2.30.9