diff --git a/bt5/erp5_free_subscription/SkinTemplateItem/portal_skins/erp5_free_subscription/FreeSubscriptionRequest_accept.xml b/bt5/erp5_free_subscription/SkinTemplateItem/portal_skins/erp5_free_subscription/FreeSubscriptionRequest_accept.xml index b9ef6fd9a52b0ce6d262ab3bf1870faca4032b15..d2ddb62ecc3e466547eb03ab90c1b4533721e98d 100644 --- a/bt5/erp5_free_subscription/SkinTemplateItem/portal_skins/erp5_free_subscription/FreeSubscriptionRequest_accept.xml +++ b/bt5/erp5_free_subscription/SkinTemplateItem/portal_skins/erp5_free_subscription/FreeSubscriptionRequest_accept.xml @@ -54,8 +54,27 @@ Intent is to ignore accept/accept race conditions but complain about\n any other race condition (ex: accept/reject).\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 </string> </value> </item> <item>