Commit 65480a09 authored by Tristan Cavelier's avatar Tristan Cavelier

DATETIMEFIELDUPDATE fix for linesfield

parent 98101f69
......@@ -92,6 +92,13 @@ and handling data send&receive.
}
}
function ensureComparable(value, field_type) {
// For LinesField, getContent returns string, but we may give an array of strings to the render method.
if (field_type === "LinesField") { return value.join ? value.join("\n") : value; }
if (typeof value === "object") { return JSON.stringify(value); }
return value;
}
function updateErp5DocumentForAfterSave(new_erp5_document, submitted_content, current_content) {
var view = new_erp5_document._embedded._view,
content_key_list = Object.keys(current_content),
......@@ -107,7 +114,8 @@ and handling data send&receive.
for (i = 0; i < content_key_list.length; i += 1) {
key = content_key_list[i];
if (document_reference_dict[key] &&
JSON.stringify(submitted_content[key]) === JSON.stringify(document_reference_dict[key].default)) {
ensureComparable(submitted_content[key], document_reference_dict[key].type) ===
ensureComparable(document_reference_dict[key].default, document_reference_dict[key].type)) {
document_reference_dict[key].default = current_content[key];
}
}
......
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>975.56533.48127.29525</string> </value>
<value> <string>975.56533.48137.29525</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1558448080.86</float>
<float>1558448090.86</float>
<string>UTC</string>
</tuple>
</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