Commit 0bfe0d03 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: Extend requestEvent accept the sender

   Since the ticket could be seen by multiple users, don't force sender be the Ticket owner.
parent ff26d148
......@@ -97,6 +97,8 @@ class TestSlapOSCoreTicketSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertRaises(TypeError, self.support_request.requestEvent)
self.assertRaises(TypeError, self.support_request.requestEvent, event_title="A")
self.assertRaises(TypeError, self.support_request.requestEvent, event_content="A")
self.assertRaises(TypeError, self.support_request.requestEvent, event_source="A")
def test_SupportRequest_requestEvent(self):
person = self.portal.portal_membership.getAuthenticatedMember().getUserValue()
......@@ -109,8 +111,8 @@ class TestSlapOSCoreTicketSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.support_request.requestEvent(
event_title="A",
event_content="B"
)
event_content="B",
event_source=person.getRelativeUrl())
self.tic()
event_relative_url = self.support_request.REQUEST.get("event_relative_url")
......
......@@ -6,12 +6,6 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testSlapOSCloudTicketSlapInterfaceWorkflow</string> </value>
......@@ -61,28 +55,13 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -95,7 +74,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -104,7 +83,7 @@
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -36,7 +36,8 @@ ticket.setStartDate(DateTime())
ticket.requestEvent(
event_title=ticket.getTitle(),
event_content=ticket.getDescription()
event_content=ticket.getDescription(),
event_source=ticket.getDestinationDecision()
)
event_relative_url = context.REQUEST.get("event_relative_url")
......
......@@ -9,14 +9,15 @@ kwargs = state_change.kwargs
try:
title = kwargs['event_title']
text_content = kwargs['event_content']
source = kwargs['event_source']
except KeyError:
raise TypeError, "Ticket_requestEvent takes exactly 2 argument"
raise TypeError, "Ticket_requestEvent takes at exactly 3 argument"
web_message = portal.event_module.newContent(
portal_type="Web Message",
title=title,
text_content=text_content,
source=ticket.getDestinationDecision(),
source=source,
content_type="text/plain",
destination=ticket.getSource(),
resource=ticket.getResource(),
......
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