Commit 8041cb36 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

erp5_free_subscription: Do not add Free Subscription Request to a user but can...

erp5_free_subscription: Do not add Free Subscription Request to a user but can be added to a person with the same email
parent ecb22e5e
...@@ -61,18 +61,26 @@ if context.getDestination():\n ...@@ -61,18 +61,26 @@ if context.getDestination():\n
elif context.getDefaultEmailCoordinateText():\n elif context.getDefaultEmailCoordinateText():\n
email = context.getDefaultEmailCoordinateText()\n email = context.getDefaultEmailCoordinateText()\n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
person_list = portal.portal_catalog.getResultValue(\n person = portal.portal_catalog.getResultValue(\n
portal_type="Person",\n portal_type="Person",\n
reference=email,\n reference=email,\n
)\n )\n
if person_list:\n if person:\n
context.reject(comment="Person already in the user data base")\n context.reject(comment="Person already in the user data base")\n
else:\n else:\n
person = portal.portal_catalog.getResultValue(\n
portal_type="Person",\n
default_email_text=email,\n
)\n
if not person:\n
person = portal.person_module.newContent(\n person = portal.person_module.newContent(\n
portal_type="Person",\n portal_type="Person",\n
default_email_text=email,\n default_email_text=email,\n
title=email,\n title=email,\n
)\n )\n
elif person.getReference():\n
context.reject(comment="Person already in the user data base")\n
return\n
context.setDestination(person.getRelativeUrl())\n context.setDestination(person.getRelativeUrl())\n
context.accept()\n context.accept()\n
</string> </value> </string> </value>
......
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