Commit a578cf19 authored by Romain Courteaud's avatar Romain Courteaud

Bug fix: modified isMemberOf to check if a category is a sub-category.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2549 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0c0fe812
...@@ -981,8 +981,16 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -981,8 +981,16 @@ class CategoryTool( UniqueObject, Folder, Base ):
return 1 return 1
else: else:
for c in self.getAcquiredCategoryMembershipList(context, base_category = base_category): for c in self.getAcquiredCategoryMembershipList(context, base_category = base_category):
if c.find(category) >= 0: if c.find(category) == 0:
return 1 # The names begin with the same string
c_right_split = c.split(category)[1]
if (len(c_right_split) > 0):
# Be sure that we have a sub category, and not name like this: 'europe1' in 'europe10'
if c_right_split[0] == '/':
return 1
else:
# Same category
return 1
return 0 return 0
security.declareProtected( Permissions.AccessContentsInformation, 'isAcquiredMemberOf' ) security.declareProtected( Permissions.AccessContentsInformation, 'isAcquiredMemberOf' )
......
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