[Erp5-report] r21691 - in /erp5/trunk/bt5/erp5_project: SkinTemplateItem/portal_skins/erp5_...
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Jun 18 17:25:13 CEST 2008
Author: jerome
Date: Wed Jun 18 17:25:10 2008
New Revision: 21691
URL: http://svn.erp5.org?rev=21691&view=rev
Log:
Only send notification message if the recipient is a user that can view the task report
Modified:
erp5/trunk/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskReport_copyOrderPropertiesAndNotifyAssignee.xml
erp5/trunk/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/TaskReportWorkflow_notifyFinishedTaskReport.xml
erp5/trunk/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/TaskReport_notifyAssignee.xml
erp5/trunk/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/TaskReport_notifyRestartToAssignee.xml
erp5/trunk/bt5/erp5_project/bt/revision
Modified: erp5/trunk/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskReport_copyOrderPropertiesAndNotifyAssignee.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskReport_copyOrderPropertiesAndNotifyAssignee.xml?rev=21691&r1=21690&r2=21691&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskReport_copyOrderPropertiesAndNotifyAssignee.xml (original)
+++ erp5/trunk/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/TaskReport_copyOrderPropertiesAndNotifyAssignee.xml Wed Jun 18 17:25:10 2008
@@ -68,7 +68,12 @@
<value> <string>if related_simulation_movement_path_list is None:\n
raise RuntimeError, \'related_simulation_movement_path_list is missing. Update ERP5 Product.\'\n
\n
+if REQUEST is not None:\n
+ from zExceptions import Unauthorized\n
+ raise Unauthorized(script.id)\n
+\n
task_report = context\n
+portal = task_report.getPortalObject()\n
\n
# First, copy Order properties\n
task_report.PackingList_copyOrderProperties()\n
@@ -94,9 +99,16 @@
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
- message = """\n
-A new task has been assigned to you by %(assignor)s.\n
+\n
+# We send a message only if the requester have an email and the assignee \n
+# is an user that can view the task report.\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
+ source_user = portal.portal_membership.getMemberById(source_person.getReference())\n
+ if source_user is not None and source_user.has_permission(\'View\', task_report):\n
+ message = """A new task has been assigned to you by %(assignor)s.\n
\n
This task is named: %(title)s\n
\n
@@ -116,11 +128,10 @@
\'start_date\': task_report.getStartDate().Date(),\n
\'stop_date\': task_report.getStopDate().Date(),\n
}\n
- portal = task_report.getPortalObject()\n
- portal.portal_notifications.sendMessage(sender=destination_decision_person,\n
- recipient=source_person, \n
- subject="[ERP5 Task] %s" % task_report.getTitle(), \n
- message=message)\n
+ portal.portal_notifications.sendMessage(sender=destination_decision_person,\n
+ recipient=source_person, \n
+ subject="[ERP5 Task] %s" % task_report.getTitle(), \n
+ message=message)\n
\n
# Then, modify state\n
confirm_tag = \'%s_confirm\' % task_report.getPath()\n
@@ -156,7 +167,7 @@
</item>
<item>
<key> <string>_params</string> </key>
- <value> <string>related_simulation_movement_path_list=None</string> </value>
+ <value> <string>related_simulation_movement_path_list=None, REQUEST=None</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
@@ -176,23 +187,28 @@
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
- <value> <int>1</int> </value>
+ <value> <int>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>related_simulation_movement_path_list</string>
+ <string>REQUEST</string>
<string>None</string>
<string>RuntimeError</string>
+ <string>zExceptions</string>
+ <string>Unauthorized</string>
+ <string>_getattr_</string>
+ <string>script</string>
<string>context</string>
<string>task_report</string>
- <string>_getattr_</string>
+ <string>portal</string>
<string>related_order</string>
<string>source_person</string>
<string>destination_decision_person</string>
+ <string>source_user</string>
<string>message</string>
- <string>portal</string>
<string>confirm_tag</string>
</tuple>
</value>
@@ -207,6 +223,7 @@
<value>
<tuple>
<none/>
+ <none/>
</tuple>
</value>
</item>
Modified: erp5/trunk/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/TaskReportWorkflow_notifyFinishedTaskReport.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/TaskReportWorkflow_notifyFinishedTaskReport.xml?rev=21691&r1=21690&r2=21691&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/TaskReportWorkflow_notifyFinishedTaskReport.xml (original)
+++ erp5/trunk/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/TaskReportWorkflow_notifyFinishedTaskReport.xml Wed Jun 18 17:25:10 2008
@@ -66,6 +66,7 @@
<item>
<key> <string>_body</string> </key>
<value> <string>task_report = state_change[\'object\']\n
+portal = task_report.getPortalObject()\n
\n
# Notify the requester.\n
source_person = task_report.getSourceValue(portal_type="Person")\n
@@ -73,21 +74,22 @@
if destination_decision_person is None:\n
destination_decision_person = task_report.getDestinationValue(portal_type="Person")\n
\n
-# We send a message only if the requester have an email and is a user in the\n
-# system.\n
+# We send a message only if the requester have an email and \n
+# the assignee is a user that can view the task report.\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
+ source_user = portal.portal_membership.getMemberById(source_person.getReference())\n
+ if source_user is not None and source_user.has_permission(\'View\', task_report):\n
+ message = """\n
%s has finished the task report titled with %s.\n
Please look at this URL:\n
%s/%s\n
""" % (source_person.getTitle(), task_report.getTitle(),\n
task_report.ERP5Site_getAbsoluteUrl(), task_report.getRelativeUrl())\n
- portal = task_report.getPortalObject()\n
- portal.portal_notifications.sendMessage(sender=source_person, recipient=destination_decision_person,\n
- subject="Task Report Finished", message=message)\n
+ portal.portal_notifications.sendMessage(sender=source_person, recipient=destination_decision_person,\n
+ subject="Task Report Finished", message=message)\n
\n
container.PackingList_updateAppliedRule(state_change)\n
</string> </value>
@@ -107,6 +109,14 @@
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</string> </value>
+ </item>
+ <item>
+ <key> <string>_proxy_roles</string> </key>
+ <value>
+ <tuple>
+ <string>Manager</string>
+ </tuple>
+ </value>
</item>
<item>
<key> <string>errors</string> </key>
@@ -136,11 +146,12 @@
<string>_getitem_</string>
<string>task_report</string>
<string>_getattr_</string>
+ <string>portal</string>
<string>source_person</string>
<string>destination_decision_person</string>
<string>None</string>
+ <string>source_user</string>
<string>message</string>
- <string>portal</string>
<string>container</string>
</tuple>
</value>
Modified: erp5/trunk/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/TaskReport_notifyAssignee.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/TaskReport_notifyAssignee.xml?rev=21691&r1=21690&r2=21691&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/TaskReport_notifyAssignee.xml (original)
+++ erp5/trunk/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/TaskReport_notifyAssignee.xml Wed Jun 18 17:25:10 2008
@@ -68,9 +68,10 @@
<value> <string encoding="cdata"><![CDATA[
task_report = state_change[\'object\']\n
+portal = task_report.getPortalObject()\n
\n
# get question\n
-history = context.portal_workflow.getInfoFor(ob=task_report,\n
+history = portal.portal_workflow.getInfoFor(ob=task_report,\n
name=\'history\',\n
wf_id=\'task_report_workflow\',\n
default=())\n
@@ -87,12 +88,14 @@
if destination_decision_person is None:\n
destination_decision_person = task_report.getDestinationValue(portal_type="Person")\n
\n
-# send notification only if the source have a valid email and is a user in the\n
-# system\n
+# We send a message only if the requester have an email and the assignee \n
+# is an user that can view the task report.\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
+ source_user = portal.portal_membership.getMemberById(source_person.getReference())\n
+ if source_user is not None and source_user.has_permission(\'View\', task_report):\n
message = """\n
A question from task has been assigned to you by %(assignor)s.\n
\n
@@ -118,7 +121,6 @@
\'stop_date\': task_report.getStopDate().Date(),\n
\'question\' : question,\n
}\n
- portal = task_report.getPortalObject()\n
portal.portal_notifications.sendMessage(sender=destination_decision_person, recipient=source_person,\n
subject="[ERP5 Task] Question to You", message=message)\n
@@ -140,6 +142,14 @@
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</string> </value>
+ </item>
+ <item>
+ <key> <string>_proxy_roles</string> </key>
+ <value>
+ <tuple>
+ <string>Manager</string>
+ </tuple>
+ </value>
</item>
<item>
<key> <string>errors</string> </key>
@@ -169,7 +179,7 @@
<string>_getitem_</string>
<string>task_report</string>
<string>_getattr_</string>
- <string>context</string>
+ <string>portal</string>
<string>history</string>
<string>append</string>
<string>$append0</string>
@@ -180,8 +190,8 @@
<string>source_person</string>
<string>destination_decision_person</string>
<string>None</string>
+ <string>source_user</string>
<string>message</string>
- <string>portal</string>
</tuple>
</value>
</item>
Modified: erp5/trunk/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/TaskReport_notifyRestartToAssignee.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/TaskReport_notifyRestartToAssignee.xml?rev=21691&r1=21690&r2=21691&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/TaskReport_notifyRestartToAssignee.xml (original)
+++ erp5/trunk/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/TaskReport_notifyRestartToAssignee.xml Wed Jun 18 17:25:10 2008
@@ -66,6 +66,7 @@
<item>
<key> <string>_body</string> </key>
<value> <string>task_report = state_change[\'object\']\n
+portal = task_report.getPortalObject()\n
\n
# Notify assignee\n
source_person = task_report.getSourceValue(portal_type="Person")\n
@@ -74,11 +75,13 @@
destination_decision_person = task_report.getDestinationValue(portal_type="Person")\n
\n
# send notification only if the source have a valid email and is a user in the\n
-# system\n
+# system that can view the task report\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
+ source_user = portal.portal_membership.getMemberById(source_person.getReference())\n
+ if source_user is not None and source_user.has_permission(\'View\', task_report):\n
message = """\n
Restarted task has been assigned to you by %(assignor)s.\n
\n
@@ -100,7 +103,6 @@
\'start_date\': task_report.getStartDate().Date(),\n
\'stop_date\': task_report.getStopDate().Date(),\n
}\n
- portal = task_report.getPortalObject()\n
portal.portal_notifications.sendMessage(sender=destination_decision_person, recipient=source_person,\n
subject="[ERP5 Task] Restarted Task Assigned to You ", message=message)\n
</string> </value>
@@ -120,6 +122,14 @@
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</string> </value>
+ </item>
+ <item>
+ <key> <string>_proxy_roles</string> </key>
+ <value>
+ <tuple>
+ <string>Manager</string>
+ </tuple>
+ </value>
</item>
<item>
<key> <string>errors</string> </key>
@@ -149,11 +159,12 @@
<string>_getitem_</string>
<string>task_report</string>
<string>_getattr_</string>
+ <string>portal</string>
<string>source_person</string>
<string>destination_decision_person</string>
<string>None</string>
+ <string>source_user</string>
<string>message</string>
- <string>portal</string>
</tuple>
</value>
</item>
Modified: erp5/trunk/bt5/erp5_project/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_project/bt/revision?rev=21691&r1=21690&r2=21691&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_project/bt/revision (original)
+++ erp5/trunk/bt5/erp5_project/bt/revision Wed Jun 18 17:25:10 2008
@@ -1,1 +1,1 @@
-529
+530
More information about the Erp5-report
mailing list