Commit 22bdba79 authored by Rafael Monnerat's avatar Rafael Monnerat

improve notification messages.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21063 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b8989b6c
...@@ -65,19 +65,35 @@ ...@@ -65,19 +65,35 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>packing_list = state_change[\'object\']\n <value> <string encoding="cdata"><![CDATA[
packing_list = state_change[\'object\']\n
\n
# get question\n
history = context.portal_workflow.getInfoFor(ob=packing_list,\n
name=\'history\',\n
wf_id=\'task_report_workflow\',\n
default=())\n
\n
question_list = [question for question in history if question[\'action\'] == \'question_action\' ]\n
if len(question_list) > 0:\n
question = last_question[-1][\'comment\']\n
else:\n
question = \'\'\n
\n
\n
\n \n
# Notify assignee\n # Notify assignee\n
source_person = context.getSourceValue(portal_type="Person")\n source_person = packing_list.getSourceValue(portal_type="Person")\n
destination_decision_person = context.getDestinationDecisionValue(portal_type="Person")\n destination_decision_person = packing_list.getDestinationDecisionValue(portal_type="Person")\n
if destination_decision_person is None:\n if destination_decision_person is None:\n
destination_decision_person = context.getDestinationValue(portal_type="Person")\n destination_decision_person = packing_list.getDestinationValue(portal_type="Person")\n
if source_person is not None:\n if source_person is not None:\n
from_email = destination_decision_person.getDefaultEmailText()\n from_email = destination_decision_person.getDefaultEmailText()\n
email = source_person.getDefaultEmailValue()\n email = source_person.getDefaultEmailValue()\n
if email is not None:\n if email is not None:\n
msg = """\n msg = """\n
A new task has been assigned to you by %(assignor)s.\n A question from task has been assigned to you by %(assignor)s.\n
\n \n
This task is named: %(title)s\n This task is named: %(title)s\n
\n \n
...@@ -87,6 +103,9 @@ Description: \n ...@@ -87,6 +103,9 @@ Description: \n
Start Date: %(start_date)s\n Start Date: %(start_date)s\n
Stop Date: %(stop_date)s\n Stop Date: %(stop_date)s\n
\n \n
Question:\n
%(question)s\n
\n
Please visit ERP5: %(url)s\n Please visit ERP5: %(url)s\n
""" % {\n """ % {\n
\'assignor\': destination_decision_person.getTitle(),\n \'assignor\': destination_decision_person.getTitle(),\n
...@@ -96,9 +115,12 @@ Please visit ERP5: %(url)s\n ...@@ -96,9 +115,12 @@ Please visit ERP5: %(url)s\n
\'comment\' : packing_list.getComment(),\n \'comment\' : packing_list.getComment(),\n
\'start_date\': packing_list.getStartDate().Date(),\n \'start_date\': packing_list.getStartDate().Date(),\n
\'stop_date\': packing_list.getStopDate().Date(),\n \'stop_date\': packing_list.getStopDate().Date(),\n
\'question\' : question,\n
}\n }\n
email.activate().send(from_url = from_email, subject="New Task Assigned to You", msg = msg)\n email.activate().send(from_url = from_email, subject=" Task Assigned to You", msg = msg)\n
</string> </value>
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_code</string> </key> <key> <string>_code</string> </key>
...@@ -145,6 +167,14 @@ Please visit ERP5: %(url)s\n ...@@ -145,6 +167,14 @@ Please visit ERP5: %(url)s\n
<string>packing_list</string> <string>packing_list</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>history</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>question</string>
<string>question_list</string>
<string>len</string>
<string>last_question</string>
<string>source_person</string> <string>source_person</string>
<string>destination_decision_person</string> <string>destination_decision_person</string>
<string>None</string> <string>None</string>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>packing_list = state_change[\'object\']\n
\n
# Notify assignee\n
source_person = packing_list.getSourceValue(portal_type="Person")\n
destination_decision_person = packing_list.getDestinationDecisionValue(portal_type="Person")\n
if destination_decision_person is None:\n
destination_decision_person = packing_list.getDestinationValue(portal_type="Person")\n
if source_person is not None:\n
from_email = destination_decision_person.getDefaultEmailText()\n
email = source_person.getDefaultEmailValue()\n
if email is not None:\n
msg = """\n
Restarted task has been assigned to you by %(assignor)s.\n
\n
This task is named: %(title)s\n
\n
Description: \n
%(comment)s\n
\n
Start Date: %(start_date)s\n
Stop Date: %(stop_date)s\n
\n
Please visit ERP5: %(url)s\n
""" % {\n
\'assignor\': destination_decision_person.getTitle(),\n
\'title\' : packing_list.getTitle(),\n
\'url\' : \'%s/%s\' % (packing_list.ERP5Site_getAbsoluteUrl(),\n
packing_list.getRelativeUrl()),\n
\'comment\' : packing_list.getComment(),\n
\'start_date\': packing_list.getStartDate().Date(),\n
\'stop_date\': packing_list.getStopDate().Date(),\n
}\n
email.activate().send(from_url = from_email, subject="Restarted Task Assigned to You", msg = msg)\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>state_change</string>
<string>_getitem_</string>
<string>packing_list</string>
<string>_getattr_</string>
<string>source_person</string>
<string>destination_decision_person</string>
<string>None</string>
<string>from_email</string>
<string>email</string>
<string>msg</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TaskReport_notifyRestartToAssignee</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
</item> </item>
<item> <item>
<key> <string>after_script_name</string> </key> <key> <string>after_script_name</string> </key>
<value> <string>TaskReport_notifyAssignee</string> </value> <value> <string>TaskReport_notifyRestartToAssignee</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
......
...@@ -83,7 +83,6 @@ ...@@ -83,7 +83,6 @@
<key> <string>roles</string> </key> <key> <string>roles</string> </key>
<value> <value>
<tuple> <tuple>
<string>Assignee</string>
<string>Assignor</string> <string>Assignor</string>
</tuple> </tuple>
</value> </value>
......
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