Commit 5a334236 authored by Rafael Monnerat's avatar Rafael Monnerat

Improved Bug Notification Message

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23035 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8e6eabe1
...@@ -67,62 +67,57 @@ ...@@ -67,62 +67,57 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>bug_message = state_change["object"]\n <value> <string>bug_message = state_change["object"]\n
\n \n
body = """\n
Reporter: %s\n
Date: %s\n
\n
Bug Message:\n
\n
""" % (bug_message.getSourceTitle(\'\'), bug_message.getStartDate(\'\'))\n
\n
#XXX This does not support structured text format.\n
body += bug_message.getTextContent("") \n
\n
# Bug Information\n # Bug Information\n
bug = bug_message.getParentValue()\n bug = bug_message.getParentValue()\n
body += """\n body = """\n
+----------------------- Bug Information ----------------------+\n Bug : %s\n
\n Status : %s \n
Bug: %s\n Date : %s\n
Status: %s \n Link : %s/view\n
Reporter: %s\n """ % (bug.getTitle(\'\'), bug.getSimulationStateTitle(), \n
Submitted Date: %s\n bug.getStartDate(\'\'), bug.getAbsoluteUrl())\n
""" % (bug.getTitle(\'\'), bug.getSimulationStateTitle(), \n
bug.getSourceTradeTitle(\'\'), bug.getStartDate(\'\'))\n
\n \n
if bug.getSourceTitle() is not None:\n if bug.getSourceTitle() is not None:\n
body += """ Requester: %s\n body += """ Requester : %s\n
Assignee: %s\n Assignee : %s\n
Reporter: %s\n Reporter : %s\n
""" % (bug.getDestinationTitle(\'\'), bug.getSourceTitle(\'\'),\n """ % (bug.getDestinationTitle(\'\'), bug.getSourceTitle(\'\'),\n
bug.getSourceTradeTitle(\'\'))\n bug.getSourceTradeTitle(\'\'))\n
\n \n
body += """ Link: %s/view\n if bug.getDestinationProjectTitle() is not None:\n
Request Project: %s\n body += """ Request Project : %s\n
Assigned Project: %s\n """ % bug.getDestinationProjectTitle()\n
\n
if bug.getSourceProjectTitle() is not None:\n
body += """ Assigned Project : %s\n
""" % bug.getSourceProjectTitle()\n
\n
body += """ \n
Description: \n Description: \n
\n
%s\n %s\n
""" % (bug.getAbsoluteUrl(), bug.getDestinationProjectTitle(\'\'), \n
bug.getSourceProjectTitle(\'\'), bug.getDescription(\'\'))\n
\n \n
body += """\n """ % (bug.getDescription(\'\'))\n
+---------------------- Messages Related -----------------------+\n \n
body += """ Messages :\n
"""\n """\n
# Messages Information \n # Messages Information \n
message_count = 0\n simulation_state = (\'delivered\', \'started\')\n
for message in bug.searchFolder(portal_type=\'Bug Line\'):\n bug_message_list = bug.searchFolder(portal_type=\'Bug Line\', sort_on=(("id", "DESC"),), \n
if message.getSimulationState() == \'delivered\':\n simulation_state=simulation_state)\n
message_count += 1\n message_count = len(bug_message_list)+1\n
for message in bug_message_list:\n
message_count -= 1\n
body += """\n body += """\n
++++++ Message #%s submitted by %s on %s ++++++\n ++++++ Message #%s submitted by %s on %s ++++++\n
%s\n %s\n
""" % (message_count, bug_message.getSourceTitle(\'\'), \n """ % (message_count, bug_message.getSourceTitle(\'\'), \n
bug_message.getStartDate(), message.getTextContent(\'\') )\n message.getStartDate(), message.getTextContent(\'\') )\n
\n \n
portal = bug_message.getPortalObject()\n portal = bug_message.getPortalObject()\n
portal.portal_notifications.sendMessage(sender=bug_message.getSourceValue(),\n portal.portal_notifications.sendMessage(sender=bug_message.getSourceValue(),\n
recipient=bug_message.getDestinationValueList(), \n recipient=bug_message.getDestinationValueList(), \n
subject="[ERP5 Bug] [Message] %s" % bug_message.getTitle(), \n subject="[Bug %s] %s" % (bug.getReference(), bug.getTitle()), \n
message=body)\n message=body)\n
</string> </value> </string> </value>
</item> </item>
...@@ -170,10 +165,13 @@ portal.portal_notifications.sendMessage(sender=bug_message.getSourceValue(),\n ...@@ -170,10 +165,13 @@ portal.portal_notifications.sendMessage(sender=bug_message.getSourceValue(),\n
<string>_getitem_</string> <string>_getitem_</string>
<string>bug_message</string> <string>bug_message</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>body</string>
<string>_inplacevar_</string>
<string>bug</string> <string>bug</string>
<string>body</string>
<string>None</string> <string>None</string>
<string>_inplacevar_</string>
<string>simulation_state</string>
<string>bug_message_list</string>
<string>len</string>
<string>message_count</string> <string>message_count</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>message</string> <string>message</string>
......
313 314
\ 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