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 @@ ...@@ -65,7 +65,9 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <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 This script creates a new event with given metadata and\n
attaches it to the current ticket.\n attaches it to the current ticket.\n
"""\n """\n
...@@ -82,8 +84,9 @@ user = context.portal_membership.getAuthenticatedMember()\n ...@@ -82,8 +84,9 @@ user = context.portal_membership.getAuthenticatedMember()\n
user_person = context.portal_catalog.getResultValue(portal_type=\'Person\', reference=user)\n user_person = context.portal_catalog.getResultValue(portal_type=\'Person\', reference=user)\n
\n \n
# For every person, create an event\n # For every person, create an event\n
count = 0\n if not single_event:\n
for person in person_list:\n count = 0\n
for person in person_list:\n
# Create a new event\n # Create a new event\n
event = module.newContent(portal_type=portal_type, \n event = module.newContent(portal_type=portal_type, \n
description=description, \n description=description, \n
...@@ -100,13 +103,30 @@ for person in person_list:\n ...@@ -100,13 +103,30 @@ for person in person_list:\n
event.plan()\n event.plan()\n
event.setDestinationValue(person)\n event.setDestinationValue(person)\n
event.setSourceValue(user_person)\n event.setSourceValue(user_person)\n
\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
event.plan()\n
event.setDestinationValueList(person_list)\n
event.setSourceValue(user_person)\n
count = 1\n
\n \n
# Redirect to the event module (but is this the best place to go since events are not yet indexed ?)\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 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 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 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>
<item> <item>
<key> <string>_code</string> </key> <key> <string>_code</string> </key>
...@@ -122,7 +142,7 @@ context.Base_redirect(form_id, keep_items = dict(portal_status_message=portal_st ...@@ -122,7 +142,7 @@ context.Base_redirect(form_id, keep_items = dict(portal_status_message=portal_st
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <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>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -142,7 +162,7 @@ context.Base_redirect(form_id, keep_items = dict(portal_status_message=portal_st ...@@ -142,7 +162,7 @@ context.Base_redirect(form_id, keep_items = dict(portal_status_message=portal_st
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>9</int> </value> <value> <int>10</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
...@@ -155,6 +175,7 @@ context.Base_redirect(form_id, keep_items = dict(portal_status_message=portal_st ...@@ -155,6 +175,7 @@ context.Base_redirect(form_id, keep_items = dict(portal_status_message=portal_st
<string>selection_name</string> <string>selection_name</string>
<string>selection_index</string> <string>selection_index</string>
<string>follow_up</string> <string>follow_up</string>
<string>single_event</string>
<string>text_content</string> <string>text_content</string>
<string>form_id</string> <string>form_id</string>
<string>kw</string> <string>kw</string>
...@@ -170,6 +191,7 @@ context.Base_redirect(form_id, keep_items = dict(portal_status_message=portal_st ...@@ -170,6 +191,7 @@ context.Base_redirect(form_id, keep_items = dict(portal_status_message=portal_st
<string>person</string> <string>person</string>
<string>event</string> <string>event</string>
<string>_inplacevar_</string> <string>_inplacevar_</string>
<string>len</string>
<string>dict</string> <string>dict</string>
<string>portal_status_message</string> <string>portal_status_message</string>
<string>_apply_</string> <string>_apply_</string>
...@@ -184,7 +206,11 @@ context.Base_redirect(form_id, keep_items = dict(portal_status_message=portal_st ...@@ -184,7 +206,11 @@ context.Base_redirect(form_id, keep_items = dict(portal_status_message=portal_st
<item> <item>
<key> <string>func_defaults</string> </key> <key> <string>func_defaults</string> </key>
<value> <value>
<tuple>
<int>0</int>
<none/>
<none/> <none/>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
...@@ -103,6 +103,7 @@ ...@@ -103,6 +103,7 @@
<string>your_description</string> <string>your_description</string>
<string>your_direction</string> <string>your_direction</string>
<string>your_follow_up</string> <string>your_follow_up</string>
<string>your_single_event</string>
</list> </list>
</value> </value>
</item> </item>
......
<?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>
...@@ -3,11 +3,8 @@ ...@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="StateDefinition" module="Products.DCWorkflow.States"/>
<string>Products.DCWorkflow.States</string> <tuple/>
<string>StateDefinition</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
...@@ -40,6 +37,8 @@ ...@@ -40,6 +37,8 @@
<key> <string>transitions</string> </key> <key> <string>transitions</string> </key>
<value> <value>
<tuple> <tuple>
<string>delete</string>
<string>delete_action</string>
<string>order</string> <string>order</string>
<string>order_action</string> <string>order_action</string>
</tuple> </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