Commit 8350fbd6 authored by Jérome Perrin's avatar Jérome Perrin

CRM: generate a new reference on cloned events

parent efaee02a
......@@ -63,8 +63,9 @@ content_dict[\'destination_list\'] = content_dict.get(\'destination_list\', [])
content_dict[\'source_list\'] = content_dict.get(\'source_list\', []) + \\\n
[x.getRelativeUrl() for x in context.getSourceValueList() \\\n
if x.getRelativeUrl() not in content_dict.get(\'source_list\', [])]\n
\n
context.edit(**content_dict)\n
# reset reference\n
context.Event_generateReference()\n
</string> </value>
</item>
<item>
......
<?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>"""Owner Proxy Role allows anonymous users to create events\n
through web sites. cf. Event_init\n
"""\n
portal = context.getPortalObject()\n
type_definition = context.getTypeInfo()\n
\n
short_portal_type = type_definition.getShortTitle()\n
if not short_portal_type:\n
short_portal_type = \'\'.join(s for s in type_definition.getId() if s.isupper())\n
\n
new_id = portal.portal_ids.generateNewId(id_group=repr((\'reference\', short_portal_type)), default=1)\n
reference = \'%s-%s\' % (short_portal_type, new_id)\n
\n
context.setReference(reference)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Event_generateReference</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -52,23 +52,11 @@
<key> <string>_body</string> </key>
<value> <string>"""Owner Proxy Role allows anonymous users to create events\n
through web sites.\n
\n
Reference will be probably generated with dedicated tool\n
in near future\n
"""\n
portal = context.getPortalObject()\n
type_definition = context.getTypeInfo()\n
\n
short_portal_type = type_definition.getShortTitle()\n
if not short_portal_type:\n
short_portal_type = \'\'.join(s for s in type_definition.getId() if s.isupper())\n
\n
new_id = portal.portal_ids.generateNewId(id_group=repr((\'reference\', short_portal_type)), default=1)\n
reference = \'%s-%s\' % (short_portal_type, new_id)\n
\n
# Set preferred text format and reference\n
context.setContentType(context.portal_preferences.getPreferredTextFormat())\n
context.setReference(reference)\n
context.setContentType(portal.portal_preferences.getPreferredTextFormat())\n
context.Event_generateReference()\n
</string> </value>
</item>
<item>
......
......@@ -725,6 +725,9 @@ class TestCRMMailIngestion(BaseTestCRM):
self.assertEquals(new_event.getDestinationList(), ['person_module/me',
'person_module/he'])
# cloned event got a new reference
self.assertNotEqual(new_event.getReference(), event.getReference())
def test_follow_up(self):
# follow up is found automatically, based on the content of the mail, and
# what you defined in preference regexpr.
......@@ -1575,6 +1578,7 @@ class TestCRMMailSend(BaseTestCRM):
self.assertEquals(new_event.getData(), '')
self.assertEquals(new_event.getTitle(), real_title)
self.assertEquals(new_event.getTextContent(), real_content)
self.assertNotEquals(new_event.getReference(), event.getReference())
def test_cloneTicketAndEventList(self):
"""
......
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