Commit c66759d2 authored by Sebastien Robin's avatar Sebastien Robin

Display a nice error message to the user when there is some activities pending...

Display a nice error message to the user when there is some activities pending while we try to change the id of an object

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12489 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0027659a
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
from Products.Formulator.Errors import FormValidationError\n from Products.Formulator.Errors import FormValidationError\n
from Products.CMFActivity.Errors import ActivityPendingError\n
\n \n
request=context.REQUEST\n request=context.REQUEST\n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
...@@ -223,39 +224,42 @@ def parseField(f):\n ...@@ -223,39 +224,42 @@ def parseField(f):\n
kw = {}\n kw = {}\n
encapsulated_editor_list = []\n encapsulated_editor_list = []\n
MARKER = []\n MARKER = []\n
message = N_("Data+Updated.")\n
\n \n
# We process all the field in form and\n try:\n
# we check if they are in the request,\n # We process all the field in form and\n
# then we edit them\n # we check if they are in the request,\n
for field in form.get_fields():\n # then we edit them\n
parseField(field)\n for field in form.get_fields():\n
if(field.meta_type == \'ListBox\'):\n parseField(field)\n
editListBox(field, request.get(field.id))\n if(field.meta_type == \'ListBox\'):\n
elif(field.meta_type == \'MatrixBox\'):\n editListBox(field, request.get(field.id))\n
editMatrixBox(field, request.get(field.id))\n elif(field.meta_type == \'MatrixBox\'):\n
elif(field.meta_type == \'PlanningBox\'):\n editMatrixBox(field, request.get(field.id))\n
editPlanningBox(request.get(field.id))\n elif(field.meta_type == \'PlanningBox\'):\n
editPlanningBox(request.get(field.id))\n
\n
# Maybe we should build a list of objects we need\n
# Update basic attributes\n
context.edit(REQUEST=request,**kw)\n
for encapsulated_editor in encapsulated_editor_list:\n
encapsulated_editor.edit(context)\n
except ActivityPendingError,e:\n
message = N_("%s" % e)\n
\n \n
# Maybe we should build a list of objects we need\n if not(ignore_layout) and context.getApplicableLayout() :\n
# Update basic attributes\n redirect_url = \'%s/%s?editable_mode=1\' % (context.REQUEST.URL1, form_id)\n
context.edit(REQUEST=request,**kw)\n elif not selection_index:\n
for encapsulated_editor in encapsulated_editor_list:\n redirect_url = \'%s/%s?portal_status_message=%s\' % (context.absolute_url(),\n
encapsulated_editor.edit(context)\n form_id,\n
message)\n
else:\n else:\n
message = N_("Data+Updated.")\n redirect_url = \'%s/%s?selection_index=%s&selection_name=%s&portal_status_message=%s\' % (\n
if not(ignore_layout) and context.getApplicableLayout() :\n context.absolute_url(),\n
redirect_url = \'%s/%s?editable_mode=1\' % (context.REQUEST.URL1, form_id)\n form_id,\n
elif not selection_index:\n selection_index,\n
redirect_url = \'%s/%s?portal_status_message=%s\' % (context.absolute_url(),\n selection_name,\n
form_id,\n message)\n
message)\n
else:\n
redirect_url = \'%s/%s?selection_index=%s&selection_name=%s&portal_status_message=%s\' % (\n
context.absolute_url(),\n
form_id,\n
selection_index,\n
selection_name,\n
message)\n
\n \n
return request[\'RESPONSE\'].redirect(redirect_url)\n return request[\'RESPONSE\'].redirect(redirect_url)\n
...@@ -309,6 +313,8 @@ return request[\'RESPONSE\'].redirect(redirect_url)\n ...@@ -309,6 +313,8 @@ return request[\'RESPONSE\'].redirect(redirect_url)\n
<string>ignore_layout</string> <string>ignore_layout</string>
<string>Products.Formulator.Errors</string> <string>Products.Formulator.Errors</string>
<string>FormValidationError</string> <string>FormValidationError</string>
<string>Products.CMFActivity.Errors</string>
<string>ActivityPendingError</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>request</string> <string>request</string>
...@@ -333,10 +339,11 @@ return request[\'RESPONSE\'].redirect(redirect_url)\n ...@@ -333,10 +339,11 @@ return request[\'RESPONSE\'].redirect(redirect_url)\n
<string>kw</string> <string>kw</string>
<string>encapsulated_editor_list</string> <string>encapsulated_editor_list</string>
<string>parseField</string> <string>parseField</string>
<string>message</string>
<string>field</string> <string>field</string>
<string>_apply_</string> <string>_apply_</string>
<string>encapsulated_editor</string> <string>encapsulated_editor</string>
<string>message</string> <string>e</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
249 251
\ No newline at end of file \ No newline at end of file
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