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