Commit 276d8333 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

erp5_free_sbscription: handle free subscription for anonymous

parent edecf807
...@@ -54,7 +54,26 @@ ...@@ -54,7 +54,26 @@
Intent is to ignore accept/accept race conditions but complain about\n Intent is to ignore accept/accept race conditions but complain about\n
any other race condition (ex: accept/reject).\n any other race condition (ex: accept/reject).\n
"""\n """\n
if context.getValidationState() != \'accepted\':\n if context.getValidationState() != \'submitted\':\n
return\n
if context.getDestination():\n
context.accept()\n
elif hasattr(context, \'destination_person_default_email_text\'):\n
email = context.destination_person_default_email_text\n
portal = context.getPortalObject()\n
person_list = portal.portal_catalog.getResultValue(\n
portal_type="Person",\n
default_email_text=email,\n
)\n
if person_list:\n
context.reject(comment="Person already in the user data base")\n
else:\n
person = portal.person_module.newContent(\n
portal_type="Person",\n
default_email_text=email,\n
title=email,\n
)\n
context.setDestination(person.getRelativeUrl())\n
context.accept()\n context.accept()\n
</string> </value> </string> </value>
</item> </item>
......
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