Commit 3270183e authored by Sebastien Robin's avatar Sebastien Robin

erp5_crm: add batch_mode to PersonModule_newEvent to allow calls from another script

parent 7b740018
...@@ -68,6 +68,7 @@ if not person_list:\n ...@@ -68,6 +68,7 @@ if not person_list:\n
user = context.portal_membership.getAuthenticatedMember()\n user = context.portal_membership.getAuthenticatedMember()\n
user_person = context.portal_catalog.getResultValue(portal_type=\'Person\', reference=str(user))\n user_person = context.portal_catalog.getResultValue(portal_type=\'Person\', reference=str(user))\n
\n \n
event_list = []\n
# For every person, create an event\n # For every person, create an event\n
if not single_event:\n if not single_event:\n
count = 0\n count = 0\n
...@@ -88,6 +89,7 @@ if not single_event:\n ...@@ -88,6 +89,7 @@ if not single_event:\n
event.setDestinationValue(person.getObject())\n event.setDestinationValue(person.getObject())\n
event.setSourceValue(user_person)\n event.setSourceValue(user_person)\n
event.plan()\n event.plan()\n
event_list.append(event)\n
else:\n else:\n
if direction == \'incoming\' and len(person_list) > 1:\n if direction == \'incoming\' and len(person_list) > 1:\n
# This case is not possible\n # This case is not possible\n
...@@ -104,6 +106,10 @@ else:\n ...@@ -104,6 +106,10 @@ else:\n
event.setSourceValue(user_person)\n event.setSourceValue(user_person)\n
event.plan()\n event.plan()\n
count = 1\n count = 1\n
event_list.append(event)\n
\n
if batch_mode:\n
return event_list\n
\n \n
portal_status_message = translateString("Created and associated ${count} new events to the selected ticket.", \n portal_status_message = translateString("Created and associated ${count} new events to the selected ticket.", \n
mapping=dict(count=count))\n mapping=dict(count=count))\n
...@@ -115,7 +121,7 @@ context.Base_redirect(form_id, keep_items = dict(portal_status_message=portal_st ...@@ -115,7 +121,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, follow_up=None, single_event=0, text_content=None, form_id=None, **kw</string> </value> <value> <string>portal_type, title, description, direction, selection_name, follow_up=None, single_event=0, text_content=None, form_id=None, batch_mode=0, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
662 663
\ No newline at end of file \ No newline at end of file
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