From 004d1dac659d842d81d2b24a7d416ed39f36bb7b Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Mon, 23 Mar 2009 13:47:09 +0000
Subject: [PATCH] * simplify the script.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26129 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_crm/Event_getAttachmentList.xml      | 25 +++++++------------
 bt5/erp5_crm/bt/revision                      |  2 +-
 2 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_getAttachmentList.xml b/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_getAttachmentList.xml
index 299381d4bc..2c295ae758 100644
--- a/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_getAttachmentList.xml
+++ b/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_getAttachmentList.xml
@@ -54,20 +54,15 @@
         <item>
             <key> <string>_body</string> </key>
             <value> <string># Get the list of attachments\n
-attachment_pdf_list=[]\n
-current_object = context.getObject()\n
+portal_type_list = (\'PDF\', \'Image\',)\n
 \n
-attachment_pdf_list = current_object.getAggregateValueList(\n
-   portal_type=(\'PDF\', \'Image\'))\n
+aggregate_list = context.getAggregateValueList(\n
+   portal_type=portal_type_list)\n
 \n
-attachment_pdf_uid_list =[x.getUid() for x in attachment_pdf_list]\n
+sub_document_list = [x.getObject() for x in context.searchFolder(\n
+   portal_type=portal_type_list)]\n
 \n
-if not attachment_pdf_uid_list :\n
-  return []\n
-result_list = [x.getObject() for x in current_object.searchFolder(\n
-                       portal_type=(\'PDF\', \'Image\'))]\n
-\n
-return attachment_pdf_list + attachment_list\n
+return aggregate_list + sub_document_list\n
 </string> </value>
         </item>
         <item>
@@ -106,17 +101,15 @@ return attachment_pdf_list + attachment_list\n
                           <tuple>
                             <string>lines_num</string>
                             <string>kw</string>
-                            <string>attachment_pdf_list</string>
+                            <string>portal_type_list</string>
                             <string>_getattr_</string>
                             <string>context</string>
-                            <string>current_object</string>
+                            <string>aggregate_list</string>
                             <string>append</string>
                             <string>$append0</string>
                             <string>_getiter_</string>
                             <string>x</string>
-                            <string>attachment_pdf_uid_list</string>
-                            <string>result_list</string>
-                            <string>attachment_list</string>
+                            <string>sub_document_list</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/bt5/erp5_crm/bt/revision b/bt5/erp5_crm/bt/revision
index bbce65161c..755152b7ef 100644
--- a/bt5/erp5_crm/bt/revision
+++ b/bt5/erp5_crm/bt/revision
@@ -1 +1 @@
-356
\ No newline at end of file
+359
\ No newline at end of file
-- 
2.30.9