Commit c64f95b6 authored by Rafael Monnerat's avatar Rafael Monnerat

Fixed Open Bug Alarm notification.

- Use portal_notifications.
- Added set_ready state for get assigned Bugs

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23959 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b8049980
...@@ -53,13 +53,8 @@ ...@@ -53,13 +53,8 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string>portal = context.getPortalObject()\n
portal = context.getPortalObject()\n
bug_module = portal.bug_module\n bug_module = portal.bug_module\n
from_name = portal.getProperty(\'email_from_name\', \'ERP5\')\n
from_address = portal.getProperty(\'email_from_address\', \'postmaster@localhost\')\n
to_address = portal.getProperty(\'email_to_address\', from_address)\n
server_url = portal.ERP5Site_getAbsoluteUrl()\n server_url = portal.ERP5Site_getAbsoluteUrl()\n
\n \n
body_text_line_list = []\n body_text_line_list = []\n
...@@ -70,7 +65,7 @@ assigned_to_dict={}\n ...@@ -70,7 +65,7 @@ assigned_to_dict={}\n
not_assigned_bug_list=[]\n not_assigned_bug_list=[]\n
\n \n
for bug in bug_module.searchFolder(portal_type=\'Bug\',\n for bug in bug_module.searchFolder(portal_type=\'Bug\',\n
simulation_state=\'confirmed\',\n simulation_state=[\'confirmed\', \'set_ready\' ],\n
sort_on=((\'id\', \'asc\', \'int\'),)):\n sort_on=((\'id\', \'asc\', \'int\'),)):\n
bug = bug.getObject()\n bug = bug.getObject()\n
if bug.getDestination():\n if bug.getDestination():\n
...@@ -95,28 +90,11 @@ if not_assigned_bug_list:\n ...@@ -95,28 +90,11 @@ if not_assigned_bug_list:\n
addBodyLine(" %s/%s/view" % (server_url, bug.getRelativeUrl()))\n addBodyLine(" %s/%s/view" % (server_url, bug.getRelativeUrl()))\n
addBodyLine(\'\')\n addBodyLine(\'\')\n
\n \n
mail_text = """From: "%s" <%s>\n portal.portal_notifications.sendMessage(sender=None,\n
To: %s\n recipient=[],\n
Subject: %s: %s Open Bugs\n subject="%s: %s Open Bugs" % (portal.title_or_id(), bug_count,),\n
MIME-Version: 1.0\n message=\'\\n\'.join(body_text_line_list))\n
Content-Type: text/plain;\n </string> </value>
charset="utf-8"\n
Content-Transfer-Encoding: 8bit\n
Content-Disposition: inline\n
\n
%s""" % (\n
from_name,\n
from_address,\n
to_address,\n
portal.title_or_id(),\n
bug_count,\n
\'\\n\'.join(body_text_line_list)\n
)\n
if bug_count:\n
portal.MailHost.send(mail_text)\n
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_code</string> </key> <key> <string>_code</string> </key>
...@@ -156,9 +134,6 @@ if bug_count:\n ...@@ -156,9 +134,6 @@ if bug_count:\n
<string>context</string> <string>context</string>
<string>portal</string> <string>portal</string>
<string>bug_module</string> <string>bug_module</string>
<string>from_name</string>
<string>from_address</string>
<string>to_address</string>
<string>server_url</string> <string>server_url</string>
<string>body_text_line_list</string> <string>body_text_line_list</string>
<string>addBodyLine</string> <string>addBodyLine</string>
...@@ -171,7 +146,7 @@ if bug_count:\n ...@@ -171,7 +146,7 @@ if bug_count:\n
<string>assignee</string> <string>assignee</string>
<string>bug_list</string> <string>bug_list</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>mail_text</string> <string>None</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
385 388
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment