Commit 4e5fe73e authored by Jérome Perrin's avatar Jérome Perrin

Added support for resource/node/payment/section_category/mirror_section

_category_strict_membership that works the same way as *_category, but also
checks for strict membership.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8237 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 758eb58a
......@@ -206,18 +206,33 @@ class SimulationTool (BaseTool):
return property_uid_list
def _generateSQLKeywordDict(self, table='stock',
# dates
from_date=None, to_date=None, at_date=None,
# instances
resource=None, node=None, payment=None,
section=None, mirror_section=None,
item=None, input=0, output=0,
section=None, mirror_section=None, item=None,
# used for tracking
input=0, output=0,
# categories
resource_category=None, node_category=None, payment_category=None,
section_category=None, mirror_section_category=None,
# categories with strict membership
resource_category_strict_membership=None,
node_category_strict_membership=None,
payment_category_strict_membership=None,
section_category_strict_membership=None,
mirror_section_category_strict_membership=None,
# simulation_state
strict_simulation_state=0,
simulation_state=None, transit_simulation_state = None, omit_transit=0,
input_simulation_state = None, output_simulation_state=None,
input_simulation_state=None, output_simulation_state=None,
# variations
variation_text=None, sub_variation_text=None,
variation_category=None, resource_uid=None, node_uid=None,
section_uid=None, **kw) :
variation_category=None,
# uids
resource_uid=None, node_uid=None, section_uid=None,
# keywords for related keys
**kw):
"""
generates keywords and calls buildSqlQuery
"""
......@@ -248,7 +263,7 @@ class SimulationTool (BaseTool):
if len(date_dict) :
new_kw[table + '.date'] = date_dict
# clear ambiguities
# Some columns exists on multiple tables, we have to clear ambiguities
if resource_uid is not None :
new_kw[table + '.resource_uid'] = resource_uid
if section_uid is not None :
......@@ -280,15 +295,19 @@ class SimulationTool (BaseTool):
if len(mirror_section_uid_list) :
new_kw[table + '.mirror_section_uid'] = mirror_section_uid_list
variation_text_list = self._generatePropertyUidList(variation_text, as_text=1)
variation_text_list = self._generatePropertyUidList(variation_text,
as_text=1)
if len(variation_text_list) :
new_kw[table + '.variation_text'] = variation_text_list
sub_variation_text_list = self._generatePropertyUidList(sub_variation_text, as_text=1)
sub_variation_text_list = self._generatePropertyUidList(
sub_variation_text, as_text=1)
if len(sub_variation_text_list) :
new_kw[table + '.sub_variation_text'] = sub_variation_text_list
resource_category_uid_list = self._generatePropertyUidList(resource_category)
# category membership
resource_category_uid_list = self._generatePropertyUidList(
resource_category)
if len(resource_category_uid_list) :
new_kw[table + '_resource_category_uid'] = resource_category_uid_list
......@@ -304,9 +323,43 @@ class SimulationTool (BaseTool):
if len(section_category_uid_list) :
new_kw[table + '_section_category_uid'] = section_category_uid_list
mirror_section_category_uid_list = self._generatePropertyUidList(mirror_section_category)
mirror_section_category_uid_list = self._generatePropertyUidList(
mirror_section_category)
if len(mirror_section_category_uid_list) :
new_kw[table + '_mirror_section_category_uid'] = mirror_section_category_uid_list
new_kw[table + '_mirror_section_category_uid'] =\
mirror_section_category_uid_list
# category strict membership
resource_category_strict_membership_uid_list =\
self._generatePropertyUidList(resource_category_strict_membership)
if len(resource_category_strict_membership_uid_list) :
new_kw[table + '_resource_category_strict_membership_uid'] =\
resource_category_strict_membership_uid_list
node_category_strict_membership_uid_list =\
self._generatePropertyUidList(node_category_strict_membership)
if len(node_category_strict_membership_uid_list) :
new_kw[table + '_node_category_strict_membership_uid'] =\
node_category_strict_membership_uid_list
payment_category_strict_membership_uid_list =\
self._generatePropertyUidList(payment_category_strict_membership)
if len(payment_category_strict_membership_uid_list) :
new_kw[table + '_payment_category_strict_membership_uid'] =\
payment_category_strict_membership_uid_list
section_category_strict_membership_uid_list =\
self._generatePropertyUidList(section_category_strict_membership)
if len(section_category_strict_membership_uid_list) :
new_kw[table + '_section_category_strict_membership_uid'] =\
section_category_strict_membership_uid_list
mirror_section_category_strict_membership_uid_list =\
self._generatePropertyUidList(
mirror_section_category_strict_membership)
if len(mirror_section_category_strict_membership_uid_list) :
new_kw[table + '_mirror_section_category_strict_membership_uid'] =\
mirror_section_category_strict_membership_uid_list
#variation_category_uid_list = self._generatePropertyUidList(variation_category)
#if len(variation_category_uid_list) :
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.ZSQLMethods.SQL</string>
<string>SQL</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_arg</string> </key>
<value>
<object>
<klass>
<global name="Args" module="Shared.DC.ZRDB.Aqueduct"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_data</string> </key>
<value>
<dictionary>
<item>
<key> <string>table_0</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>_keys</string> </key>
<value>
<list>
<string>table_0</string>
</list>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>allow_simple_one_argument_traversal</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>arguments_src</string> </key>
<value> <string>table_0</string> </value>
</item>
<item>
<key> <string>cache_time_</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>class_file_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>class_name_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>connection_hook</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>connection_id</string> </key>
<value> <string>erp5_sql_connection</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>z_related_strict_membership_mirror_section_uid_from_stock</string> </value>
</item>
<item>
<key> <string>max_cache_</string> </key>
<value> <int>100</int> </value>
</item>
<item>
<key> <string>max_rows_</string> </key>
<value> <int>1000</int> </value>
</item>
<item>
<key> <string>src</string> </key>
<value> <string encoding="cdata"><![CDATA[
<dtml-var table_0>.uid = stock.mirror_section_uid AND\n
<dtml-var table_0>.category_strict_membership = 1\n
]]></string> </value>
</item>
<item>
<key> <string>template</string> </key>
<value>
<object>
<klass>
<global name="SQL" module="Shared.DC.ZRDB.DA"/>
</klass>
<none/>
<state>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string encoding="cdata"><![CDATA[
<string>
]]></string> </value>
</item>
<item>
<key> <string>_vars</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>globals</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>raw</string> </key>
<value> <string encoding="cdata"><![CDATA[
<dtml-var table_0>.uid = stock.mirror_section_uid AND\n
<dtml-var table_0>.category_strict_membership = 1\n
]]></string> </value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.ZSQLMethods.SQL</string>
<string>SQL</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_arg</string> </key>
<value>
<object>
<klass>
<global name="Args" module="Shared.DC.ZRDB.Aqueduct"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_data</string> </key>
<value>
<dictionary>
<item>
<key> <string>table_0</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>_keys</string> </key>
<value>
<list>
<string>table_0</string>
</list>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>allow_simple_one_argument_traversal</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>arguments_src</string> </key>
<value> <string>table_0</string> </value>
</item>
<item>
<key> <string>cache_time_</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>class_file_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>class_name_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>connection_hook</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>connection_id</string> </key>
<value> <string>erp5_sql_connection</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>z_related_strict_membership_node_uid_from_stock</string> </value>
</item>
<item>
<key> <string>max_cache_</string> </key>
<value> <int>100</int> </value>
</item>
<item>
<key> <string>max_rows_</string> </key>
<value> <int>1000</int> </value>
</item>
<item>
<key> <string>src</string> </key>
<value> <string encoding="cdata"><![CDATA[
<dtml-var table_0>.uid = stock.node_uid AND\n
<dtml-var table_0>.category_strict_membership = 1\n
]]></string> </value>
</item>
<item>
<key> <string>template</string> </key>
<value>
<object>
<klass>
<global name="SQL" module="Shared.DC.ZRDB.DA"/>
</klass>
<none/>
<state>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string encoding="cdata"><![CDATA[
<string>
]]></string> </value>
</item>
<item>
<key> <string>_vars</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>globals</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>raw</string> </key>
<value> <string encoding="cdata"><![CDATA[
<dtml-var table_0>.uid = stock.node_uid AND\n
<dtml-var table_0>.category_strict_membership = 1\n
]]></string> </value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.ZSQLMethods.SQL</string>
<string>SQL</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_arg</string> </key>
<value>
<object>
<klass>
<global name="Args" module="Shared.DC.ZRDB.Aqueduct"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_data</string> </key>
<value>
<dictionary>
<item>
<key> <string>table_0</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>_keys</string> </key>
<value>
<list>
<string>table_0</string>
</list>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>allow_simple_one_argument_traversal</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>arguments_src</string> </key>
<value> <string>table_0</string> </value>
</item>
<item>
<key> <string>cache_time_</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>class_file_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>class_name_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>connection_hook</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>connection_id</string> </key>
<value> <string>erp5_sql_connection</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>z_related_strict_membership_payment_uid_from_stock</string> </value>
</item>
<item>
<key> <string>max_cache_</string> </key>
<value> <int>100</int> </value>
</item>
<item>
<key> <string>max_rows_</string> </key>
<value> <int>1000</int> </value>
</item>
<item>
<key> <string>src</string> </key>
<value> <string encoding="cdata"><![CDATA[
<dtml-var table_0>.uid = stock.payment_uid AND\n
<dtml-var table_0>.category_strict_membership = 1\n
]]></string> </value>
</item>
<item>
<key> <string>template</string> </key>
<value>
<object>
<klass>
<global name="SQL" module="Shared.DC.ZRDB.DA"/>
</klass>
<none/>
<state>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string encoding="cdata"><![CDATA[
<string>
]]></string> </value>
</item>
<item>
<key> <string>_vars</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>globals</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>raw</string> </key>
<value> <string encoding="cdata"><![CDATA[
<dtml-var table_0>.uid = stock.payment_uid AND\n
<dtml-var table_0>.category_strict_membership = 1\n
]]></string> </value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.ZSQLMethods.SQL</string>
<string>SQL</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_arg</string> </key>
<value>
<object>
<klass>
<global name="Args" module="Shared.DC.ZRDB.Aqueduct"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_data</string> </key>
<value>
<dictionary>
<item>
<key> <string>table_0</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>_keys</string> </key>
<value>
<list>
<string>table_0</string>
</list>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>allow_simple_one_argument_traversal</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>arguments_src</string> </key>
<value> <string>table_0</string> </value>
</item>
<item>
<key> <string>cache_time_</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>class_file_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>class_name_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>connection_hook</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>connection_id</string> </key>
<value> <string>erp5_sql_connection</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>z_related_strict_membership_resource_uid_from_stock</string> </value>
</item>
<item>
<key> <string>max_cache_</string> </key>
<value> <int>100</int> </value>
</item>
<item>
<key> <string>max_rows_</string> </key>
<value> <int>1000</int> </value>
</item>
<item>
<key> <string>src</string> </key>
<value> <string encoding="cdata"><![CDATA[
<dtml-var table_0>.uid = stock.resource_uid AND\n
<dtml-var table_0>.category_strict_membership = 1\n
]]></string> </value>
</item>
<item>
<key> <string>template</string> </key>
<value>
<object>
<klass>
<global name="SQL" module="Shared.DC.ZRDB.DA"/>
</klass>
<none/>
<state>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string encoding="cdata"><![CDATA[
<string>
]]></string> </value>
</item>
<item>
<key> <string>_vars</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>globals</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>raw</string> </key>
<value> <string encoding="cdata"><![CDATA[
<dtml-var table_0>.uid = stock.resource_uid AND\n
<dtml-var table_0>.category_strict_membership = 1\n
]]></string> </value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.ZSQLMethods.SQL</string>
<string>SQL</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_arg</string> </key>
<value>
<object>
<klass>
<global name="Args" module="Shared.DC.ZRDB.Aqueduct"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_data</string> </key>
<value>
<dictionary>
<item>
<key> <string>table_0</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>_keys</string> </key>
<value>
<list>
<string>table_0</string>
</list>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>allow_simple_one_argument_traversal</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>arguments_src</string> </key>
<value> <string>table_0</string> </value>
</item>
<item>
<key> <string>cache_time_</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>class_file_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>class_name_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>connection_hook</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>connection_id</string> </key>
<value> <string>erp5_sql_connection</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>z_related_strict_membership_section_uid_from_stock</string> </value>
</item>
<item>
<key> <string>max_cache_</string> </key>
<value> <int>100</int> </value>
</item>
<item>
<key> <string>max_rows_</string> </key>
<value> <int>1000</int> </value>
</item>
<item>
<key> <string>src</string> </key>
<value> <string encoding="cdata"><![CDATA[
<dtml-var table_0>.uid = stock.section_uid AND\n
<dtml-var table_0>.category_strict_membership = 1\n
]]></string> </value>
</item>
<item>
<key> <string>template</string> </key>
<value>
<object>
<klass>
<global name="SQL" module="Shared.DC.ZRDB.DA"/>
</klass>
<none/>
<state>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string encoding="cdata"><![CDATA[
<string>
]]></string> </value>
</item>
<item>
<key> <string>_vars</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>globals</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>raw</string> </key>
<value> <string encoding="cdata"><![CDATA[
<dtml-var table_0>.uid = stock.section_uid AND\n
<dtml-var table_0>.category_strict_membership = 1\n
]]></string> </value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -13,10 +13,15 @@
<key>parent_specialise_portal_type | category,catalog/portal_type/z_related_parent_specialise</key>
<key>predicate_uid | predicate/uid/z_related_predicate</key>
<key>resourceType | movement,catalog/portal_type/z_related_resource</key>
<key>stock_mirror_section_category_strict_membership_uid | category/category_uid/z_related_strict_membership_mirror_section_uid_from_stock</key>
<key>stock_mirror_section_category_uid | category/category_uid/z_related_mirror_section_uid_from_stock</key>
<key>stock_node_category_strict_membership_uid | category/category_uid/z_related_strict_membership_node_uid_from_stock</key>
<key>stock_node_category_uid | category/category_uid/z_related_node_uid_from_stock</key>
<key>stock_payment_category_strict_membership_uid | category/category_uid/z_related_strict_membership_payment_uid_from_stock</key>
<key>stock_payment_category_uid | category/category_uid/z_related_payment_uid_from_stock</key>
<key>stock_resource_category_strict_membership_uid | category/category_uid/z_related_strict_membership_resource_uid_from_stock</key>
<key>stock_resource_category_uid | category/category_uid/z_related_resource_uid_from_stock</key>
<key>stock_section_category_strict_membership_uid | category/category_uid/z_related_strict_membership_section_uid_from_stock</key>
<key>stock_section_category_uid | category/category_uid/z_related_section_uid_from_stock</key>
<key>translated_opportunity_state | translation/translated_message/z_related_translated_opportunity_state</key>
<key>translated_opportunity_state_title | translation/translated_message/z_related_translated_opportunity_state</key>
......
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