diff --git a/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/TaskReport_notifyAssignee.xml b/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/TaskReport_notifyAssignee.xml index b8e268a1d2403221e0ff3b80db4764c95dab953b..36c74e18320f82c782dd2e91ea598827a0722741 100644 --- a/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/TaskReport_notifyAssignee.xml +++ b/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/TaskReport_notifyAssignee.xml @@ -65,19 +65,35 @@ </item> <item> <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 # Notify assignee\n -source_person = context.getSourceValue(portal_type="Person")\n -destination_decision_person = context.getDestinationDecisionValue(portal_type="Person")\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 = context.getDestinationValue(portal_type="Person")\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 -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 This task is named: %(title)s\n \n @@ -87,6 +103,9 @@ Description: \n Start Date: %(start_date)s\n Stop Date: %(stop_date)s\n \n +Question:\n +%(question)s\n +\n Please visit ERP5: %(url)s\n """ % {\n \'assignor\': destination_decision_person.getTitle(),\n @@ -96,9 +115,12 @@ Please visit ERP5: %(url)s\n \'comment\' : packing_list.getComment(),\n \'start_date\': packing_list.getStartDate().Date(),\n \'stop_date\': packing_list.getStopDate().Date(),\n + \'question\' : question,\n }\n - email.activate().send(from_url = from_email, subject="New Task Assigned to You", msg = msg)\n -</string> </value> + email.activate().send(from_url = from_email, subject=" Task Assigned to You", msg = msg)\n + + +]]></string> </value> </item> <item> <key> <string>_code</string> </key> @@ -145,6 +167,14 @@ Please visit ERP5: %(url)s\n <string>packing_list</string> <string>_getattr_</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>destination_decision_person</string> <string>None</string> diff --git a/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/TaskReport_notifyRestartToAssignee.xml b/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/TaskReport_notifyRestartToAssignee.xml new file mode 100644 index 0000000000000000000000000000000000000000..8290a47a23685be530c4d60ce8af7bb788cb36ac --- /dev/null +++ b/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/TaskReport_notifyRestartToAssignee.xml @@ -0,0 +1,180 @@ +<?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> diff --git a/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/transitions/restart.xml b/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/transitions/restart.xml index 9ab753ff8b67c81c5f4e155e5549fd85c037f12d..56db52814dc7174e2714f0c47bb0ba7f64b8eae3 100644 --- a/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/transitions/restart.xml +++ b/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/transitions/restart.xml @@ -35,7 +35,7 @@ </item> <item> <key> <string>after_script_name</string> </key> - <value> <string>TaskReport_notifyAssignee</string> </value> + <value> <string>TaskReport_notifyRestartToAssignee</string> </value> </item> <item> <key> <string>description</string> </key> diff --git a/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/transitions/restart_action.xml b/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/transitions/restart_action.xml index 8ea7d3058a17a376656698dd865c5979a7638f96..44535545ad0db41eaba1d2621df9f0030109fd87 100644 --- a/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/transitions/restart_action.xml +++ b/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/transitions/restart_action.xml @@ -83,7 +83,6 @@ <key> <string>roles</string> </key> <value> <tuple> - <string>Assignee</string> <string>Assignor</string> </tuple> </value>