Commit eb696886 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] form_view_editable: catch 403 error

parent 4b8dd744
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<html> <html>
<!-- <!--
data-i18n=Input data has errors data-i18n=Input data has errors
data-i18n=You do not have the permissions to edit the object
--> -->
<head> <head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>955.51162.4768.35123</string> </value> <value> <string>956.58742.58866.48708</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1482749363.33</float> <float>1490372079.18</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -146,17 +146,25 @@ ...@@ -146,17 +146,25 @@
return form_gadget.redirect({command: 'reload'}); return form_gadget.redirect({command: 'reload'});
}) })
.push(undefined, function (error) { .push(undefined, function (error) {
if ((error.target !== undefined) && (error.target.status === 400)) { if (error.target !== undefined) {
return form_gadget.notifySubmitted() var error_text;
.push(function () { if (error.target.status === 400) {
return form_gadget.translate('Input data has errors'); error_text = 'Input data has errors';
}) } else if (error.target.status === 403) {
.push(function (message) { error_text = 'You do not have the permissions to edit the object';
return form_gadget.notifyChange(message + '.'); }
}) if (error_text !== undefined) {
.push(function () { return form_gadget.notifySubmitted()
return form_gadget.displayFormulatorValidationError(JSON.parse(error.target.responseText)); .push(function () {
}); return form_gadget.translate(error_text);
})
.push(function (message) {
return form_gadget.notifyChange(message + '.');
})
.push(function () {
return form_gadget.displayFormulatorValidationError(JSON.parse(error.target.responseText));
});
}
} }
throw error; throw error;
}); });
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>956.14154.33619.20206</string> </value> <value> <string>957.33876.27734.63044</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1482749968.67</float> <float>1490373394.35</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