Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
slapos.core
Commits
df44db71
Commit
df44db71
authored
Apr 04, 2013
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to configure the email message sent.
parent
b006b7b8
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
275 additions
and
35 deletions
+275
-35
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Person_checkToCreateRegularisationRequest.xml
.../slapos_crm/Person_checkToCreateRegularisationRequest.xml
+16
-6
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_triggerAcknowledgmentEscalation.xml
...RegularisationRequest_triggerAcknowledgmentEscalation.xml
+16
-7
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_triggerDeleteReminderEscalation.xml
...RegularisationRequest_triggerDeleteReminderEscalation.xml
+15
-7
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_triggerStopAcknowledgmentEscalation.xml
...larisationRequest_triggerStopAcknowledgmentEscalation.xml
+15
-7
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_triggerStopReminderEscalation.xml
...m/RegularisationRequest_triggerStopReminderEscalation.xml
+15
-7
master/bt5/slapos_crm/TestTemplateItem/testSlapOSCRMSkins.py
master/bt5/slapos_crm/TestTemplateItem/testSlapOSCRMSkins.py
+197
-0
master/bt5/slapos_crm/bt/revision
master/bt5/slapos_crm/bt/revision
+1
-1
No files found.
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/Person_checkToCreateRegularisationRequest.xml
View file @
df44db71
...
...
@@ -101,10 +101,11 @@ if (ticket is None) and int(person.Entity_statBalance()) > 0:\n
\n
ticket.reindexObject(activate_kw={\'tag\': tag})\n
\n
mail_message = ticket.RegularisationRequest_checkToSendUniqEvent(\n
portal.portal_preferences.getPreferredRegularisationRequestResource(),\n
\'Invoice payment requested\',\n
"""Dear user,\n
notification_message = context.getPortalObject().portal_notifications.getDocumentValue(\n
reference="slapos-crm.create.regularisation.request")\n
if notification_message is None:\n
subject = \'Invoice payment requested\'\n
body = """Dear user,\n
\n
A new invoice has been generated. \n
You can access it in your invoice section at %s.\n
...
...
@@ -113,7 +114,16 @@ Do not hesitate to visit the web forum (http://community.slapos.org/forum) in ca
\n
Regards,\n
The slapos team\n
""" % portal.portal_preferences.getPreferredSlaposWebSiteUrl(),\n
""" % portal.portal_preferences.getPreferredSlaposWebSiteUrl()\n
\n
else:\n
subject = notification_message.getTitle()\n
body = notification_message.convert(format=\'text\')[1]\n
\n
mail_message = ticket.RegularisationRequest_checkToSendUniqEvent(\n
portal.portal_preferences.getPreferredRegularisationRequestResource(),\n
subject,\n
body,\n
\'Requested manual payment.\')\n
\n
return ticket, mail_message\n
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_triggerAcknowledgmentEscalation.xml
View file @
df44db71
...
...
@@ -54,12 +54,10 @@
if REQUEST is not None:\n
raise Unauthorized\n
\n
return context.RegularisationRequest_checkToTriggerNextEscalationStep(\n
38,\n
\'service_module/slapos_crm_acknowledgement\',\n
\'service_module/slapos_crm_stop_reminder\',\n
\'Reminder: invoice payment requested\',\n
"""Dear user,\n
notification_message = context.getPortalObject().portal_notifications.getDocumentValue(reference="slapos-crm.acknowledgment.escalation")\n
if notification_message is None:\n
subject = \'Reminder: invoice payment requested\'\n
body = """Dear user,\n
\n
We would like to remind you the unpaid invoice you have on %s.\n
If no payment is done during the coming days, we will stop all your current instances to free some hardware resources.\n
...
...
@@ -68,7 +66,18 @@ Do not hesitate to visit the web forum (http://community.slapos.org/forum) in ca
\n
Regards,\n
The slapos team\n
""" % context.getPortalObject().portal_preferences.getPreferredSlaposWebSiteUrl(),\n
""" % context.getPortalObject().portal_preferences.getPreferredSlaposWebSiteUrl()\n
\n
else:\n
subject = notification_message.getTitle()\n
body = notification_message.convert(format=\'text\')[1]\n
\n
return context.RegularisationRequest_checkToTriggerNextEscalationStep(\n
38,\n
\'service_module/slapos_crm_acknowledgement\',\n
\'service_module/slapos_crm_stop_reminder\',\n
subject,\n
body,\n
\'Stopping reminder.\',\n
)\n
</string>
</value>
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_triggerDeleteReminderEscalation.xml
View file @
df44db71
...
...
@@ -54,12 +54,10 @@
if REQUEST is not None:\n
raise Unauthorized\n
\n
return context.RegularisationRequest_checkToTriggerNextEscalationStep(\n
2,\n
\'service_module/slapos_crm_delete_reminder\',\n
\'service_module/slapos_crm_delete_acknowledgement\',\n
\'Acknowledgment: instances deleted\',\n
"""Dear user,\n
notification_message = context.getPortalObject().portal_notifications.getDocumentValue(reference="slapos-crm.delete.reminder.escalation")\n
if notification_message is None:\n
subject = \'Acknowledgment: instances deleted\'\n
body = """Dear user,\n
\n
Despite our last reminder, you still have an unpaid invoice on %s.\n
We will now delete all your instances.\n
...
...
@@ -68,7 +66,17 @@ Do not hesitate to visit the web forum (http://community.slapos.org/forum) in ca
\n
Regards,\n
The slapos team\n
""" % context.getPortalObject().portal_preferences.getPreferredSlaposWebSiteUrl(),\n
""" % context.getPortalObject().portal_preferences.getPreferredSlaposWebSiteUrl()\n
else:\n
subject = notification_message.getTitle()\n
body = notification_message.convert(format=\'text\')[1]\n
\n
return context.RegularisationRequest_checkToTriggerNextEscalationStep(\n
2,\n
\'service_module/slapos_crm_delete_reminder\',\n
\'service_module/slapos_crm_delete_acknowledgement\',\n
subject,\n
body,\n
\'Deleting acknowledgment.\',\n
)\n
</string>
</value>
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_triggerStopAcknowledgmentEscalation.xml
View file @
df44db71
...
...
@@ -54,12 +54,10 @@
if REQUEST is not None:\n
raise Unauthorized\n
\n
return context.RegularisationRequest_checkToTriggerNextEscalationStep(\n
13,\n
\'service_module/slapos_crm_stop_acknowledgement\',\n
\'service_module/slapos_crm_delete_reminder\',\n
\'Last reminder: invoice payment requested\',\n
"""Dear user,\n
notification_message = context.getPortalObject().portal_notifications.getDocumentValue(reference="slapos-crm.stop.acknowledgment.escalation")\n
if notification_message is None:\n
subject = \'Last reminder: invoice payment requested\'\n
body = """Dear user,\n
\n
We would like to remind you the unpaid invoice you have on %s.\n
If no payment is done during the coming days, we will delete all your instances.\n
...
...
@@ -68,7 +66,17 @@ Do not hesitate to visit the web forum (http://community.slapos.org/forum) in ca
\n
Regards,\n
The slapos team\n
""" % context.getPortalObject().portal_preferences.getPreferredSlaposWebSiteUrl(),\n
""" % context.getPortalObject().portal_preferences.getPreferredSlaposWebSiteUrl()\n
else:\n
subject = notification_message.getTitle()\n
body = notification_message.convert(format=\'text\')[1]\n
\n
return context.RegularisationRequest_checkToTriggerNextEscalationStep(\n
13,\n
\'service_module/slapos_crm_stop_acknowledgement\',\n
\'service_module/slapos_crm_delete_reminder\',\n
subject,\n
body,\n
\'Deleting reminder.\',\n
)\n
</string>
</value>
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_triggerStopReminderEscalation.xml
View file @
df44db71
...
...
@@ -54,12 +54,10 @@
if REQUEST is not None:\n
raise Unauthorized\n
\n
return context.RegularisationRequest_checkToTriggerNextEscalationStep(\n
7,\n
\'service_module/slapos_crm_stop_reminder\',\n
\'service_module/slapos_crm_stop_acknowledgement\',\n
\'Acknowledgment: instances stopped\',\n
"""Dear user,\n
notification_message = context.getPortalObject().portal_notifications.getDocumentValue(reference="slapos-crm.stop.reminder.escalation")\n
if notification_message is None:\n
subject = \'Acknowledgment: instances stopped\'\n
body = """Dear user,\n
\n
Despite our last reminder, you still have an unpaid invoice on %s.\n
We will now stop all your current instances to free some hardware resources.\n
...
...
@@ -68,7 +66,17 @@ Do not hesitate to visit the web forum (http://community.slapos.org/forum) in ca
\n
Regards,\n
The slapos team\n
""" % context.getPortalObject().portal_preferences.getPreferredSlaposWebSiteUrl(),\n
""" % context.getPortalObject().portal_preferences.getPreferredSlaposWebSiteUrl()\n
else:\n
subject = notification_message.getTitle()\n
body = notification_message.convert(format=\'text\')[1]\n
\n
return context.RegularisationRequest_checkToTriggerNextEscalationStep(\n
7,\n
\'service_module/slapos_crm_stop_reminder\',\n
\'service_module/slapos_crm_stop_acknowledgement\',\n
subject,\n
body,\n
\'Stopping acknowledgment.\',\n
)\n
</string>
</value>
...
...
master/bt5/slapos_crm/TestTemplateItem/testSlapOSCRMSkins.py
View file @
df44db71
...
...
@@ -89,6 +89,63 @@ The slapos team
expected_text_content
.
splitlines
())]))
self
.
assertEquals
(
event
.
getSimulationState
(),
'delivered'
)
@
simulate
(
'NotificationTool_getDocumentValue'
,
'reference=None'
,
'assert reference == "slapos-crm.create.regularisation.request"
\
n
'
\
'return context.restrictedTraverse('
\
'context.REQUEST["test_addRegularisationRequest_notification_message"])'
)
@
simulate
(
'Entity_statBalance'
,
'*args, **kwargs'
,
'return "1"'
)
def
test_addRegularisationRequest_notification_message
(
self
):
for
preference
in
\
self
.
portal
.
portal_catalog
(
portal_type
=
"System Preference"
):
preference
=
preference
.
getObject
()
if
preference
.
getPreferenceState
()
==
'global'
:
preference
.
setPreferredSlaposWebSiteUrl
(
'http://foobar.org/'
)
person
=
self
.
createPerson
()
new_id
=
self
.
generateNewId
()
notification_message
=
self
.
portal
.
notification_message_module
.
newContent
(
portal_type
=
"Notification Message"
,
title
=
'Test NM title %s'
%
new_id
,
text_content
=
'Test NM content<br/>%s<br/>'
%
new_id
,
content_type
=
'text/html'
,
)
self
.
portal
.
REQUEST
\
[
'test_addRegularisationRequest_notification_message'
]
=
\
notification_message
.
getRelativeUrl
()
before_date
=
DateTime
()
ticket
,
event
=
person
.
Person_checkToCreateRegularisationRequest
()
after_date
=
DateTime
()
self
.
assertEquals
(
ticket
.
getPortalType
(),
'Regularisation Request'
)
self
.
assertEquals
(
ticket
.
getSimulationState
(),
'suspended'
)
self
.
assertEquals
(
ticket
.
getSourceProject
(),
person
.
getRelativeUrl
())
self
.
assertEquals
(
ticket
.
getResource
(),
'service_module/slapos_crm_acknowledgement'
)
self
.
assertEquals
(
ticket
.
getTitle
(),
'Account regularisation expected for "%s"'
%
person
.
getTitle
())
self
.
assertEquals
(
ticket
.
getDestination
(),
person
.
getRelativeUrl
())
self
.
assertEquals
(
ticket
.
getDestinationDecision
(),
person
.
getRelativeUrl
())
self
.
assertEquals
(
event
.
getPortalType
(),
'Mail Message'
)
self
.
assertEquals
(
event
.
getResource
(),
'service_module/slapos_crm_acknowledgement'
)
self
.
assertTrue
(
event
.
getStartDate
()
>=
before_date
)
self
.
assertTrue
(
event
.
getStopDate
()
<=
after_date
)
self
.
assertEquals
(
event
.
getTitle
(),
'Test NM title %s'
%
new_id
)
self
.
assertEquals
(
event
.
getDestination
(),
person
.
getRelativeUrl
())
self
.
assertEquals
(
event
.
getSource
(),
ticket
.
getSource
())
expected_text_content
=
'Test NM content
\
n
%s
\
n
'
%
new_id
self
.
assertEquals
(
event
.
getTextContent
(),
expected_text_content
,
'
\
n
'
.
join
([
x
for
x
in
difflib
.
unified_diff
(
event
.
getTextContent
().
splitlines
(),
expected_text_content
.
splitlines
())]))
self
.
assertEquals
(
event
.
getSimulationState
(),
'delivered'
)
# def test_addRegularisationRequest_do_not_duplicate_ticket(self):
# person = self.createPerson()
...
...
@@ -855,6 +912,41 @@ The slapos team
'Stopping reminder.'
),
ticket
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
@
simulate
(
'NotificationTool_getDocumentValue'
,
'reference=None'
,
'assert reference == "slapos-crm.acknowledgment.escalation"
\
n
'
\
'return context.restrictedTraverse('
\
'context.REQUEST["test_checkToTriggerNextEscalationStep_notification_message"])'
)
@
simulate
(
'RegularisationRequest_checkToTriggerNextEscalationStep'
,
'day, current, next, title, text_content, comment, REQUEST=None'
,
'context.portal_workflow.doActionFor('
\
'context, action="edit_action", '
\
'comment="Visited by RegularisationRequest_checkToTriggerNextEscalationStep '
\
'%s %s %s %s %s %s" % (day, current, next, title, text_content, comment))'
)
def
test_checkToTriggerNextEscalationStep_notification_message
(
self
):
ticket
=
self
.
createRegularisationRequest
()
new_id
=
self
.
generateNewId
()
notification_message
=
self
.
portal
.
notification_message_module
.
newContent
(
portal_type
=
"Notification Message"
,
title
=
'Test NM title %s'
%
new_id
,
text_content
=
'Test NM content<br/>%s<br/>'
%
new_id
,
content_type
=
'text/html'
,
)
self
.
portal
.
REQUEST
\
[
'test_checkToTriggerNextEscalationStep_notification_message'
]
=
\
notification_message
.
getRelativeUrl
()
ticket
.
RegularisationRequest_triggerAcknowledgmentEscalation
()
self
.
assertEqual
(
'Visited by RegularisationRequest_checkToTriggerNextEscalationStep '
\
'%s %s %s %s %s %s'
%
\
(
38
,
'service_module/slapos_crm_acknowledgement'
,
'service_module/slapos_crm_stop_reminder'
,
'Test NM title %s'
%
new_id
,
'Test NM content
\
n
%s
\
n
'
%
new_id
,
'Stopping reminder.'
),
ticket
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
class
TestSlapOSRegularisationRequest_triggerStopReminderEscalation
(
testSlapOSMixin
):
...
...
@@ -906,6 +998,41 @@ The slapos team
'Stopping acknowledgment.'
),
ticket
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
@
simulate
(
'NotificationTool_getDocumentValue'
,
'reference=None'
,
'assert reference == "slapos-crm.stop.reminder.escalation"
\
n
'
\
'return context.restrictedTraverse('
\
'context.REQUEST["test_checkToTriggerNextEscalationStep_notification_message"])'
)
@
simulate
(
'RegularisationRequest_checkToTriggerNextEscalationStep'
,
'day, current, next, title, text_content, comment, REQUEST=None'
,
'context.portal_workflow.doActionFor('
\
'context, action="edit_action", '
\
'comment="Visited by RegularisationRequest_checkToTriggerNextEscalationStep '
\
'%s %s %s %s %s %s" % (day, current, next, title, text_content, comment))'
)
def
test_checkToTriggerNextEscalationStep_notification_message
(
self
):
ticket
=
self
.
createRegularisationRequest
()
new_id
=
self
.
generateNewId
()
notification_message
=
self
.
portal
.
notification_message_module
.
newContent
(
portal_type
=
"Notification Message"
,
title
=
'Test NM title %s'
%
new_id
,
text_content
=
'Test NM content<br/>%s<br/>'
%
new_id
,
content_type
=
'text/html'
,
)
self
.
portal
.
REQUEST
\
[
'test_checkToTriggerNextEscalationStep_notification_message'
]
=
\
notification_message
.
getRelativeUrl
()
ticket
.
RegularisationRequest_triggerStopReminderEscalation
()
self
.
assertEqual
(
'Visited by RegularisationRequest_checkToTriggerNextEscalationStep '
\
'%s %s %s %s %s %s'
%
\
(
7
,
'service_module/slapos_crm_stop_reminder'
,
'service_module/slapos_crm_stop_acknowledgement'
,
'Test NM title %s'
%
new_id
,
'Test NM content
\
n
%s
\
n
'
%
new_id
,
'Stopping acknowledgment.'
),
ticket
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
class
TestSlapOSRegularisationRequest_triggerStopAcknowledgmentEscalation
(
testSlapOSMixin
):
...
...
@@ -957,6 +1084,41 @@ The slapos team
'Deleting reminder.'
),
ticket
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
@
simulate
(
'NotificationTool_getDocumentValue'
,
'reference=None'
,
'assert reference == "slapos-crm.stop.acknowledgment.escalation"
\
n
'
\
'return context.restrictedTraverse('
\
'context.REQUEST["test_checkToTriggerNextEscalationStep_notification_message"])'
)
@
simulate
(
'RegularisationRequest_checkToTriggerNextEscalationStep'
,
'day, current, next, title, text_content, comment, REQUEST=None'
,
'context.portal_workflow.doActionFor('
\
'context, action="edit_action", '
\
'comment="Visited by RegularisationRequest_checkToTriggerNextEscalationStep '
\
'%s %s %s %s %s %s" % (day, current, next, title, text_content, comment))'
)
def
test_checkToTriggerNextEscalationStep_notification_message
(
self
):
ticket
=
self
.
createRegularisationRequest
()
new_id
=
self
.
generateNewId
()
notification_message
=
self
.
portal
.
notification_message_module
.
newContent
(
portal_type
=
"Notification Message"
,
title
=
'Test NM title %s'
%
new_id
,
text_content
=
'Test NM content<br/>%s<br/>'
%
new_id
,
content_type
=
'text/html'
,
)
self
.
portal
.
REQUEST
\
[
'test_checkToTriggerNextEscalationStep_notification_message'
]
=
\
notification_message
.
getRelativeUrl
()
ticket
.
RegularisationRequest_triggerStopAcknowledgmentEscalation
()
self
.
assertEqual
(
'Visited by RegularisationRequest_checkToTriggerNextEscalationStep '
\
'%s %s %s %s %s %s'
%
\
(
13
,
'service_module/slapos_crm_stop_acknowledgement'
,
'service_module/slapos_crm_delete_reminder'
,
'Test NM title %s'
%
new_id
,
'Test NM content
\
n
%s
\
n
'
%
new_id
,
'Deleting reminder.'
),
ticket
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
class
TestSlapOSRegularisationRequest_triggerDeleteReminderEscalation
(
testSlapOSMixin
):
...
...
@@ -1008,6 +1170,41 @@ The slapos team
'Deleting acknowledgment.'
),
ticket
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
@
simulate
(
'NotificationTool_getDocumentValue'
,
'reference=None'
,
'assert reference == "slapos-crm.delete.reminder.escalation"
\
n
'
\
'return context.restrictedTraverse('
\
'context.REQUEST["test_checkToTriggerNextEscalationStep_notification_message"])'
)
@
simulate
(
'RegularisationRequest_checkToTriggerNextEscalationStep'
,
'day, current, next, title, text_content, comment, REQUEST=None'
,
'context.portal_workflow.doActionFor('
\
'context, action="edit_action", '
\
'comment="Visited by RegularisationRequest_checkToTriggerNextEscalationStep '
\
'%s %s %s %s %s %s" % (day, current, next, title, text_content, comment))'
)
def
test_checkToTriggerNextEscalationStep_notification_message
(
self
):
ticket
=
self
.
createRegularisationRequest
()
new_id
=
self
.
generateNewId
()
notification_message
=
self
.
portal
.
notification_message_module
.
newContent
(
portal_type
=
"Notification Message"
,
title
=
'Test NM title %s'
%
new_id
,
text_content
=
'Test NM content<br/>%s<br/>'
%
new_id
,
content_type
=
'text/html'
,
)
self
.
portal
.
REQUEST
\
[
'test_checkToTriggerNextEscalationStep_notification_message'
]
=
\
notification_message
.
getRelativeUrl
()
ticket
.
RegularisationRequest_triggerDeleteReminderEscalation
()
self
.
assertEqual
(
'Visited by RegularisationRequest_checkToTriggerNextEscalationStep '
\
'%s %s %s %s %s %s'
%
\
(
2
,
'service_module/slapos_crm_delete_reminder'
,
'service_module/slapos_crm_delete_acknowledgement'
,
'Test NM title %s'
%
new_id
,
'Test NM content
\
n
%s
\
n
'
%
new_id
,
'Deleting acknowledgment.'
),
ticket
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
class
TestSlapOSRegularisationRequest_stopHostingSubscriptionList
(
testSlapOSMixin
):
...
...
master/bt5/slapos_crm/bt/revision
View file @
df44db71
19
\ No newline at end of file
20
\ No newline at end of file
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