Commit 476cbf81 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Reopen ticket if a new message is posted.

parent 7c2eef57
......@@ -12,6 +12,7 @@
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("jio_post", "jio_post")
.declareAcquiredMethod("jio_putAttachment", "jio_putAttachment")
.declareAcquiredMethod("jio_get", "jio_get")
......@@ -31,10 +32,17 @@
.push(function (doc) {
return gadget.jio_post(doc);
})
.push(function () {
return gadget.redirect({"command": "change",
.push(function (key) {
return gadget.getSetting('hateoas_url')
.push(function (hateoas_url) {
return gadget.jio_putAttachment(key,
hateoas_url + key + "/WebMessage_stop", {});
})
.push(function () {
return gadget.redirect({"command": "change",
"options": {"jio_key": gadget.state.jio_key,
"page": "slap_controller"}});
});
});
})
......@@ -166,7 +174,7 @@
})
.push(function () {
return gadget.updateHeader({
page_title: "New Ticket",
page_title: "New Message",
submit_action: true
});
});
......
......@@ -273,7 +273,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.3640.49595.9984</string> </value>
<value> <string>965.59722.26989.42052</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -291,7 +291,7 @@
</tuple>
<state>
<tuple>
<float>1509323928.01</float>
<float>1520009407.21</float>
<string>UTC</string>
</tuple>
</state>
......
from zExceptions import Unauthorized
portal = context.getPortalObject()
person = portal.ERP5Site_getAuthenticatedMemberPersonValue()
# XXX Proxy role is Manager so user to open ticket which is closed.
# We check permissions
if not person:
raise Unauthorized("You need to be logged in before modify this object!")
ticket = context.getFollowUpValue()
if ticket.getDestinationDecision() != person.getRelativeUrl():
raise Unauthorized
context.stop(comment="Submitted from the renderjs app")
if portal.portal_workflow.isTransitionPossible(ticket, "validate"):
ticket.validate(comment="See %s" % context.getRelativeUrl())
<?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>_params</string> </key>
<value> <string>*args, **kwargs</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebMessage_stop</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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