From 2b1a4da86f8b964ef0bd2bc9b34ec2a4b415afab Mon Sep 17 00:00:00 2001 From: Kazuhiko Shiozaki <kazuhiko@nexedi.com> Date: Tue, 10 Jan 2012 11:17:08 +0100 Subject: [PATCH] cleanup create_ticket_action. --- .../erp5_crm/Event_createFollowUpTicket.xml | 35 +++-- .../erp5_crm/Event_newFollowUpTicket.xml | 9 +- ...t_viewCreateTicketWorkflowActionDialog.xml | 1 - .../your_follow_up_ticket_resource.xml | 131 ------------------ .../scripts/Event_createResponseEvent.xml | 94 ------------- .../scripts/Event_createTicket.xml | 106 -------------- .../transitions/create_ticket.xml | 58 -------- .../transitions/create_ticket_action.xml | 22 +-- .../variables/ticket_portal_type.xml | 48 ------- bt5/erp5_crm/bt/revision | 2 +- 10 files changed, 31 insertions(+), 475 deletions(-) delete mode 100644 bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_viewCreateTicketWorkflowActionDialog/your_follow_up_ticket_resource.xml delete mode 100644 bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_simulation_workflow/scripts/Event_createResponseEvent.xml delete mode 100644 bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_simulation_workflow/scripts/Event_createTicket.xml delete mode 100644 bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_simulation_workflow/transitions/create_ticket.xml delete mode 100644 bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_simulation_workflow/variables/ticket_portal_type.xml diff --git a/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_createFollowUpTicket.xml b/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_createFollowUpTicket.xml index cbd8b4178f..0a72a6eed1 100644 --- a/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_createFollowUpTicket.xml +++ b/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_createFollowUpTicket.xml @@ -53,20 +53,33 @@ <value> <string># this script allows to create a new follow up ticket for a given event\n portal = context.getPortalObject()\n event = context\n -ticket_module = portal.getPortalObject().getDefaultModule(follow_up_ticket_type)\n \n -# Create a new object\n -new_object = ticket_module.newContent(\n - portal_type=follow_up_ticket_type,\n - title=follow_up_ticket_title,\n - resource=follow_up_ticket_resource,\n - destination_decision_list=event.getSourceList()\n -)\n +operator_list = event.getDestinationList()\n +try:\n + source_value = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n +except ValueError:\n + source_value = None\n +if source_value is not None:\n + source_section_value = source_value.getDefaultCareerSubordinationValue()\n + operator_list.append(source_value.getRelativeUrl())\n +else:\n + source_section_value = None\n +\n +module = portal.getDefaultModule(ticket_portal_type)\n +ticket = module.newContent(\n + portal_type=ticket_portal_type,\n + title=follow_up_ticket_title,\n + start_date=event.getStartDate(),\n + destination_decision_list=event.getSourceList(),\n + destination_section=event.getSourceSection() or event.getSource(),\n + source_trade_set=operator_list,\n + source_value=source_value,\n + source_section_value=source_section_value,\n + )\n \n -# Now create the relation between the event object and the new follow up ticket\n follow_up_list = event.getFollowUpList()\n -follow_up_list.append(new_object.getRelativeUrl())\n -event.setFollowUpValueList(follow_up_list)\n +follow_up_list.append(ticket.getRelativeUrl())\n +event.edit(follow_up_list=follow_up_list)\n </string> </value> </item> <item> diff --git a/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_newFollowUpTicket.xml b/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_newFollowUpTicket.xml index bc6e948dac..0ad6b69ab7 100644 --- a/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_newFollowUpTicket.xml +++ b/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_newFollowUpTicket.xml @@ -51,16 +51,17 @@ <item> <key> <string>_body</string> </key> <value> <string>context.Event_createFollowUpTicket(follow_up_ticket_type=follow_up_ticket_type,\n - follow_up_ticket_title=follow_up_ticket_title,\n - follow_up_ticket_resource=follow_up_ticket_resource)\n -\n + follow_up_ticket_title=follow_up_ticket_title)\n +if context.getPortalObject().portal_workflow.isTransitionPossible(\n + context, \'deliver\'):\n + context.deliver()\n return context.Base_redirect("", \n keep_items={\'portal_status_message\':context.getPortalObject().Base_translateString("Follow Up Ticket Created.")})\n </string> </value> </item> <item> <key> <string>_params</string> </key> - <value> <string>follow_up_ticket_type=None, follow_up_ticket_title=None, follow_up_ticket_resource=None, **kw</string> </value> + <value> <string>follow_up_ticket_type=None, follow_up_ticket_title=None, **kw</string> </value> </item> <item> <key> <string>description</string> </key> diff --git a/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_viewCreateTicketWorkflowActionDialog.xml b/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_viewCreateTicketWorkflowActionDialog.xml index b45783d893..d9464def7d 100644 --- a/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_viewCreateTicketWorkflowActionDialog.xml +++ b/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_viewCreateTicketWorkflowActionDialog.xml @@ -95,7 +95,6 @@ <list> <string>your_follow_up_ticket_title</string> <string>your_follow_up_ticket_type</string> - <string>your_follow_up_ticket_resource</string> </list> </value> </item> diff --git a/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_viewCreateTicketWorkflowActionDialog/your_follow_up_ticket_resource.xml b/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_viewCreateTicketWorkflowActionDialog/your_follow_up_ticket_resource.xml deleted file mode 100644 index 3210beb381..0000000000 --- a/bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_viewCreateTicketWorkflowActionDialog/your_follow_up_ticket_resource.xml +++ /dev/null @@ -1,131 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="ProxyField" module="Products.ERP5Form.ProxyField"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>delegated_list</string> </key> - <value> - <list> - <string>items</string> - <string>required</string> - <string>title</string> - </list> - </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>your_follow_up_ticket_resource</string> </value> - </item> - <item> - <key> <string>message_values</string> </key> - <value> - <dictionary> - <item> - <key> <string>external_validator_failed</string> </key> - <value> <string>The input failed the external validator.</string> </value> - </item> - </dictionary> - </value> - </item> - <item> - <key> <string>overrides</string> </key> - <value> - <dictionary> - <item> - <key> <string>field_id</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>form_id</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>target</string> </key> - <value> <string></string> </value> - </item> - </dictionary> - </value> - </item> - <item> - <key> <string>tales</string> </key> - <value> - <dictionary> - <item> - <key> <string>field_id</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>form_id</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>items</string> </key> - <value> - <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> - </value> - </item> - <item> - <key> <string>target</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>title</string> </key> - <value> <string></string> </value> - </item> - </dictionary> - </value> - </item> - <item> - <key> <string>values</string> </key> - <value> - <dictionary> - <item> - <key> <string>field_id</string> </key> - <value> <string>my_list_field</string> </value> - </item> - <item> - <key> <string>form_id</string> </key> - <value> <string>Base_viewFieldLibrary</string> </value> - </item> - <item> - <key> <string>items</string> </key> - <value> - <list/> - </value> - </item> - <item> - <key> <string>required</string> </key> - <value> <int>1</int> </value> - </item> - <item> - <key> <string>target</string> </key> - <value> <string>Click to edit the target</string> </value> - </item> - <item> - <key> <string>title</string> </key> - <value> <string>Ticket Nature</string> </value> - </item> - </dictionary> - </value> - </item> - </dictionary> - </pickle> - </record> - <record id="2" aka="AAAAAAAAAAI="> - <pickle> - <global name="TALESMethod" module="Products.Formulator.TALESField"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>_text</string> </key> - <value> <string>here/Ticket_getResourceItemList</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_simulation_workflow/scripts/Event_createResponseEvent.xml b/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_simulation_workflow/scripts/Event_createResponseEvent.xml deleted file mode 100644 index a90bac1c48..0000000000 --- a/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_simulation_workflow/scripts/Event_createResponseEvent.xml +++ /dev/null @@ -1,94 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>Script_magic</string> </key> - <value> <int>3</int> </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># this script allows to create a new respond event for\n -# the current event and send message immediately.\n -portal = state_change.getPortal()\n -portal_workflow = portal.portal_workflow\n -event = state_change[\'object\']\n -\n -portal_type = portal_workflow.getInfoFor(event,\n - \'respond_event_portal_type\')\n -\n -\n -# Pass Mark Responded transition.\n -if not portal_type:\n - raise ValueError, \'No portal_type provided.\'\n -\n -text_content = portal_workflow.getInfoFor(event,\n - \'respond_event_text_content\')\n -title = portal_workflow.getInfoFor(event, \'respond_event_title\')\n -resource = portal_workflow.getInfoFor(event, \'respond_event_resource\')\n -\n -event.Event_createRespondEvent(portal_type, title, resource, text_content)\n -</string> </value> - </item> - <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>id</string> </key> - <value> <string>Event_createResponseEvent</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_simulation_workflow/scripts/Event_createTicket.xml b/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_simulation_workflow/scripts/Event_createTicket.xml deleted file mode 100644 index b71032595e..0000000000 --- a/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_simulation_workflow/scripts/Event_createTicket.xml +++ /dev/null @@ -1,106 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>Script_magic</string> </key> - <value> <int>3</int> </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>event = state_change[\'object\']\n -portal = event.getPortalObject()\n -\n -\n -ticket_portal_type = portal.portal_workflow.getInfoFor(event, \'ticket_portal_type\')\n -\n -operator_list = event.getDestinationList()\n -\n -try:\n - source_value = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n -except ValueError:\n - source_value = None\n -if source_value is not None:\n - source_section_value = source_value.getDefaultCareerSubordinationValue()\n - operator_list.append(source_value.getRelativeUrl())\n -else:\n - source_section_value = None\n -\n -module = portal.getDefaultModule(ticket_portal_type)\n -ticket = module.newContent(\n - portal_type=ticket_portal_type,\n - start_date=event.getStartDate(),\n - destination_decision=event.getSource(),\n - destination_section=event.getSourceSection() or event.getSource(),\n - source_trade_set=operator_list,\n - source_value=source_value,\n - source_section_value=source_section_value,\n - )\n -\n -follow_up_list = event.getFollowUpList()\n -follow_up_list.append(ticket.getRelativeUrl())\n -event.edit(follow_up_list=follow_up_list)\n -</string> </value> - </item> - <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>id</string> </key> - <value> <string>Event_createTicket</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_simulation_workflow/transitions/create_ticket.xml b/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_simulation_workflow/transitions/create_ticket.xml deleted file mode 100644 index ffca6ced98..0000000000 --- a/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_simulation_workflow/transitions/create_ticket.xml +++ /dev/null @@ -1,58 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="TransitionDefinition" module="Products.DCWorkflow.Transitions"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>actbox_category</string> </key> - <value> <string>workflow</string> </value> - </item> - <item> - <key> <string>actbox_name</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>actbox_url</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>after_script_name</string> </key> - <value> <string>Event_createTicket</string> </value> - </item> - <item> - <key> <string>description</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>guard</string> </key> - <value> - <none/> - </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>create_ticket</string> </value> - </item> - <item> - <key> <string>new_state_id</string> </key> - <value> <string>delivered</string> </value> - </item> - <item> - <key> <string>script_name</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>title</string> </key> - <value> <string>Create Follow Up Ticket</string> </value> - </item> - <item> - <key> <string>trigger_type</string> </key> - <value> <int>2</int> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_simulation_workflow/transitions/create_ticket_action.xml b/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_simulation_workflow/transitions/create_ticket_action.xml index c4dc411606..190f6e77c0 100644 --- a/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_simulation_workflow/transitions/create_ticket_action.xml +++ b/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_simulation_workflow/transitions/create_ticket_action.xml @@ -89,30 +89,10 @@ <item> <key> <string>data</string> </key> <value> - <dictionary> - <item> - <key> <string>ticket_portal_type</string> </key> - <value> - <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> - </value> - </item> - </dictionary> + <dictionary/> </value> </item> </dictionary> </pickle> </record> - <record id="4" aka="AAAAAAAAAAQ="> - <pickle> - <global name="Expression" module="Products.CMFCore.Expression"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>text</string> </key> - <value> <string>python: state_change.kwargs[\'ticket_portal_type\']</string> </value> - </item> - </dictionary> - </pickle> - </record> </ZopeData> diff --git a/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_simulation_workflow/variables/ticket_portal_type.xml b/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_simulation_workflow/variables/ticket_portal_type.xml deleted file mode 100644 index 6753e703aa..0000000000 --- a/bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_simulation_workflow/variables/ticket_portal_type.xml +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="VariableDefinition" module="Products.DCWorkflow.Variables"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>default_expr</string> </key> - <value> - <none/> - </value> - </item> - <item> - <key> <string>default_value</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>description</string> </key> - <value> <string>Ticket Type</string> </value> - </item> - <item> - <key> <string>for_catalog</string> </key> - <value> <int>0</int> </value> - </item> - <item> - <key> <string>for_status</string> </key> - <value> <int>1</int> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>ticket_portal_type</string> </value> - </item> - <item> - <key> <string>info_guard</string> </key> - <value> - <none/> - </value> - </item> - <item> - <key> <string>update_always</string> </key> - <value> <int>0</int> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/bt5/erp5_crm/bt/revision b/bt5/erp5_crm/bt/revision index ec303dec77..989ba2b4b9 100644 --- a/bt5/erp5_crm/bt/revision +++ b/bt5/erp5_crm/bt/revision @@ -1 +1 @@ -583 \ No newline at end of file +584 \ No newline at end of file -- 2.30.9