Commit 74e549c7 authored by Roque's avatar Roque

erp5_officejs: get action_type from appcache storage instead of url parameter

parent 570c4df1
...@@ -46,7 +46,8 @@ ...@@ -46,7 +46,8 @@
.declareMethod("getFormDefinition", function (portal_type, action_reference) { .declareMethod("getFormDefinition", function (portal_type, action_reference) {
var gadget = this, var gadget = this,
parent = "portal_types/" + portal_type, parent = "portal_types/" + portal_type,
query = 'portal_type: "Action Information" AND reference: "' + action_reference + '" AND parent_relative_url: "' + parent + '"'; query = 'portal_type: "Action Information" AND reference: "' + action_reference + '" AND parent_relative_url: "' + parent + '"',
action_type;
return gadget.jio_allDocs({query: query}) return gadget.jio_allDocs({query: query})
.push(function (data) { .push(function (data) {
if (data.data.rows.length === 0) { if (data.data.rows.length === 0) {
...@@ -55,9 +56,11 @@ ...@@ -55,9 +56,11 @@
return gadget.jio_get(data.data.rows[0].id); return gadget.jio_get(data.data.rows[0].id);
}) })
.push(function (action_result) { .push(function (action_result) {
action_type = action_result.action_type;
return gadget.jio_get(action_result.action); return gadget.jio_get(action_result.action);
}) })
.push(function (form_result) { .push(function (form_result) {
form_result.form_definition.action_type = action_type;
return form_result.form_definition; return form_result.form_definition;
}); });
}); });
......
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>975.16238.52027.41796</string> </value> <value> <string>975.17658.62401.59067</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -287,7 +287,7 @@ ...@@ -287,7 +287,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1556116738.19</float> <float>1556202022.57</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
action_info = { action_info = {
page: "handle_action", page: "handle_action",
action: "new", action: "new",
action_type: "object_jio_js_script",
portal_type: "HTML Post", portal_type: "HTML Post",
parent_portal_type: "Post Module", parent_portal_type: "Post Module",
my_source_reference: fake_thread_uid my_source_reference: fake_thread_uid
......
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>975.4587.35735.7611</string> </value> <value> <string>975.17663.19549.38007</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -287,7 +287,7 @@ ...@@ -287,7 +287,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1555417799.99</float> <float>1556202309.43</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -87,7 +87,6 @@ ...@@ -87,7 +87,6 @@
action_settings = { action_settings = {
page: page, page: page,
action: action_doc.reference, action: action_doc.reference,
action_type: action_doc.action_type,
parent_portal_type: portal_type, parent_portal_type: portal_type,
portal_type: portal_type portal_type: portal_type
}; };
......
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>975.4589.24119.47394</string> </value> <value> <string>975.17662.57964.30634</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1555685607.37</float> <float>1556202301.34</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
.push(function () { .push(function () {
return RSVP.all([ return RSVP.all([
gadget.getUrlParameter("action"), gadget.getUrlParameter("action"),
gadget.getUrlParameter("action_type"),
gadget.getUrlParameter("parent_portal_type"), gadget.getUrlParameter("parent_portal_type"),
gadget.getSetting('parent_portal_type'), gadget.getSetting('parent_portal_type'),
gadget.declareGadget(common_utils_gadget_url) gadget.declareGadget(common_utils_gadget_url)
...@@ -41,11 +40,11 @@ ...@@ -41,11 +40,11 @@
}) })
.push(function (result) { .push(function (result) {
action_reference = result[0]; action_reference = result[0];
action_type = result[1]; parent_portal_type = result[1] || result[2];
parent_portal_type = result[2] || result[3]; gadget_utils = result[3];
gadget_utils = result[4];
return gadget_utils.getFormDefinition(parent_portal_type, action_reference) return gadget_utils.getFormDefinition(parent_portal_type, action_reference)
.push(function (form_definition) { .push(function (form_definition) {
action_type = form_definition.action_type;
if (action_type === "object_jio_js_script") { if (action_type === "object_jio_js_script") {
if (form_definition.fields_raw_properties.hasOwnProperty("gadget_field_action_js_script")) { if (form_definition.fields_raw_properties.hasOwnProperty("gadget_field_action_js_script")) {
action_gadget_url = form_definition.fields_raw_properties.gadget_field_action_js_script.values.gadget_url; action_gadget_url = form_definition.fields_raw_properties.gadget_field_action_js_script.values.gadget_url;
......
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>975.16237.2302.57053</string> </value> <value> <string>975.17664.59173.20292</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -287,7 +287,7 @@ ...@@ -287,7 +287,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1556116639.92</float> <float>1556202915.67</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
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