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 ):
field.get_value('portal_type')])
# Checked current uid
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,
kw.copy())
self.setSelectionCheckedUidsFor(selection_name,
current_uid_list)
field_value = str(field_value).splitlines()
# Prevent displaying useless empty list or list with only one element
if not field_value:
field_value = ''
if len(field_value) == 1:
field_value = field_value[0]
if len(field_value) > 1 and isinstance(field_value, type([])):
field_value = ' OR '.join(field_value)
field_value = str(field_value)
if len(field_value):
sql_catalog = self.portal_catalog.getSQLCatalog()
field_value = sql_catalog.buildQuery({
catalog_index: field_value.splitlines()
}).asSearchTextExpression(sql_catalog, column='')
REQUEST.form[field_key] = field_value
portal_status_message = translateString("Please select one (or more) object.")
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