Commit 86279fcd authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

erp5_free_subscription: Merge EOS work

* Add subscribe for Free Subscription Requests
* Various improvments
parent e0c95b82
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>product_line/subscription</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>subscription</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value> <string>Subscription</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Subscription</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>role/newsletter_subscriber</string>
</tuple>
</value>
</item>
<item>
<key> <string>codification</string> </key>
<value> <string>NEWSSUB</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>newsletter_subscriber</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Newsletter subscriber</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>use/crm/free_subscription</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>free_subscription</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value> <string>Free Subscription</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Free Subscription</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -2,6 +2,9 @@
<portal_type id="Free Subscription Module">
<item>Free Subscription</item>
</portal_type>
<portal_type id="Free Subscription Request">
<item>Email</item>
</portal_type>
<portal_type id="Free Subscription Request Module">
<item>Free Subscription Request</item>
</portal_type>
......
......@@ -6,6 +6,7 @@
<portal_type id="Free Subscription Request">
<item>Arrow</item>
<item>DublinCore</item>
<item>Person</item>
<item>Reference</item>
</portal_type>
</property_sheet_list>
\ No newline at end of file
......@@ -6,12 +6,33 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>business_template_skin_layer_priority</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>float</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>business_template_skin_layer_priority</string> </key>
<value> <float>50.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>erp5_free_subscription</string> </value>
......
......@@ -51,38 +51,50 @@
<item>
<key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n
if portal.Base_getHMACHexdigest(portal.Base_getEventHMACKey(), event_id) != hmac:\n
from zExceptions import Unauthorized\n
raise Unauthorized\n
\n
event = portal.event_module[event_id]\n
\n
# First create a request\n
request = portal.free_subscription_request_module.newContent(\n
source=event.getSource(),\n
destination=event.getDestination(),\n
resource = event.getResource(),\n
free_subscription_request_type="unsubscription",\n
causality_value=event,\n
)\n
if subscription_type == "unsubscription":\n
if portal.Base_getHMACHexdigest(portal.Base_getEventHMACKey(), event_id) != hmac:\n
from zExceptions import Unauthorized\n
raise Unauthorized\n
\n
event = portal.event_module[event_id]\n
\n
# First create a request\n
request = portal.free_subscription_request_module.newContent(\n
source=event.getSource(),\n
destination=event.getDestination(),\n
resource = event.getResource(),\n
free_subscription_request_type="unsubscription",\n
causality_value=event,\n
default_email_coordinate_text=event.getDestinationValue().getDefaultEmailCoordinateText(),\n
)\n
\n
free_subscription_list = portal.portal_catalog(portal_type="Free Subscription",\n
default_resource_uid=event.getResourceUid(),\n
default_source_uid=event.getSourceUid(),\n
default_destination_uid=event.getDestinationUid())\n
\n
free_subscription_list = portal.portal_catalog(portal_type="Free Subscription",\n
default_resource_uid=event.getResourceUid(),\n
default_source_uid=event.getSourceUid(),\n
default_destination_uid=event.getDestinationUid())\n
if len(free_subscription_list) != 1:\n
raise ValueError("Impossible to find the free subscription (%d)" %\n
(len(free_subscription_list)))\n
free_subscription = free_subscription_list[0].getObject()\n
request.setFollowUpValue(free_subscription)\n
\n
if len(free_subscription_list) != 1:\n
raise ValueError("Impossible to find the free subscription (%d)" %\n
(len(free_subscription_list)))\n
free_subscription = free_subscription_list[0].getObject()\n
request.setFollowUpValue(free_subscription)\n
else:\n
request = portal.free_subscription_request_module.newContent(\n
source=source,\n
destination=destination,\n
resource=resource,\n
free_subscription_request_type="subscription",\n
causality=causality,\n
default_email_coordinate_text=portal.restrictedTraverse(destination).getDefaultEmailCoordinateText(),\n
)\n
\n
request.submit()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>event_id, hmac</string> </value>
<value> <string>causality=None, resource=None, destination=None, source=None, event_id=None, hmac=None, subscription_type="unsubscription"</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......
......@@ -57,24 +57,21 @@ portal = context.getPortalObject()\n
request = context.REQUEST\n
event_id = request[\'id\']\n
\n
user = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
# If we have a logged in user it\'s probably a backoffice agent.\n
if user is None:\n
# If the referer contains the url of the event we are probably viewing the event\n
# from ERP5 interface. We do not want to mark the event as delivered in that case\n
# It can also be from fckeditor, in this case we don\'t have the event url in REFERER.\n
if not ( (\'/event_module/%s\' % event_id) in request.HTTP_REFERER or \'fckeditor\' in request.HTTP_REFERER):\n
if portal.Base_getHMACHexdigest(portal.Base_getEventHMACKey(), event_id) != request["hash"]:\n
from zExceptions import Unauthorized\n
raise Unauthorized()\n
\n
portal.portal_activities.activate(\n
activity="SQLQueue").Base_createFreeSubscriptionRequest(\n
event_id=request[\'id\'], \n
hmac=request["hash"])\n
# If the referer contains the url of the event we are probably viewing the event\n
# from ERP5 interface. We do not want to mark the event as delivered in that case\n
# It can also be from fckeditor, in this case we don\'t have the event url in REFERER.\n
if not ( (\'/event_module/%s\' % event_id) in request.HTTP_REFERER or \'fckeditor\' in request.HTTP_REFERER):\n
if portal.Base_getHMACHexdigest(portal.Base_getEventHMACKey(), event_id) != request["hash"]:\n
from zExceptions import Unauthorized\n
raise Unauthorized()\n
\n
portal.portal_activities.activate(\n
activity="SQLQueue").Base_createFreeSubscriptionRequest(\n
event_id=request[\'id\'], \n
hmac=request["hash"])\n
\n
# serve the web-page that will display a "Sucessfully unsubscribe" message\n
return context.index_html(request, request.RESPONSE, format=None)\n
# serve the image\n
  • Is there an image there ? I also feel the comment above is copy paste

  • That script is called on an image, so serving the content with format=None migth result in a failure

Please register or sign in to reply
return context.Base_redirect(\'\')\n
</string> </value>
</item>
<item>
......
......@@ -57,6 +57,7 @@ free_subscription = context.getPortalObject().free_subscription_module.newConten
source=source,\n
resource=resource,\n
effective_date=start_date,\n
start_date=start_date,\n
Please register or sign in to reply
title=title)\n
\n
free_subscription.validate()\n
......
......@@ -10,6 +10,7 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>all_columns</string>
<string>columns</string>
<string>selection_name</string>
<string>title</string>
......@@ -73,6 +74,17 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>all_columns</string> </key>
<value>
<list>
<tuple>
<string>default_email_coordinate_text</string>
<string>Recipient Email</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>columns</string> </key>
<value>
......@@ -97,6 +109,10 @@
<string>translated_validation_state_title</string>
<string>State</string>
</tuple>
<tuple>
<string>creation_date</string>
<string>Creation Date</string>
</tuple>
</list>
</value>
</item>
......
......@@ -54,8 +54,42 @@
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 not context.getReference():\n
context.FreeSubscriptionRequest_generateReference()\n
if context.getValidationState() != \'submitted\':\n
return\n
person = context.getDestinationValue()\n
if person:\n
email = person.getDefaultEmailCoordinateText()\n
if email and not context.getDefaultEmailCoordinateText(): # XXX workaround to fill the email field if not already set\n
context.setDefaultEmailCoordinateText(email)\n
context.accept()\n
elif context.getDefaultEmailCoordinateText():\n
email = context.getDefaultEmailCoordinateText()\n
portal = context.getPortalObject()\n
person = portal.portal_catalog.getResultValue(\n
portal_type="Person",\n
reference=email,\n
Please register or sign in to reply
)\n
if person:\n
context.reject(comment="Person already in the user data base")\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
portal_type="Person",\n
default_email_text=email,\n
title=email,\n
)\n
person.validate()\n
elif person.getReference():\n
context.reject(comment="Person already in the user data base")\n
return\n
context.setDestination(person.getRelativeUrl())\n
context.accept()\n
</string> </value>
</item>
<item>
......
......@@ -62,6 +62,8 @@ if context.getSource():\n
\n
source_reference = \'%s-%s-%05d\' % (reference_base, group_reference, counter)\n
context.setReference(source_reference)\n
if not context.getTitle():\n
context.setTitle(source_reference)\n
</string> </value>
</item>
<item>
......
......@@ -79,6 +79,8 @@
<string>my_resource_title</string>
<string>my_causality_title</string>
<string>my_follow_up_title</string>
<string>my_default_email_coordinate_text</string>
<string>my_default_email_url_string</string>
</list>
</value>
</item>
......
......@@ -112,6 +112,10 @@
<string>Event</string>
<string>Event</string>
</tuple>
<tuple>
<string>Credential Request</string>
<string>Credential Request</string>
</tuple>
</list>
</value>
</item>
......@@ -121,7 +125,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Event</string> </value>
<value> <string>Causality</string> </value>
</item>
</dictionary>
</value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>enabled</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_default_email_coordinate_text</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>enabled</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_email</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: (here.hasDefaultEmail() and not here.getDefaultEmail().isDetailed()) or not here.hasDefaultEmail()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>enabled</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_default_email_url_string</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>enabled</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_email_url_string</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewBaseFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python:here.hasDefaultEmail() and here.getDefaultEmail().isDetailed()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -62,6 +62,8 @@ if context.getSource():\n
\n
source_reference = \'%s-%s-%05d\' % (reference_base, group_reference, counter)\n
context.setReference(source_reference)\n
if not context.getTitle():\n
context.setTitle(source_reference)\n
</string> </value>
</item>
<item>
......
......@@ -54,7 +54,6 @@
  • Not sure it is good to include such script in free subscription. My concern is just that the name does not have any context;

  • Same script exists in erp5_crm

Please register or sign in to reply
from Products.ERP5Type.Message import translateString\n
portal = context.getPortalObject()\n
format_address = portal.ERP5Site_formatFrenchAddressText\n
\n
def getSubstitutionMappingDict():\n
destination = event_value.getDestinationValue()\n
......@@ -67,7 +66,7 @@ def getSubstitutionMappingDict():\n
kw[\'telephone\'] = destination.getDefaultTelephoneText() or \'\'\n
kw[\'mobile\'] = destination.getMobileTelephoneText() or \'\'\n
kw[\'creation_date\'] = destination.getCreationDate()\n
kw[\'origin_campaign\'] = destination.getOriginReference()\n
#kw[\'origin_campaign\'] = destination.getOriginReference()\n
\n
if destination.getPortalType() == \'Person\':\n
kw[\'first_name\'] = destination.getFirstName()\n
......@@ -88,7 +87,7 @@ def getSubstitutionMappingDict():\n
hmac = portal.Base_getHMACHexdigest(key=portal.Base_getEventHMACKey(), message=event_value.getId())\n
kw["image_parameters"] = "/Base_openEvent?id=%s&hash=%s" %(event_value.getId(), hmac)\n
kw["newsletter_parameters"] = "/Base_readEvent?id=%s&hash=%s" %(event_value.getId(), hmac)\n
kw["unsubscribe_parameters"] = "/Base_unsubscribe?id=%s&hash=%s" %(event_value.getId(), hmac)\n
kw["unsubscribe_parameters"] = "/Base_unsubscribeFromEvent?id=%s&hash=%s" %(event_value.getId(), hmac)\n
\n
return kw\n
\n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="InteractionDefinition" module="Products.ERP5.Interaction"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>activate_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value>
<list>
<string>FreeSubscription_updateReference</string>
</list>
</value>
</item>
<item>
<key> <string>before_commit_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>validate_free_subscription</string> </value>
</item>
<item>
<key> <string>method_id</string> </key>
<value>
<list>
<string>validate</string>
</list>
</value>
</item>
<item>
<key> <string>once_per_transaction</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>portal_type_filter</string> </key>
<value>
<list>
<string>Free Subscription</string>
</list>
</value>
</item>
<item>
<key> <string>portal_type_group_filter</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>temporary_document_disallowed</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>free_subscription = state_change["object"]\n
\n
free_subscription.FreeSubscription_generateReference()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>FreeSubscription_updateReference</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -59,13 +59,18 @@ if request.getFreeSubscriptionRequestType() == "unsubscription":\n
elif request.getFreeSubscriptionRequestType() == "subscription":\n
from DateTime import DateTime\n
portal = request.getPortalObject()\n
destination_value = request.getDestinationValue()\n
free_subscription = portal.free_subscription_module.newContent(\n
source=request.getSource(),\n
destination=request.getDestination(),\n
destination_value=destination_value,\n
resource=request.getResource(),\n
effective_date=DateTime())\n
free_subscription.validate()\n
request.setFollowUpValue(free_subscription)\n
career_role_list = destination_value.getCareerRoleList([])\n
if not any([x.split("/")[0] == "newsletter_subscriber" for x in career_role_list]):\n
career_role_list.append(\'newsletter_subscriber\')\n
destination_value.setCareerRoleList(career_role_list)\n
</string> </value>
</item>
<item>
......
free_subscription_request_type
\ No newline at end of file
free_subscription_request_type
product_line/subscription
role/newsletter_subscriber
use/crm/free_subscription
\ No newline at end of file
Free Subscription Module | Free Subscription
Free Subscription Request Module | Free Subscription Request
\ No newline at end of file
Free Subscription Request Module | Free Subscription Request
Free Subscription Request | Email
\ No newline at end of file
Free Subscription Request | Arrow
Free Subscription Request | DublinCore
Free Subscription Request | Person
Free Subscription Request | Reference
Free Subscription Request | Reference
Free Subscription | DublinCore
Free Subscription | Version
\ No newline at end of file
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