Commit 74817a76 authored by Sebastien Robin's avatar Sebastien Robin

check if the selection has changed


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@757 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5c870637
......@@ -4,7 +4,7 @@
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=form_id,dialog_id,selection_name
##parameters=form_id,dialog_id,selection_name,md5_object_uid_list=None
##title=
##
from Products.Formulator.Errors import ValidationError, FormValidationError
......@@ -24,6 +24,13 @@ try:
if v is not None:
kw[k] = v
selection_list = context.portal_selections.callSelectionFor(selection_name, context=context)
# Check if the selection did not changed
if md5_object_uid_list is not None:
object_uid_list = map(lambda x:x.getObject().getUid(),selection_list)
error = context.portal_selections.selectionHasChanged(md5_object_uid_list,object_uid_list)
if error:
error_message = 'Sorry+your+selection+has+changed'
if error_message == '':
for selection_item in selection_list:
o = selection_item.getObject()
workflow_action = kw['workflow_action']
......@@ -50,7 +57,6 @@ try:
this_error = last_history_data.get('error_message')
if this_error != None and this_error != '':
error_message += this_error + "-"
except FormValidationError, validation_errors:
# Pack errors into the request
field_errors = form.ErrorFields(validation_errors)
......
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