Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Hardik Juneja
erp5
Commits
dd8f8c89
Commit
dd8f8c89
authored
Jun 11, 2015
by
Aurel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
free subscription : test reference initialization & make it customizable easily
parent
10d66803
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
218 additions
and
11 deletions
+218
-11
bt5/erp5_free_subscription/PortalTypePropertySheetTemplateItem/property_sheet_list.xml
...rtalTypePropertySheetTemplateItem/property_sheet_list.xml
+1
-0
bt5/erp5_free_subscription/SkinTemplateItem/portal_skins/erp5_free_subscription/FreeSubscriptionRequest_generateReference.xml
...ubscription/FreeSubscriptionRequest_generateReference.xml
+86
-0
bt5/erp5_free_subscription/SkinTemplateItem/portal_skins/erp5_free_subscription/FreeSubscription_generateReference.xml
..._free_subscription/FreeSubscription_generateReference.xml
+3
-9
bt5/erp5_free_subscription/SkinTemplateItem/portal_skins/erp5_free_subscription/NotificationMessage_getSubstitutionMappingDictFromEvent.xml
...tificationMessage_getSubstitutionMappingDictFromEvent.xml
+113
-0
bt5/erp5_free_subscription/WorkflowTemplateItem/portal_workflow/free_subscription_interaction_workflow/scripts/setReference.xml
...ubscription_interaction_workflow/scripts/setReference.xml
+9
-1
bt5/erp5_free_subscription/bt/template_portal_type_property_sheet_list
..._subscription/bt/template_portal_type_property_sheet_list
+1
-0
product/ERP5/tests/testFreeSubscription.py
product/ERP5/tests/testFreeSubscription.py
+5
-1
No files found.
bt5/erp5_free_subscription/PortalTypePropertySheetTemplateItem/property_sheet_list.xml
View file @
dd8f8c89
...
@@ -6,5 +6,6 @@
...
@@ -6,5 +6,6 @@
<portal_type
id=
"Free Subscription Request"
>
<portal_type
id=
"Free Subscription Request"
>
<item>
Arrow
</item>
<item>
Arrow
</item>
<item>
DublinCore
</item>
<item>
DublinCore
</item>
<item>
Reference
</item>
</portal_type>
</portal_type>
</property_sheet_list>
</property_sheet_list>
\ No newline at end of file
bt5/erp5_free_subscription/SkinTemplateItem/portal_skins/erp5_free_subscription/FreeSubscriptionRequest_generateReference.xml
0 → 100644
View file @
dd8f8c89
<?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>
portal = context.getPortalObject()\n
if context.getSource():\n
generator_base = "free_subscription_request"\n
reference_base = "FSR"\n
group_reference = context.getSourceValue().getGroupReference("")\n
counter = portal.portal_ids.generateNewId(\n
id_generator="uid",\n
id_group=\'.\'.join((generator_base, \'reference\', group_reference)),\n
default=1)\n
\n
source_reference = \'%s-%s-%05d\' % (reference_base, group_reference, counter)\n
context.setReference(source_reference)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Assignor
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
FreeSubscriptionRequest_generateReference
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_free_subscription/SkinTemplateItem/portal_skins/erp5_free_subscription/FreeSubscription_generateReference.xml
View file @
dd8f8c89
...
@@ -52,15 +52,9 @@
...
@@ -52,15 +52,9 @@
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
<value>
<string>
portal = context.getPortalObject()\n
if context.getSource():\n
if context.getSource():\n
if context.getPortalType() == "Free Subscription":\n
generator_base = "free_subscription"\n
generator_base = "free_subscription"\n
reference_base = "FS"\n
reference_base = "FS"\n
group_reference = context.getSourceValue().getGroupReference("")\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
counter = portal.portal_ids.generateNewId(\n
id_generator="uid",\n
id_generator="uid",\n
id_group=\'.\'.join((generator_base, \'reference\', group_reference)),\n
id_group=\'.\'.join((generator_base, \'reference\', group_reference)),\n
...
...
bt5/erp5_free_subscription/SkinTemplateItem/portal_skins/erp5_free_subscription/NotificationMessage_getSubstitutionMappingDictFromEvent.xml
0 → 100644
View file @
dd8f8c89
<?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
encoding=
"cdata"
>
<![CDATA[
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>
<key>
<string>
_params
</string>
</key>
<value>
<string>
event_value, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
NotificationMessage_getSubstitutionMappingDictFromEvent
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_free_subscription/WorkflowTemplateItem/portal_workflow/free_subscription_interaction_workflow/scripts/setReference.xml
View file @
dd8f8c89
...
@@ -50,13 +50,21 @@
...
@@ -50,13 +50,21 @@
</item>
</item>
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
state_change[\'object\'].
FreeSubscription_generateReference
()\n
<value>
<string>
state_change[\'object\'].
getTypeBasedMethod(\'generateReference\')
()\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change, **kw
</string>
</value>
<value>
<string>
state_change, **kw
</string>
</value>
</item>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Assignor
</string>
</tuple>
</value>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
setReference
</string>
</value>
<value>
<string>
setReference
</string>
</value>
...
...
bt5/erp5_free_subscription/bt/template_portal_type_property_sheet_list
View file @
dd8f8c89
Free Subscription Request | Arrow
Free Subscription Request | Arrow
Free Subscription Request | DublinCore
Free Subscription Request | DublinCore
Free Subscription Request | Reference
Free Subscription | DublinCore
Free Subscription | DublinCore
Free Subscription | Version
Free Subscription | Version
\ No newline at end of file
product/ERP5/tests/testFreeSubscription.py
View file @
dd8f8c89
...
@@ -46,7 +46,7 @@ if use_verbose_security:
...
@@ -46,7 +46,7 @@ if use_verbose_security:
class
TestFreeSubscription
(
ERP5TypeTestCase
):
class
TestFreeSubscription
(
ERP5TypeTestCase
):
def
getTitle
(
self
):
def
getTitle
(
self
):
return
"
ERP5 Credential
"
return
"
Free Subscription
"
def
getBusinessTemplateList
(
self
):
def
getBusinessTemplateList
(
self
):
return
(
return
(
...
@@ -101,6 +101,7 @@ class TestFreeSubscription(ERP5TypeTestCase):
...
@@ -101,6 +101,7 @@ class TestFreeSubscription(ERP5TypeTestCase):
self
.
portal
.
getDefaultModule
(
'Free Subscription'
),
self
.
portal
.
getDefaultModule
(
'Free Subscription'
),
self
.
portal
.
getDefaultModule
(
'Organisation'
),
self
.
portal
.
getDefaultModule
(
'Organisation'
),
self
.
portal
.
getDefaultModule
(
'Service'
),
self
.
portal
.
getDefaultModule
(
'Service'
),
self
.
portal
.
getDefaultModule
(
'Letter'
),
self
.
portal
.
getDefaultModule
(
'Person'
))
self
.
portal
.
getDefaultModule
(
'Person'
))
for
module
in
module_list
:
for
module
in
module_list
:
module
.
manage_delObjects
(
list
(
module
.
objectIds
()))
module
.
manage_delObjects
(
list
(
module
.
objectIds
()))
...
@@ -166,6 +167,7 @@ class TestFreeSubscription(ERP5TypeTestCase):
...
@@ -166,6 +167,7 @@ class TestFreeSubscription(ERP5TypeTestCase):
self
.
assertNotEquals
(
request
.
getFollowUp
(),
None
)
self
.
assertNotEquals
(
request
.
getFollowUp
(),
None
)
subscription
=
request
.
getFollowUpValue
()
subscription
=
request
.
getFollowUpValue
()
self
.
assertEquals
(
subscription
.
getValidationState
(),
"validated"
)
self
.
assertEquals
(
subscription
.
getValidationState
(),
"validated"
)
self
.
assertNotEquals
(
subscription
.
getReference
(),
None
)
def
stepSubmitFreeSubscriptionRequest
(
self
,
sequence
=
None
,
sequence_list
=
None
):
def
stepSubmitFreeSubscriptionRequest
(
self
,
sequence
=
None
,
sequence_list
=
None
):
request
=
sequence
[
'free_subscription_request'
]
request
=
sequence
[
'free_subscription_request'
]
...
@@ -174,6 +176,7 @@ class TestFreeSubscription(ERP5TypeTestCase):
...
@@ -174,6 +176,7 @@ class TestFreeSubscription(ERP5TypeTestCase):
def
stepCheckSubmittedFreeSubscriptionRequest
(
self
,
sequence
=
None
,
sequence_list
=
None
):
def
stepCheckSubmittedFreeSubscriptionRequest
(
self
,
sequence
=
None
,
sequence_list
=
None
):
request
=
sequence
[
'free_subscription_request'
]
request
=
sequence
[
'free_subscription_request'
]
self
.
assertEquals
(
request
.
getValidationState
(),
'submitted'
)
self
.
assertEquals
(
request
.
getValidationState
(),
'submitted'
)
self
.
assertNotEquals
(
request
.
getReference
(),
None
)
def
stepAcceptFreeSubscriptionRequest
(
self
,
sequence
=
None
,
sequence_list
=
None
):
def
stepAcceptFreeSubscriptionRequest
(
self
,
sequence
=
None
,
sequence_list
=
None
):
request
=
sequence
[
'free_subscription_request'
]
request
=
sequence
[
'free_subscription_request'
]
...
@@ -182,6 +185,7 @@ class TestFreeSubscription(ERP5TypeTestCase):
...
@@ -182,6 +185,7 @@ class TestFreeSubscription(ERP5TypeTestCase):
def
stepCheckAcceptedFreeSubscriptionRequest
(
self
,
sequence
=
None
,
sequence_list
=
None
):
def
stepCheckAcceptedFreeSubscriptionRequest
(
self
,
sequence
=
None
,
sequence_list
=
None
):
request
=
sequence
[
'free_subscription_request'
]
request
=
sequence
[
'free_subscription_request'
]
self
.
assertEquals
(
request
.
getValidationState
(),
'accepted'
)
self
.
assertEquals
(
request
.
getValidationState
(),
'accepted'
)
self
.
assertNotEquals
(
request
.
getReference
(),
None
)
def
stepRejectFreeSubscriptionRequest
(
self
,
sequence
=
None
,
sequence_list
=
None
):
def
stepRejectFreeSubscriptionRequest
(
self
,
sequence
=
None
,
sequence_list
=
None
):
request
=
sequence
[
'free_subscription_request'
]
request
=
sequence
[
'free_subscription_request'
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment