Commit 25ff6cf0 authored by Julien Muchembled's avatar Julien Muchembled

CatalogTool: fix searchAndActivate when called with a condition on 'uid'

Because the method internally overrode 'uid' after the first group of objects,
passing a list of uids could make it go berserk and activate all objects in
catalog with an uid greater than those of the first group.

Although searchAndActivate was not initially written to be called with such
list, this commit fixes this instead of forbidding conditions on 'uid',
since it remains useful to easily split & group activities.
parent 357cb2bc
......@@ -30,7 +30,7 @@ from copy import deepcopy
from collections import defaultdict
from Products.CMFCore.CatalogTool import CatalogTool as CMFCoreCatalogTool
from Products.ZSQLCatalog.ZSQLCatalog import ZCatalog
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery, SimpleQuery
from Products.ERP5Type import Permissions
from AccessControl import ClassSecurityInfo, getSecurityManager
from AccessControl.User import system as system_user
......@@ -965,7 +965,8 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
packet_size = catalog_kw.pop('packet_size', 30)
limit = packet_size * catalog_kw.pop('activity_count', 100)
if min_uid:
catalog_kw['uid'] = {'query': min_uid, 'range': 'nlt'}
catalog_kw['min_uid'] = SimpleQuery(uid=min_uid,
comparison_operator='>')
if catalog_kw.pop('restricted', False):
search = self
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