Commit 8b173d92 authored by Jérome Perrin's avatar Jérome Perrin

Only send notifications if the recipient have an email address and is a user in the system.

Add some missing /view in URLs included in messages.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21597 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2595ae93
......@@ -72,7 +72,13 @@ source_person = task_report.getSourceValue(portal_type="Person")\n
destination_decision_person = task_report.getDestinationDecisionValue(portal_type="Person")\n
if destination_decision_person is None:\n
destination_decision_person = task_report.getDestinationValue(portal_type="Person")\n
if source_person is not None and destination_decision_person is not None:\n
\n
# We send a message only if the requester have an email and is a user in the\n
# system.\n
if source_person is not None \\\n
and destination_decision_person is not None \\\n
and destination_decision_person.getDefaultEmailText() \\\n
and destination_decision_person.getReference():\n
message = """\n
%s has finished the task report titled with %s.\n
Please look at this URL:\n
......
......@@ -86,7 +86,13 @@ source_person = task_report.getSourceValue(portal_type="Person")\n
destination_decision_person = task_report.getDestinationDecisionValue(portal_type="Person")\n
if destination_decision_person is None:\n
destination_decision_person = task_report.getDestinationValue(portal_type="Person")\n
if source_person is not None and destination_decision_person is not None:\n
\n
# send notification only if the source have a valid email and is a user in the\n
# system\n
if source_person is not None \\\n
and destination_decision_person is not None\\\n
and source_person.getDefaultEmailText() \\\n
and source_person.getReference():\n
message = """\n
A question from task has been assigned to you by %(assignor)s.\n
\n
......@@ -105,7 +111,7 @@ Please visit ERP5: %(url)s\n
""" % {\n
\'assignor\': destination_decision_person.getTitle(),\n
\'title\' : task_report.getTitle(),\n
\'url\' : \'%s/%s\' % (task_report.ERP5Site_getAbsoluteUrl(),\n
\'url\' : \'%s/%s/view\' % (task_report.ERP5Site_getAbsoluteUrl(),\n
task_report.getRelativeUrl()),\n
\'comment\' : task_report.getComment(),\n
\'start_date\': task_report.getStartDate().Date(),\n
......
......@@ -72,7 +72,13 @@ source_person = task_report.getSourceValue(portal_type="Person")\n
destination_decision_person = task_report.getDestinationDecisionValue(portal_type="Person")\n
if destination_decision_person is None:\n
destination_decision_person = task_report.getDestinationValue(portal_type="Person")\n
if source_person is not None and destination_decision_person is not None:\n
\n
# send notification only if the source have a valid email and is a user in the\n
# system\n
if source_person is not None \\\n
and destination_decision_person is not None\\\n
and source_person.getDefaultEmailText() \\\n
and source_person.getReference():\n
message = """\n
Restarted task has been assigned to you by %(assignor)s.\n
\n
......@@ -88,7 +94,7 @@ Please visit ERP5: %(url)s\n
""" % {\n
\'assignor\': destination_decision_person.getTitle(),\n
\'title\' : task_report.getTitle(),\n
\'url\' : \'%s/%s\' % (task_report.ERP5Site_getAbsoluteUrl(),\n
\'url\' : \'%s/%s/view\' % (task_report.ERP5Site_getAbsoluteUrl(),\n
task_report.getRelativeUrl()),\n
\'comment\' : task_report.getComment(),\n
\'start_date\': task_report.getStartDate().Date(),\n
......
528
\ No newline at end of file
529
\ 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