Commit 92f4af23 authored by Vincent Pelletier's avatar Vincent Pelletier

Use SQLCatalog to generate a SearchTextExpression.

Do not define a special case when there is exactly one line in the relation string field, to make sure the SearchTextExpression is valid even in this case.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27687 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c837b467
...@@ -1143,19 +1143,19 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ): ...@@ -1143,19 +1143,19 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ):
field.get_value('portal_type')]) field.get_value('portal_type')])
# Checked current uid # Checked current uid
kw ={} kw ={}
kw[field.get_value('catalog_index')] = field_value catalog_index = field.get_value('catalog_index')
kw[catalog_index] = field_value
self.setSelectionParamsFor(selection_name, self.setSelectionParamsFor(selection_name,
kw.copy()) kw.copy())
self.setSelectionCheckedUidsFor(selection_name, self.setSelectionCheckedUidsFor(selection_name,
current_uid_list) current_uid_list)
field_value = str(field_value).splitlines() field_value = str(field_value)
# Prevent displaying useless empty list or list with only one element if len(field_value):
if not field_value: sql_catalog = self.portal_catalog.getSQLCatalog()
field_value = '' field_value = sql_catalog.buildQuery({
if len(field_value) == 1: catalog_index: field_value.splitlines()
field_value = field_value[0] }).asSearchTextExpression(sql_catalog, column='')
if len(field_value) > 1 and isinstance(field_value, type([])):
field_value = ' OR '.join(field_value)
REQUEST.form[field_key] = field_value REQUEST.form[field_key] = field_value
portal_status_message = translateString("Please select one (or more) object.") portal_status_message = translateString("Please select one (or more) object.")
else: else:
......
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