Commit 5b0da624 authored by Aurel's avatar Aurel

free subscription : some minor fixes + add interaction to generate reference

parent 5d873c30
...@@ -73,7 +73,7 @@ if user is None:\n ...@@ -73,7 +73,7 @@ if user is None:\n
event_id=request[\'id\'], \n event_id=request[\'id\'], \n
hmac=request["hash"])\n hmac=request["hash"])\n
\n \n
# serve the image\n # serve the web-page that will display a "Sucessfully unsubscribe" message\n
return context.index_html(request, request.RESPONSE, format=None)\n return context.index_html(request, request.RESPONSE, format=None)\n
</string> </value> </string> </value>
</item> </item>
......
...@@ -56,7 +56,7 @@ free_subscription = context.getPortalObject().free_subscription_module.newConten ...@@ -56,7 +56,7 @@ free_subscription = context.getPortalObject().free_subscription_module.newConten
destination_value=context,\n destination_value=context,\n
source=source,\n source=source,\n
resource=resource,\n resource=resource,\n
start_date=start_date,\n effective_date=start_date,\n
title=title)\n title=title)\n
\n \n
free_subscription.validate()\n free_subscription.validate()\n
......
...@@ -51,14 +51,23 @@ ...@@ -51,14 +51,23 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n <value> <string>portal = context.getPortalObject()\n
group_reference = context.getSourceValue().getGroupReference()\n if context.getSource():\n
counter = portal.portal_ids.generateNewId(\n if context.getPortalType() == "Free Subscription":\n
generator_base = "free_subscription"\n
reference_base = "FS"\n
elif context.getPortalType() == "Free Subscription Request":\n
generator_base = "free_subscription_request"\n
reference_base = "FSR"\n
else:\n
raise ValueError("Should not be called for %s" %(context.getPortalType(),))\n
group_reference = context.getSourceValue().getGroupReference()\n
counter = portal.portal_ids.generateNewId(\n
id_generator="uid",\n id_generator="uid",\n
id_group=\'.\'.join((\'free_subscription\', \'reference\', group_reference)),\n id_group=\'.\'.join((generator_base, \'reference\', group_reference)),\n
default=1)\n default=1)\n
\n \n
source_reference = \'FS-%s-%05d\' % (group_reference, counter)\n source_reference = \'%s-%s-%05d\' % (reference_base, group_reference, counter)\n
context.setReference(source_reference)\n context.setReference(source_reference)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
<?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>setReference</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>free_subscription_reference</string> </value>
</item>
<item>
<key> <string>method_id</string> </key>
<value>
<list>
<string>submit</string>
<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>
<string>Free Subscription Request</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>
...@@ -50,62 +50,16 @@ ...@@ -50,62 +50,16 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string>state_change[\'object\'].FreeSubscription_generateReference()\n
</string> </value>
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
kw[\'event_value_source_title\'] = event_value.getSourceTitle()\n
\n
if destination is not None:\n
kw[\'third_party_reference\'] = destination.getDestinationReference()\n
kw[\'address\'] = (destination.getDefaultAddressText() or \'\').upper()\n
kw[\'email\'] = destination.getDefaultEmailText() or \'\'\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
\n
if destination.getPortalType() == \'Person\':\n
kw[\'first_name\'] = destination.getFirstName()\n
kw[\'last_name\'] = destination.getLastName()\n
kw[\'social_title\'] = destination.getSocialTitleTranslatedTitle("")\n
kw[\'third_party_name\'] = destination.getTitle()\n
if destination.getSocialTitle():\n
kw[\'third_party_name\'] = "%s %s" % (destination.getSocialTitleTranslatedTitle() or \'\',\n
destination.getTitle())\n
elif destination.getPortalType() == \'Organisation\':\n
kw[\'social_title\'] = str(translateString("Participant"))\n
kw[\'third_party_name\'] = destination.getCorporateName() or destination.getTitle()\n
\n
kw[\'event_value_start_date\'] = event_value.getStartDate()\n
kw[\'event_value_nature\'] = event_value.getResourceReference()\n
kw[\'event_value_reference\'] = event_value.getReference()\n
kw[\'ticket_reference\'] = event_value.getDefaultFollowUpReference()\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
\n
return kw\n
\n
\n
with context.getPortalObject().Localizer.translationContext("fr"):\n
return getSubstitutionMappingDict()\n
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>event_value, **kw</string> </value> <value> <string>state_change, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>NotificationMessage_getSubstitutionMappingDictFromEvent</string> </value> <value> <string>setReference</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
0.1.1 0.2
\ No newline at end of file \ 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