From 6b54b091b705c2fb79adc96050802d3b73fdcbac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Tue, 20 Dec 2005 08:35:23 +0000
Subject: [PATCH] Accepts redirect acrgument to add a portal status message
 (then this script can be used in object_action)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4781 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 ...AccountingTransaction_deleteEmptyLines.xml | 63 +++++++++++--------
 1 file changed, 38 insertions(+), 25 deletions(-)

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 33c24297fe..c05acae8cc 100755
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_deleteEmptyLines.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_deleteEmptyLines.xml
@@ -79,7 +79,7 @@ lines_portal_type = (\'Accounting Transaction Line\', \n
 \n
 transaction = context.getObject()\n
 \n
-for line in transaction.searchFolder(portal_type=lines_portal_type) : \n
+for line in transaction.objectValues(portal_type=lines_portal_type) : \n
   line = line.getObject()\n
   # Do not delete lines involved in simulation\n
   if len( line.getDeliveryRelatedValueList(portal_type = \'Simulation Movement\') + \n
@@ -87,31 +87,40 @@ for line in transaction.searchFolder(portal_type=lines_portal_type) : \n
     balance = line.getSourceDebit() - line.getSourceCredit()\n
     if balance == 0 : \n
       transaction.deleteContent(line.getId())\n
+\n
+if redirect :\n
+  context.REQUEST.RESPONSE.redirect("%s/view?portal_status_message=%s" % (\n
+      transaction.getPath(), context.Base_TranslateString(\'Empty Lines Deleted.\')))\n
 </string> </value>
         </item>
         <item>
             <key> <string>_code</string> </key>
-            <value> <string encoding="base64">YwAAAAAAAAAAAQAAAEAAAABzDQAAAG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sA
+AAB0cmFuc2FjdGlvbnMJAAAAX2dldGl0ZXJfcwQAAABsaW5lcwMAAABsZW5zBwAAAGJhbGFuY2Vz
+CAAAAHJlZGlyZWN0KAAAAAAoAAAAAHMPAAAAU2NyaXB0IChQeXRob24pcyYAAABBY2NvdW50aW5n
+VHJhbnNhY3Rpb25fZGVsZXRlRW1wdHlMaW5lcwEAAABzGgAAAAAEGAcSAh8ABgESAxsAIAEiARAB
+KAIQARsBKAEAAABzJgAAAEFjY291bnRpbmdUcmFuc2FjdGlvbl9kZWxldGVFbXB0eUxpbmVzKAEA
+AABzJgAAAEFjY291bnRpbmdUcmFuc2FjdGlvbl9kZWxldGVFbXB0eUxpbmVzKAAAAAAoAAAAAHMP
+AAAAU2NyaXB0IChQeXRob24pcwgAAAA8bW9kdWxlPgEAAABzAAAAAA==</string> </value>
         </item>
         <item>
             <key> <string>_filepath</string> </key>
@@ -119,7 +128,7 @@ AAAAKAAAAABzDwAAAFNjcmlwdCAoUHl0aG9uKXMIAAAAPG1vZHVsZT4BAAAAcwAAAAA=</string> </
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string></string> </value>
+            <value> <string>reditect = 0</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -139,12 +148,13 @@ AAAAKAAAAABzDwAAAFNjcmlwdCAoUHl0aG9uKXMIAAAAPG1vZHVsZT4BAAAAcwAAAAA=</string> </
                   <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>reditect</string>
                             <string>lines_portal_type</string>
                             <string>_getattr_</string>
                             <string>context</string>
@@ -153,6 +163,7 @@ AAAAKAAAAABzDwAAAFNjcmlwdCAoUHl0aG9uKXMIAAAAPG1vZHVsZT4BAAAAcwAAAAA=</string> </
                             <string>line</string>
                             <string>len</string>
                             <string>balance</string>
+                            <string>redirect</string>
                           </tuple>
                         </value>
                     </item>
@@ -164,7 +175,9 @@ AAAAKAAAAABzDwAAAFNjcmlwdCAoUHl0aG9uKXMIAAAAPG1vZHVsZT4BAAAAcwAAAAA=</string> </
         <item>
             <key> <string>func_defaults</string> </key>
             <value>
-              <none/>
+              <tuple>
+                <int>0</int>
+              </tuple>
             </value>
         </item>
         <item>
-- 
2.30.9