Commit 5ae2690d authored by Sebastien Robin's avatar Sebastien Robin

check that fields are editable before editing the cell


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3800 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7de7e18f
...@@ -401,20 +401,21 @@ class MatrixBoxValidator(Validator.Validator): ...@@ -401,20 +401,21 @@ class MatrixBoxValidator(Validator.Validator):
my_field_id = '%s_%s' % (field.id, attribute_id) my_field_id = '%s_%s' % (field.id, attribute_id)
if form.has_field(my_field_id): if form.has_field(my_field_id):
my_field = form.get_field(my_field_id) my_field = form.get_field(my_field_id)
key = 'field_' + my_field.id + '_cell_%s_%s_%s' % (i,j, k) if my_field.get_value('editable'):
attribute_value = my_field.get_value('default', cell = cell, cell_index = kw, key = 'field_' + my_field.id + '_cell_%s_%s_%s' % (i,j, k)
cell_position = (i,j, k)) attribute_value = my_field.get_value('default', cell = cell, cell_index = kw,
value = my_field.validator.validate(my_field, key, REQUEST) cell_position = (i,j, k))
value = my_field.validator.validate(my_field, key, REQUEST)
if (attribute_value != value or attribute_value not in('',None,(),[])) \
and not my_field.get_value('hidden'): if (attribute_value != value or attribute_value not in('',None,(),[])) \
# Only validate modified values from visible fields and not my_field.get_value('hidden'):
if not result.has_key(kw): # Only validate modified values from visible fields
result[kw] = {} if not result.has_key(kw):
result[kw][attribute_id] = value result[kw] = {}
else:
if result.has_key(kw):
result[kw][attribute_id] = value result[kw][attribute_id] = value
else:
if result.has_key(kw):
result[kw][attribute_id] = value
j += 1 j += 1
i += 1 i += 1
k += 1 k += 1
......
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