Commit 23f94525 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

* add SelectionTool.buildSQLJoinExpressionFromDomainSelection()

* add SelectionTool.buildSQLExpressionFromDomainSelection()
* please use these methods instead of selection_domain.asSQLJoinExpression
  and selection_domain.asSQLExpression.
* to pass a DomainSelection instance to these methods is
  deprecated. please use a domain dict instance to these methods
  instead.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13092 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e0319f2d
...@@ -1381,7 +1381,6 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -1381,7 +1381,6 @@ class CategoryTool( UniqueObject, Folder, Base ):
""" """
This returns a catalog_search resource with can then be used by getCategoryMemberItemList This returns a catalog_search resource with can then be used by getCategoryMemberItemList
""" """
from Products.ERP5Form.Selection import DomainSelection
if base_category is None: if base_category is None:
if context.getPortalType() in ( "Base Category", "Category") : if context.getPortalType() in ( "Base Category", "Category") :
base_category = context.getBaseCategoryId() base_category = context.getBaseCategoryId()
...@@ -1390,13 +1389,12 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -1390,13 +1389,12 @@ class CategoryTool( UniqueObject, Folder, Base ):
strict_membership = kw.get('strict_membership', kw.get('strict', 0)) strict_membership = kw.get('strict_membership', kw.get('strict', 0))
domain_dict = {base_category: ('portal_categories', context.getRelativeUrl())} domain_dict = {base_category: ('portal_categories', context.getRelativeUrl())}
selection_domain = DomainSelection(domain_dict = domain_dict).__of__(context)
if strict_membership: if strict_membership:
catalog_search = self.portal_catalog(portal_type = portal_type, catalog_search = self.portal_catalog(portal_type = portal_type,
selection_report = selection_domain) selection_report = domain_dict)
else: else:
catalog_search = self.portal_catalog(portal_type = portal_type, catalog_search = self.portal_catalog(portal_type = portal_type,
selection_domain = selection_domain) selection_domain = domain_dict)
return catalog_search return catalog_search
......
...@@ -260,9 +260,9 @@ FROM\n ...@@ -260,9 +260,9 @@ FROM\n
</dtml-if>\n </dtml-if>\n
</dtml-in>\n </dtml-in>\n
<dtml-if selection_domain>,\n <dtml-if selection_domain>,\n
<dtml-var "selection_domain.asSQLJoinExpression()"> </dtml-if>\n <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_domain)"> </dtml-if>\n
<dtml-if selection_report>,\n <dtml-if selection_report>,\n
<dtml-var "selection_report.asSQLJoinExpression()"> </dtml-if>\n <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_report)"> </dtml-if>\n
, catalog as node, catalog as resource\n , catalog as node, catalog as resource\n
\n \n
WHERE\n WHERE\n
...@@ -313,11 +313,10 @@ WHERE\n ...@@ -313,11 +313,10 @@ WHERE\n
</dtml-if>\n </dtml-if>\n
\n \n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
AND <dtml-var "selection_domain.asSQLExpression(join_table=\'stock\',\n AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_domain, join_table=\'stock\', join_column=\'node_uid\')">\n
join_column=\'node_uid\')">\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
AND <dtml-var "selection_report.asSQLExpression(strict_membership=1)">\n AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_report, strict_membership=1)">\n
</dtml-if>\n </dtml-if>\n
\n \n
<dtml-if group_by_expression>\n <dtml-if group_by_expression>\n
...@@ -397,9 +396,9 @@ FROM\n ...@@ -397,9 +396,9 @@ FROM\n
</dtml-if>\n </dtml-if>\n
</dtml-in>\n </dtml-in>\n
<dtml-if selection_domain>,\n <dtml-if selection_domain>,\n
<dtml-var "selection_domain.asSQLJoinExpression()"> </dtml-if>\n <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_domain)"> </dtml-if>\n
<dtml-if selection_report>,\n <dtml-if selection_report>,\n
<dtml-var "selection_report.asSQLJoinExpression()"> </dtml-if>\n <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_report)"> </dtml-if>\n
, catalog as node, catalog as resource\n , catalog as node, catalog as resource\n
\n \n
WHERE\n WHERE\n
...@@ -450,11 +449,10 @@ WHERE\n ...@@ -450,11 +449,10 @@ WHERE\n
</dtml-if>\n </dtml-if>\n
\n \n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
AND <dtml-var "selection_domain.asSQLExpression(join_table=\'stock\',\n AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_domain, join_table=\'stock\', join_column=\'node_uid\')">\n
join_column=\'node_uid\')">\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
AND <dtml-var "selection_report.asSQLExpression(strict_membership=1)">\n AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_report, strict_membership=1)">\n
</dtml-if>\n </dtml-if>\n
\n \n
<dtml-if group_by_expression>\n <dtml-if group_by_expression>\n
......
...@@ -257,8 +257,8 @@ FROM\n ...@@ -257,8 +257,8 @@ FROM\n
, <dtml-var table_item> AS <dtml-var table_key>\n , <dtml-var table_item> AS <dtml-var table_key>\n
</dtml-if>\n </dtml-if>\n
</dtml-in>\n </dtml-in>\n
<dtml-if selection_domain>, <dtml-var "selection_domain.asSQLJoinExpression()"> </dtml-if>\n <dtml-if selection_domain>, <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_domain)"> </dtml-if>\n
<dtml-if selection_report>, <dtml-var "selection_report.asSQLJoinExpression()"> </dtml-if>\n <dtml-if selection_report>, <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_report)"> </dtml-if>\n
, catalog as node, catalog as resource\n , catalog as node, catalog as resource\n
\n \n
WHERE\n WHERE\n
...@@ -314,11 +314,10 @@ WHERE\n ...@@ -314,11 +314,10 @@ WHERE\n
</dtml-if>\n </dtml-if>\n
\n \n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
AND <dtml-var "selection_domain.asSQLExpression(join_table=\'stock\',\n AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_domain, join_table=\'stock\', join_column=\'node_uid\')">\n
join_column=\'node_uid\')">\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
AND <dtml-var "selection_report.asSQLExpression(strict_membership=1)">\n AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_report, strict_membership=1)">\n
</dtml-if>\n </dtml-if>\n
GROUP BY\n GROUP BY\n
<dtml-if group_by_expression>\n <dtml-if group_by_expression>\n
...@@ -398,8 +397,8 @@ FROM\n ...@@ -398,8 +397,8 @@ FROM\n
, <dtml-var table_item> AS <dtml-var table_key>\n , <dtml-var table_item> AS <dtml-var table_key>\n
</dtml-if>\n </dtml-if>\n
</dtml-in>\n </dtml-in>\n
<dtml-if selection_domain>, <dtml-var "selection_domain.asSQLJoinExpression()"> </dtml-if>\n <dtml-if selection_domain>, <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_domain)"> </dtml-if>\n
<dtml-if selection_report>, <dtml-var "selection_report.asSQLJoinExpression()"> </dtml-if>\n <dtml-if selection_report>, <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_report)"> </dtml-if>\n
, catalog as node, catalog as resource\n , catalog as node, catalog as resource\n
\n \n
WHERE\n WHERE\n
...@@ -455,11 +454,10 @@ WHERE\n ...@@ -455,11 +454,10 @@ WHERE\n
</dtml-if>\n </dtml-if>\n
\n \n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
AND <dtml-var "selection_domain.asSQLExpression(join_table=\'stock\',\n AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_domain, join_table=\'stock\', join_column=\'node_uid\')">\n
join_column=\'node_uid\')">\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
AND <dtml-var "selection_report.asSQLExpression(strict_membership=1)">\n AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_report, strict_membership=1)">\n
</dtml-if>\n </dtml-if>\n
GROUP BY\n GROUP BY\n
<dtml-if group_by_expression>\n <dtml-if group_by_expression>\n
......
...@@ -695,8 +695,8 @@ FROM\n ...@@ -695,8 +695,8 @@ FROM\n
, <dtml-var table_item> AS <dtml-var table_key>\n , <dtml-var table_item> AS <dtml-var table_key>\n
</dtml-if>\n </dtml-if>\n
</dtml-in>\n </dtml-in>\n
<dtml-if selection_domain>, <dtml-var "selection_domain.asSQLJoinExpression()"> </dtml-if>\n <dtml-if selection_domain>, <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_domain)"> </dtml-if>\n
<dtml-if selection_report>, <dtml-var "selection_report.asSQLJoinExpression()"> </dtml-if>\n <dtml-if selection_report>, <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_report)"> </dtml-if>\n
, catalog as node, catalog as resource\n , catalog as node, catalog as resource\n
\n \n
WHERE\n WHERE\n
...@@ -752,11 +752,10 @@ WHERE\n ...@@ -752,11 +752,10 @@ WHERE\n
</dtml-if>\n </dtml-if>\n
\n \n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
AND <dtml-var "selection_domain.asSQLExpression(join_table=\'stock\',\n AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_domain, join_table=\'stock\', join_column=\'node_uid\')">\n
join_column=\'node_uid\')">\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
AND <dtml-var "selection_report.asSQLExpression(strict_membership=1)">\n AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_report, strict_membership=1)">\n
</dtml-if>\n </dtml-if>\n
\n \n
GROUP BY\n GROUP BY\n
...@@ -852,8 +851,8 @@ FROM\n ...@@ -852,8 +851,8 @@ FROM\n
, <dtml-var table_item> AS <dtml-var table_key>\n , <dtml-var table_item> AS <dtml-var table_key>\n
</dtml-if>\n </dtml-if>\n
</dtml-in>\n </dtml-in>\n
<dtml-if selection_domain>, <dtml-var "selection_domain.asSQLJoinExpression()"> </dtml-if>\n <dtml-if selection_domain>, <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_domain)"> </dtml-if>\n
<dtml-if selection_report>, <dtml-var "selection_report.asSQLJoinExpression()"> </dtml-if>\n <dtml-if selection_report>, <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_report)"> </dtml-if>\n
, catalog as node, catalog as resource\n , catalog as node, catalog as resource\n
\n \n
WHERE\n WHERE\n
...@@ -909,11 +908,10 @@ WHERE\n ...@@ -909,11 +908,10 @@ WHERE\n
</dtml-if>\n </dtml-if>\n
\n \n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
AND <dtml-var "selection_domain.asSQLExpression(join_table=\'stock\',\n AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_domain, join_table=\'stock\', join_column=\'node_uid\')">\n
join_column=\'node_uid\')">\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
AND <dtml-var "selection_report.asSQLExpression(strict_membership=1)">\n AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_report, strict_membership=1)">\n
</dtml-if>\n </dtml-if>\n
\n \n
GROUP BY\n GROUP BY\n
......
...@@ -407,8 +407,8 @@ FROM\n ...@@ -407,8 +407,8 @@ FROM\n
<dtml-if expr="table_key != \'item\'">, <dtml-var table_item> AS <dtml-var table_key></dtml-if>\n <dtml-if expr="table_key != \'item\'">, <dtml-var table_item> AS <dtml-var table_key></dtml-if>\n
</dtml-in>\n </dtml-in>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_domain>, <dtml-var "selection_domain.asSQLJoinExpression()"> </dtml-if>\n <dtml-if selection_domain>, <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_domain)"> </dtml-if>\n
<dtml-if selection_report>, <dtml-var "selection_report.asSQLJoinExpression()"> </dtml-if>\n <dtml-if selection_report>, <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_report)"> </dtml-if>\n
, item\n , item\n
\n \n
\n \n
...@@ -456,11 +456,10 @@ WHERE\n ...@@ -456,11 +456,10 @@ WHERE\n
\n \n
\n \n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
AND <dtml-var "selection_domain.asSQLExpression(join_table=\'item\',\n AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_domain, join_table=\'item\', join_column=\'node_uid\')">\n
join_column=\'node_uid\')">\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
AND <dtml-var "selection_report.asSQLExpression(strict_membership=1)">\n AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_report, strict_membership=1)">\n
</dtml-if>\n </dtml-if>\n
\n \n
<dtml-if group_by_expression>\n <dtml-if group_by_expression>\n
...@@ -526,8 +525,8 @@ FROM\n ...@@ -526,8 +525,8 @@ FROM\n
<dtml-if expr="table_key != \'item\'">, <dtml-var table_item> AS <dtml-var table_key></dtml-if>\n <dtml-if expr="table_key != \'item\'">, <dtml-var table_item> AS <dtml-var table_key></dtml-if>\n
</dtml-in>\n </dtml-in>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_domain>, <dtml-var "selection_domain.asSQLJoinExpression()"> </dtml-if>\n <dtml-if selection_domain>, <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_domain)"> </dtml-if>\n
<dtml-if selection_report>, <dtml-var "selection_report.asSQLJoinExpression()"> </dtml-if>\n <dtml-if selection_report>, <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_report)"> </dtml-if>\n
, item\n , item\n
\n \n
\n \n
...@@ -575,11 +574,10 @@ WHERE\n ...@@ -575,11 +574,10 @@ WHERE\n
\n \n
\n \n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
AND <dtml-var "selection_domain.asSQLExpression(join_table=\'item\',\n AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_domain, join_table=\'item\', join_column=\'node_uid\')">\n
join_column=\'node_uid\')">\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
AND <dtml-var "selection_report.asSQLExpression(strict_membership=1)">\n AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_report, strict_membership=1)">\n
</dtml-if>\n </dtml-if>\n
\n \n
<dtml-if group_by_expression>\n <dtml-if group_by_expression>\n
......
...@@ -271,8 +271,8 @@ FROM\n ...@@ -271,8 +271,8 @@ FROM\n
, <dtml-var sequence-item> AS <dtml-var sequence-key>\n , <dtml-var sequence-item> AS <dtml-var sequence-key>\n
</dtml-in>\n </dtml-in>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_domain>, <dtml-var "selection_domain.asSQLJoinExpression()"> </dtml-if>\n <dtml-if selection_domain>, <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_domain)"> </dtml-if>\n
<dtml-if selection_report>, <dtml-var "selection_report.asSQLJoinExpression()"> </dtml-if>\n <dtml-if selection_report>, <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_report)"> </dtml-if>\n
\n \n
WHERE\n WHERE\n
child.uid = stock.uid\n child.uid = stock.uid\n
...@@ -337,10 +337,10 @@ WHERE\n ...@@ -337,10 +337,10 @@ WHERE\n
</dtml-if>\n </dtml-if>\n
\n \n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
AND <dtml-var "selection_domain.asSQLExpression()">\n AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_domain)">\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
AND <dtml-var "selection_report.asSQLExpression()">\n AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_report)">\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_uids>\n <dtml-if selection_uids>\n
AND\n AND\n
...@@ -414,8 +414,8 @@ FROM\n ...@@ -414,8 +414,8 @@ FROM\n
, <dtml-var sequence-item> AS <dtml-var sequence-key>\n , <dtml-var sequence-item> AS <dtml-var sequence-key>\n
</dtml-in>\n </dtml-in>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_domain>, <dtml-var "selection_domain.asSQLJoinExpression()"> </dtml-if>\n <dtml-if selection_domain>, <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_domain)"> </dtml-if>\n
<dtml-if selection_report>, <dtml-var "selection_report.asSQLJoinExpression()"> </dtml-if>\n <dtml-if selection_report>, <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_report)"> </dtml-if>\n
\n \n
WHERE\n WHERE\n
child.uid = stock.uid\n child.uid = stock.uid\n
...@@ -480,10 +480,10 @@ WHERE\n ...@@ -480,10 +480,10 @@ WHERE\n
</dtml-if>\n </dtml-if>\n
\n \n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
AND <dtml-var "selection_domain.asSQLExpression()">\n AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_domain)">\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
AND <dtml-var "selection_report.asSQLExpression()">\n AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_report)">\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_uids>\n <dtml-if selection_uids>\n
AND\n AND\n
......
...@@ -150,12 +150,12 @@ SELECT\n ...@@ -150,12 +150,12 @@ SELECT\n
FROM\n FROM\n
<dtml-in from_table_list> <dtml-var sequence-item> AS <dtml-var sequence-key><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in>\n <dtml-in from_table_list> <dtml-var sequence-item> AS <dtml-var sequence-key><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in>\n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
<dtml-let expression="selection_domain.asSQLJoinExpression(category_table_alias = \'domain_category\')">\n <dtml-let expression="portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_domain, category_table_alias = \'domain_category\')">\n
<dtml-if expression> , <dtml-var expression> </dtml-if>\n <dtml-if expression> , <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
<dtml-let expression="selection_report.asSQLJoinExpression(category_table_alias = \'report_category\')">\n <dtml-let expression="portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_report, category_table_alias = \'report_category\')">\n
<dtml-if expression> , <dtml-var expression> </dtml-if>\n <dtml-if expression> , <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
...@@ -165,12 +165,12 @@ WHERE\n ...@@ -165,12 +165,12 @@ WHERE\n
AND <dtml-var where_expression>\n AND <dtml-var where_expression>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
<dtml-let expression="selection_domain.asSQLExpression(category_table_alias = \'domain_category\')">\n <dtml-let expression="portal_selections.buildSQLExpressionFromDomainSelection(selection_domain, category_table_alias = \'domain_category\')">\n
<dtml-if expression> AND <dtml-var expression> </dtml-if>\n <dtml-if expression> AND <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
<dtml-let expression="selection_report.asSQLExpression(strict_membership=1, category_table_alias = \'report_category\')">\n <dtml-let expression="portal_selections.buildSQLExpressionFromDomainSelection(selection_report, strict_membership=1, category_table_alias = \'report_category\')">\n
<dtml-if expression> AND <dtml-var expression> </dtml-if>\n <dtml-if expression> AND <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
...@@ -228,12 +228,12 @@ SELECT\n ...@@ -228,12 +228,12 @@ SELECT\n
FROM\n FROM\n
<dtml-in from_table_list> <dtml-var sequence-item> AS <dtml-var sequence-key><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in>\n <dtml-in from_table_list> <dtml-var sequence-item> AS <dtml-var sequence-key><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in>\n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
<dtml-let expression="selection_domain.asSQLJoinExpression(category_table_alias = \'domain_category\')">\n <dtml-let expression="portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_domain, category_table_alias = \'domain_category\')">\n
<dtml-if expression> , <dtml-var expression> </dtml-if>\n <dtml-if expression> , <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
<dtml-let expression="selection_report.asSQLJoinExpression(category_table_alias = \'report_category\')">\n <dtml-let expression="portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_report, category_table_alias = \'report_category\')">\n
<dtml-if expression> , <dtml-var expression> </dtml-if>\n <dtml-if expression> , <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
...@@ -243,12 +243,12 @@ WHERE\n ...@@ -243,12 +243,12 @@ WHERE\n
AND <dtml-var where_expression>\n AND <dtml-var where_expression>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
<dtml-let expression="selection_domain.asSQLExpression(category_table_alias = \'domain_category\')">\n <dtml-let expression="portal_selections.buildSQLExpressionFromDomainSelection(selection_domain, category_table_alias = \'domain_category\')">\n
<dtml-if expression> AND <dtml-var expression> </dtml-if>\n <dtml-if expression> AND <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
<dtml-let expression="selection_report.asSQLExpression(strict_membership=1, category_table_alias = \'report_category\')">\n <dtml-let expression="portal_selections.buildSQLExpressionFromDomainSelection(selection_report, strict_membership=1, category_table_alias = \'report_category\')">\n
<dtml-if expression> AND <dtml-var expression> </dtml-if>\n <dtml-if expression> AND <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
......
...@@ -186,12 +186,12 @@ SELECT DISTINCT\n ...@@ -186,12 +186,12 @@ SELECT DISTINCT\n
FROM\n FROM\n
<dtml-in from_table_list> <dtml-var sequence-item> AS <dtml-var sequence-key><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in>\n <dtml-in from_table_list> <dtml-var sequence-item> AS <dtml-var sequence-key><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in>\n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
<dtml-let expression="selection_domain.asSQLJoinExpression(category_table_alias = \'domain_category\')">\n <dtml-let expression="portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_domain, category_table_alias = \'domain_category\')">\n
<dtml-if expression> , <dtml-var expression> </dtml-if>\n <dtml-if expression> , <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
<dtml-let expression="selection_report.asSQLJoinExpression(category_table_alias = \'report_category\')">\n <dtml-let expression="portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_report, category_table_alias = \'report_category\')">\n
<dtml-if expression> , <dtml-var expression> </dtml-if>\n <dtml-if expression> , <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
...@@ -202,12 +202,12 @@ WHERE \n ...@@ -202,12 +202,12 @@ WHERE \n
AND <dtml-var where_expression>\n AND <dtml-var where_expression>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
<dtml-let expression="selection_domain.asSQLExpression(category_table_alias = \'domain_category\')">\n <dtml-let expression="portal_selections.buildSQLExpressionFromDomainSelection(selection_domain, category_table_alias = \'domain_category\')">\n
<dtml-if expression> AND <dtml-var expression> </dtml-if>\n <dtml-if expression> AND <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
<dtml-let expression="selection_report.asSQLExpression(strict_membership=1, category_table_alias = \'report_category\')">\n <dtml-let expression="portal_selections.buildSQLExpressionFromDomainSelection(selection_report, strict_membership=1, category_table_alias = \'report_category\')">\n
<dtml-if expression> AND <dtml-var expression> </dtml-if>\n <dtml-if expression> AND <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
...@@ -267,12 +267,12 @@ SELECT DISTINCT\n ...@@ -267,12 +267,12 @@ SELECT DISTINCT\n
FROM\n FROM\n
<dtml-in from_table_list> <dtml-var sequence-item> AS <dtml-var sequence-key><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in>\n <dtml-in from_table_list> <dtml-var sequence-item> AS <dtml-var sequence-key><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in>\n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
<dtml-let expression="selection_domain.asSQLJoinExpression(category_table_alias = \'domain_category\')">\n <dtml-let expression="portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_domain, category_table_alias = \'domain_category\')">\n
<dtml-if expression> , <dtml-var expression> </dtml-if>\n <dtml-if expression> , <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
<dtml-let expression="selection_report.asSQLJoinExpression(category_table_alias = \'report_category\')">\n <dtml-let expression="portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_report, category_table_alias = \'report_category\')">\n
<dtml-if expression> , <dtml-var expression> </dtml-if>\n <dtml-if expression> , <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
...@@ -283,12 +283,12 @@ WHERE \n ...@@ -283,12 +283,12 @@ WHERE \n
AND <dtml-var where_expression>\n AND <dtml-var where_expression>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
<dtml-let expression="selection_domain.asSQLExpression(category_table_alias = \'domain_category\')">\n <dtml-let expression="portal_selections.buildSQLExpressionFromDomainSelection(selection_domain, category_table_alias = \'domain_category\')">\n
<dtml-if expression> AND <dtml-var expression> </dtml-if>\n <dtml-if expression> AND <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
<dtml-let expression="selection_report.asSQLExpression(strict_membership=1, category_table_alias = \'report_category\')">\n <dtml-let expression="portal_selections.buildSQLExpressionFromDomainSelection(selection_report, strict_membership=1, category_table_alias = \'report_category\')">\n
<dtml-if expression> AND <dtml-var expression> </dtml-if>\n <dtml-if expression> AND <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
......
...@@ -142,12 +142,12 @@ SELECT\n ...@@ -142,12 +142,12 @@ SELECT\n
FROM\n FROM\n
<dtml-in from_table_list> <dtml-var sequence-item> AS <dtml-var sequence-key><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in>\n <dtml-in from_table_list> <dtml-var sequence-item> AS <dtml-var sequence-key><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in>\n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
<dtml-let expression="selection_domain.asSQLJoinExpression(category_table_alias = \'domain_category\')">\n <dtml-let expression="portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_domain, category_table_alias = \'domain_category\')">\n
<dtml-if expression> , <dtml-var expression> </dtml-if>\n <dtml-if expression> , <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
<dtml-let expression="selection_report.asSQLJoinExpression(category_table_alias = \'report_category\')">\n <dtml-let expression="portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_report, category_table_alias = \'report_category\')">\n
<dtml-if expression> , <dtml-var expression> </dtml-if>\n <dtml-if expression> , <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
...@@ -157,12 +157,12 @@ WHERE\n ...@@ -157,12 +157,12 @@ WHERE\n
AND <dtml-var where_expression>\n AND <dtml-var where_expression>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
<dtml-let expression="selection_domain.asSQLExpression(category_table_alias = \'domain_category\')">\n <dtml-let expression="portal_selections.buildSQLExpressionFromDomainSelection(selection_domain, category_table_alias = \'domain_category\')">\n
<dtml-if expression> AND <dtml-var expression> </dtml-if>\n <dtml-if expression> AND <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
<dtml-let expression="selection_report.asSQLExpression(strict_membership=1, category_table_alias = \'report_category\')">\n <dtml-let expression="portal_selections.buildSQLExpressionFromDomainSelection(selection_report, strict_membership=1, category_table_alias = \'report_category\')">\n
<dtml-if expression> AND <dtml-var expression> </dtml-if>\n <dtml-if expression> AND <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
...@@ -220,12 +220,12 @@ SELECT\n ...@@ -220,12 +220,12 @@ SELECT\n
FROM\n FROM\n
<dtml-in from_table_list> <dtml-var sequence-item> AS <dtml-var sequence-key><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in>\n <dtml-in from_table_list> <dtml-var sequence-item> AS <dtml-var sequence-key><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in>\n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
<dtml-let expression="selection_domain.asSQLJoinExpression()">\n <dtml-let expression="portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_domain)">\n
<dtml-if expression> , <dtml-var expression> </dtml-if>\n <dtml-if expression> , <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
<dtml-let expression="selection_report.asSQLJoinExpression()">\n <dtml-let expression="portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_report)">\n
<dtml-if expression> , <dtml-var expression> </dtml-if>\n <dtml-if expression> , <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
...@@ -235,12 +235,12 @@ WHERE\n ...@@ -235,12 +235,12 @@ WHERE\n
AND <dtml-var where_expression>\n AND <dtml-var where_expression>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
<dtml-let expression="selection_domain.asSQLExpression()">\n <dtml-let expression="portal_selections.buildSQLExpressionFromDomainSelection(selection_domain)">\n
<dtml-if expression> AND <dtml-var expression> </dtml-if>\n <dtml-if expression> AND <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
<dtml-let expression="selection_report.asSQLExpression(strict_membership=1)">\n <dtml-let expression="portal_selections.buildSQLExpressionFromDomainSelection(selection_report, strict_membership=1)">\n
<dtml-if expression> AND <dtml-var expression> </dtml-if>\n <dtml-if expression> AND <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
......
...@@ -178,12 +178,12 @@ SELECT DISTINCT\n ...@@ -178,12 +178,12 @@ SELECT DISTINCT\n
FROM\n FROM\n
<dtml-in from_table_list> <dtml-var sequence-item> AS <dtml-var sequence-key><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in>\n <dtml-in from_table_list> <dtml-var sequence-item> AS <dtml-var sequence-key><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in>\n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
<dtml-let expression="selection_domain.asSQLJoinExpression(category_table_alias = \'domain_category\')">\n <dtml-let expression="portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_domain, category_table_alias = \'domain_category\')">\n
<dtml-if expression> , <dtml-var expression> </dtml-if>\n <dtml-if expression> , <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
<dtml-let expression="selection_report.asSQLJoinExpression(category_table_alias = \'report_category\')">\n <dtml-let expression="portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_report, category_table_alias = \'report_category\')">\n
<dtml-if expression> , <dtml-var expression> </dtml-if>\n <dtml-if expression> , <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
...@@ -194,12 +194,12 @@ WHERE \n ...@@ -194,12 +194,12 @@ WHERE \n
AND <dtml-var where_expression>\n AND <dtml-var where_expression>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
<dtml-let expression="selection_domain.asSQLExpression(category_table_alias = \'domain_category\')">\n <dtml-let expression="portal_selections.buildSQLExpressionFromDomainSelection(selection_domain, category_table_alias = \'domain_category\')">\n
<dtml-if expression> AND <dtml-var expression> </dtml-if>\n <dtml-if expression> AND <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
<dtml-let expression="selection_report.asSQLExpression(strict_membership=1, category_table_alias = \'report_category\')">\n <dtml-let expression="portal_selections.buildSQLExpressionFromDomainSelection(selection_report, strict_membership=1, category_table_alias = \'report_category\')">\n
<dtml-if expression> AND <dtml-var expression> </dtml-if>\n <dtml-if expression> AND <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
...@@ -259,12 +259,12 @@ SELECT DISTINCT\n ...@@ -259,12 +259,12 @@ SELECT DISTINCT\n
FROM\n FROM\n
<dtml-in from_table_list> <dtml-var sequence-item> AS <dtml-var sequence-key><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in>\n <dtml-in from_table_list> <dtml-var sequence-item> AS <dtml-var sequence-key><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in>\n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
<dtml-let expression="selection_domain.asSQLJoinExpression()">\n <dtml-let expression="portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_domain)">\n
<dtml-if expression> , <dtml-var expression> </dtml-if>\n <dtml-if expression> , <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
<dtml-let expression="selection_report.asSQLJoinExpression()">\n <dtml-let expression="portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_report)">\n
<dtml-if expression> , <dtml-var expression> </dtml-if>\n <dtml-if expression> , <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
...@@ -275,12 +275,12 @@ WHERE \n ...@@ -275,12 +275,12 @@ WHERE \n
AND <dtml-var where_expression>\n AND <dtml-var where_expression>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_domain>\n <dtml-if selection_domain>\n
<dtml-let expression="selection_domain.asSQLExpression()">\n <dtml-let expression="portal_selections.buildSQLExpressionFromDomainSelection(selection_domain)">\n
<dtml-if expression> AND <dtml-var expression> </dtml-if>\n <dtml-if expression> AND <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
<dtml-if selection_report>\n <dtml-if selection_report>\n
<dtml-let expression="selection_report.asSQLExpression(strict_membership=1)">\n <dtml-let expression="portal_selections.buildSQLExpressionFromDomainSelection(selection_report, strict_membership=1)">\n
<dtml-if expression> AND <dtml-var expression> </dtml-if>\n <dtml-if expression> AND <dtml-var expression> </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\n </dtml-if>\n
......
...@@ -53,6 +53,7 @@ import string ...@@ -53,6 +53,7 @@ import string
from zLOG import LOG from zLOG import LOG
from Acquisition import Implicit, aq_base from Acquisition import Implicit, aq_base
from Products.ERP5Type.Message import Message from Products.ERP5Type.Message import Message
import warnings
class SelectionError( Exception ): class SelectionError( Exception ):
pass pass
...@@ -1156,6 +1157,37 @@ class SelectionTool( UniqueObject, SimpleItem ): ...@@ -1156,6 +1157,37 @@ class SelectionTool( UniqueObject, SimpleItem ):
# Return the search dialog # Return the search dialog
return getattr(o, dialog_id)(REQUEST=REQUEST) return getattr(o, dialog_id)(REQUEST=REQUEST)
security.declarePublic('buildSQLJoinExpressionFromDomainSelection')
def buildSQLJoinExpressionFromDomainSelection(self, selection_domain,
domain_id=None,
exclude_domain_id=None,
category_table_alias='category'):
if isinstance(selection_domain, DomainSelection):
warnings.warn("To pass a DomainSelection instance is deprecated.\n"
"Please use a domain dict instead.",
DeprecationWarning)
else:
selection_domain = DomainSelection(selection_domain).__of__(self)
return selection_domain.asSQLJoinExpression(category_table_alias = category_table_alias)
security.declarePublic('buildSQLExpressionFromDomainSelection')
def buildSQLExpressionFromDomainSelection(self, selection_domain,
table_map=None, domain_id=None,
exclude_domain_id=None,
strict_membership=0,
join_table="catalog",
join_column="uid",
base_category=None,
category_table_alias='category'):
if isinstance(selection_domain, DomainSelection):
warnings.warn("To pass a DomainSelection instance is deprecated.\n"
"Please use a domain dict instead.",
DeprecationWarning)
else:
selection_domain = DomainSelection(selection_domain).__of__(self)
return selection_domain.asSQLExpression(strict_membership = strict_membership,
category_table_alias = category_table_alias)
def _aq_dynamic(self, name): def _aq_dynamic(self, name):
""" """
Generate viewSearchRelatedDocumentDialog0, Generate viewSearchRelatedDocumentDialog0,
......
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