Commit b47ce0da authored by Julien Muchembled's avatar Julien Muchembled

Fix editable listbox cells to keep entered values when (un)selecting all lines

parent c222dc58
...@@ -2369,19 +2369,6 @@ class ListBoxHTMLRendererLine(ListBoxRendererLine): ...@@ -2369,19 +2369,6 @@ class ListBoxHTMLRendererLine(ListBoxRendererLine):
# Generate page selection methods based on the Listbox id # Generate page selection methods based on the Listbox id
createFolderMixInPageSelectionMethod(field_id) createFolderMixInPageSelectionMethod(field_id)
# Check is there is a validation error at the level of the listbox
# as a whole. This will be required later to decide wherer to
# display values from (ie. from the REQUEST or from the object)
has_error = 0
for key in error_dict.keys():
for editable_id in editable_column_id_set:
candidate_field_key = "%s_%s" % (field_id, editable_id)
if key.startswith(candidate_field_key):
has_error = 1
break
if has_error:
break
for (original_value, processed_value), (sql, title), alias \ for (original_value, processed_value), (sql, title), alias \
in zip(self.getValueList(), renderer.getSelectedColumnList(), renderer.getColumnAliasList()): in zip(self.getValueList(), renderer.getSelectedColumnList(), renderer.getColumnAliasList()):
# By default, no error. # By default, no error.
...@@ -2462,20 +2449,15 @@ class ListBoxHTMLRendererLine(ListBoxRendererLine): ...@@ -2462,20 +2449,15 @@ class ListBoxHTMLRendererLine(ListBoxRendererLine):
key = '%s_%s' % (editable_field.getId(), self.getUid()) key = '%s_%s' % (editable_field.getId(), self.getUid())
if sql in editable_column_id_set: if sql in editable_column_id_set:
listbox_defines_column_as_editable = True listbox_defines_column_as_editable = True
if has_error: # If there is any error on listbox, we should use what the user has typed # Like any other field in ERP5, always use the value entered by the
display_value = None # user if any. This duplicates some work done by field.render
else: try:
validated_value_dict = request.get(field_id, None) display_value = editable_field._get_user_input_value(
if validated_value_dict is None: editable_field.generate_field_key(key=key), request)
# If this is neither an error nor a validated listbox except (KeyError, AttributeError):
# we should use the original value
display_value = original_value display_value = original_value
else: # If error on current field, we should display message
# If the listbox has been validated (ie. as it is the if key in error_dict:
# case whenever a relation field displays a popup menu)
# we have to use the value entered by the user
display_value = None #
if error_dict.has_key(key): # If error on current field, we should display message
error_text = error_dict[key].error_text error_text = error_dict[key].error_text
error_text = cgi.escape(error_text) error_text = cgi.escape(error_text)
if isinstance(error_text, str): if isinstance(error_text, str):
......
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