Commit 67c96c00 authored by Jean-Paul Smets's avatar Jean-Paul Smets

added more support for domains


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5313 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2f898555
......@@ -1050,6 +1050,26 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ):
"""
return self
def asSqlExpression(self, strict_membership=0, table='category', base_category = None):
"""
Any document can be used as a Category. It can therefore
serve in a Predicate and must be rendered as an sql expression. This
can be useful to create reporting trees based on the
ZSQLCatalog whenever documents are used rather than categories
TODO:
- strict_membership is not implemented
"""
if type(base_category) is type('a'):
base_category = self.portal_categories[base_category]
if base_category is None:
sql_text = '(%s.category_uid = %s)' % \
(table, self.getUid())
else:
sql_text = '(%s.category_uid = %s AND %s.base_category_uid = %s)' % \
(table, self.getUid(), table, base_category.getBaseCategoryUid())
return sql_text
security.declareProtected( Permissions.AccessContentsInformation, 'asParentSqlExpression' )
def getParentSqlExpression(self, table = 'catalog', strict_membership = 0):
"""
......
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