Commit 82202424 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Added single event aggregation feature. made it possible to delete planned events.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16375 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7ef5de4e
......@@ -65,7 +65,9 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>"""\n
<value> <string encoding="cdata"><![CDATA[
"""\n
This script creates a new event with given metadata and\n
attaches it to the current ticket.\n
"""\n
......@@ -82,31 +84,49 @@ user = context.portal_membership.getAuthenticatedMember()\n
user_person = context.portal_catalog.getResultValue(portal_type=\'Person\', reference=user)\n
\n
# For every person, create an event\n
count = 0\n
for person in person_list:\n
# Create a new event\n
if not single_event:\n
count = 0\n
for person in person_list:\n
# Create a new event\n
event = module.newContent(portal_type=portal_type, \n
description=description, \n
title=title, \n
follow_up=follow_up,\n
text_content=text_content) # text_format is set by Event_init\n
count += 1\n
# Trigger appropriate workflow action\n
if direction == \'incoming\':\n
event.setSourceValue(person)\n
event.setDestinationValue(user_person)\n
event.receive()\n
else:\n
event.plan()\n
event.setDestinationValue(person)\n
event.setSourceValue(user_person)\n
else:\n
if direction == \'incoming\' and len(person_list) > 1:\n
# This case is not possible\n
portal_status_message = translateString("The Single Event option can only be used with outgoing messages",\n
mapping = dict(portal_type = portal_type, count=count))\n
return context.Base_redirect(form_id, keep_items = dict(portal_status_message=portal_status_message, selection_name=selection_name, selection_index=selection_index), **kw)\n
# Proceed to event creation\n
event = module.newContent(portal_type=portal_type, \n
description=description, \n
title=title, \n
follow_up=follow_up,\n
text_content=text_content) # text_format is set by Event_init\n
count += 1\n
# Trigger appropriate workflow action\n
if direction == \'incoming\':\n
event.setSourceValue(person)\n
event.setDestinationValue(user_person)\n
event.receive()\n
else:\n
event.plan()\n
event.setDestinationValue(person)\n
event.setSourceValue(user_person)\n
\n
event.plan()\n
event.setDestinationValueList(person_list)\n
event.setSourceValue(user_person)\n
count = 1\n
\n
# Redirect to the event module (but is this the best place to go since events are not yet indexed ?)\n
portal_status_message = translateString("Created and associated ${count} new ${portal_type}(s) to the selected ticket.", \n
mapping = dict(portal_type = portal_type, count=count))\n
context.Base_redirect(form_id, keep_items = dict(portal_status_message=portal_status_message, selection_name=selection_name, selection_index=selection_index), **kw)\n
</string> </value>
]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
......@@ -122,7 +142,7 @@ context.Base_redirect(form_id, keep_items = dict(portal_status_message=portal_st
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>portal_type, title, description, direction, selection_name, selection_index, follow_up, text_content, form_id, **kw</string> </value>
<value> <string>portal_type, title, description, direction, selection_name, selection_index, follow_up, single_event=0, text_content, form_id, **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -142,7 +162,7 @@ context.Base_redirect(form_id, keep_items = dict(portal_status_message=portal_st
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>9</int> </value>
<value> <int>10</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
......@@ -155,6 +175,7 @@ context.Base_redirect(form_id, keep_items = dict(portal_status_message=portal_st
<string>selection_name</string>
<string>selection_index</string>
<string>follow_up</string>
<string>single_event</string>
<string>text_content</string>
<string>form_id</string>
<string>kw</string>
......@@ -170,6 +191,7 @@ context.Base_redirect(form_id, keep_items = dict(portal_status_message=portal_st
<string>person</string>
<string>event</string>
<string>_inplacevar_</string>
<string>len</string>
<string>dict</string>
<string>portal_status_message</string>
<string>_apply_</string>
......@@ -184,7 +206,11 @@ context.Base_redirect(form_id, keep_items = dict(portal_status_message=portal_st
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
<tuple>
<int>0</int>
<none/>
<none/>
</tuple>
</value>
</item>
<item>
......
......@@ -103,6 +103,7 @@
<string>your_description</string>
<string>your_direction</string>
<string>your_follow_up</string>
<string>your_single_event</string>
</list>
</value>
</item>
......
......@@ -87,7 +87,7 @@
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>width</string> </key>
<key> <string>width</string> </key>
<value> <int>40</int> </value>
</item>
</dictionary>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="CheckBoxField" module="Products.Formulator.StandardFields"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_single_event</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>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</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>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Single Event</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -60,15 +60,15 @@
<value>
<dictionary>
<item>
<key> <string>css_class</string> </key>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
......@@ -84,13 +84,13 @@
<value> <string></string> </value>
</item>
<item>
<key> <string>text_editor</string> </key>
<key> <string>text_editor</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
......@@ -101,15 +101,15 @@
<value>
<dictionary>
<item>
<key> <string>css_class</string> </key>
<key> <string>css_class</string> </key>
<value> <string>page</string> </value>
</item>
<item>
<key> <string>default</string> </key>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
......@@ -125,11 +125,11 @@
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>text_editor</string> </key>
<key> <string>text_editor</string> </key>
<value> <string>text_area</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<key> <string>title</string> </key>
<value> <string>Body</string> </value>
</item>
</dictionary>
......
......@@ -75,7 +75,7 @@
<value>
<dictionary>
<item>
<key> <string>display_width</string> </key>
<key> <string>display_width</string> </key>
<value> <int>40</int> </value>
</item>
<item>
......
......@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.DCWorkflow.States</string>
<string>StateDefinition</string>
</tuple>
<none/>
<global name="StateDefinition" module="Products.DCWorkflow.States"/>
<tuple/>
</tuple>
</pickle>
<pickle>
......@@ -40,6 +37,8 @@
<key> <string>transitions</string> </key>
<value>
<tuple>
<string>delete</string>
<string>delete_action</string>
<string>order</string>
<string>order_action</string>
</tuple>
......
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