From 276d83337877a2eacb0fbed9c3c4790dfc13f4c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Le=20Ninivin?= <cedric.leninivin@tiolive.com> Date: Wed, 17 Jun 2015 08:30:48 +0000 Subject: [PATCH] erp5_free_sbscription: handle free subscription for anonymous --- .../FreeSubscriptionRequest_accept.xml | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) 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 b9ef6fd9a5..d2ddb62ecc 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> -- 2.30.9