Commit 3a228712 authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_officejs_support_request_ui: Fix code to select the first element if only one

Also, remove the usage of document.getElementById because we should search only inside the current gadget
parent 7fbb497d
...@@ -52,12 +52,12 @@ ...@@ -52,12 +52,12 @@
return gadget.jio_getAttachment( return gadget.jio_getAttachment(
'support_request_module', 'support_request_module',
gadget.hateoas_url + 'support_request_module' gadget.hateoas_url + 'support_request_module' +
+ "/SupportRequest_getSupportTypeList" "/SupportRequest_getSupportTypeList" +
+ "?project_id=" + evt.target.value + "&json_flag=True" "?project_id=" + evt.target.value + "&json_flag=True"
).push(function (sp_list) { ).push(function (sp_list) {
var i, j, var i, j,
sp_select = document.getElementById('field_your_resource'); sp_select = gadget.element.querySelector('#field_your_resource');
for (i = sp_select.options.length - 1; i >= 0; i -= 1) { for (i = sp_select.options.length - 1; i >= 0; i -= 1) {
sp_select.remove(i); sp_select.remove(i);
} }
...@@ -65,6 +65,9 @@ ...@@ -65,6 +65,9 @@
for (j = 0; j < sp_list.length; j += 1) { for (j = 0; j < sp_list.length; j += 1) {
sp_select.options[j] = new Option(sp_list[j][0], sp_list[j][1]); sp_select.options[j] = new Option(sp_list[j][0], sp_list[j][1]);
} }
if (sp_select.options.length === 2) {
sp_select.selectedIndex = 1;
}
}); });
} }
}, false, false); }, false, false);
......
...@@ -212,58 +212,62 @@ ...@@ -212,58 +212,62 @@
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<list> <key> <string>_log</string> </key>
<dictionary> <value>
<item> <list>
<key> <string>action</string> </key> <dictionary>
<value> <string>edit</string> </value> <item>
</item> <key> <string>action</string> </key>
<item> <value> <string>edit</string> </value>
<key> <string>actor</string> </key> </item>
<value> <string>zope</string> </value> <item>
</item> <key> <string>actor</string> </key>
<item> <value> <string>zope</string> </value>
<key> <string>comment</string> </key> </item>
<value> <item>
<none/> <key> <string>comment</string> </key>
</value> <value>
</item> <none/>
<item> </value>
<key> <string>error_message</string> </key> </item>
<value> <string></string> </value> <item>
</item> <key> <string>error_message</string> </key>
<item> <value> <string></string> </value>
<key> <string>serial</string> </key> </item>
<value> <string>962.26853.29747.36369</string> </value> <item>
</item> <key> <string>serial</string> </key>
<item> <value> <string>983.16474.54324.46062</string> </value>
<key> <string>state</string> </key> </item>
<value> <string>current</string> </value> <item>
</item> <key> <string>state</string> </key>
<item> <value> <string>current</string> </value>
<key> <string>time</string> </key> </item>
<value> <item>
<object> <key> <string>time</string> </key>
<klass> <value>
<global name="DateTime" module="DateTime.DateTime"/> <object>
</klass> <klass>
<tuple> <global name="DateTime" module="DateTime.DateTime"/>
<none/> </klass>
</tuple> <tuple>
<state> <none/>
<tuple> </tuple>
<float>1540524000.73</float> <state>
<string>GMT+9</string> <tuple>
</tuple> <float>1587070526.38</float>
</state> <string>UTC</string>
</object> </tuple>
</value> </state>
</item> </object>
</dictionary> </value>
</list> </item>
</tuple> </dictionary>
</list>
</value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
<record id="5" aka="AAAAAAAAAAU="> <record id="5" aka="AAAAAAAAAAU=">
......
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