Commit e9b30af8 authored by Yusei Tahara's avatar Yusei Tahara

2008-2-5 yusei

* Fixed third party column issue and optimize the query.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19053 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b6ec73cf
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="SQL" module="Products.ZSQLMethods.SQL"/>
<tuple/>
</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>query_table</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>table_0</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>table_1</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>_keys</string> </key>
<value>
<list>
<string>table_0</string>
<string>table_1</string>
<string>query_table</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\r\n
table_1\r\n
query_table</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_delivery_related_mirror_section</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[
(\n
<dtml-var table_1>.uid = <dtml-var table_0>.source_section_uid OR\n
<dtml-var table_1>.uid = <dtml-var table_0>.destination_section_uid\n
)\n
AND <dtml-var table_0>.uid = <dtml-var query_table>.uid\n
]]></string> </value>
</item>
<item>
<key> <string>template</string> </key>
<value>
<object>
<klass>
<global name="__newobj__" module="copy_reg"/>
</klass>
<tuple>
<global name="SQL" module="Shared.DC.ZRDB.DA"/>
</tuple>
<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[
(\n
<dtml-var table_1>.uid = <dtml-var table_0>.source_section_uid OR\n
<dtml-var table_1>.uid = <dtml-var table_0>.destination_section_uid\n
)\n
AND <dtml-var table_0>.uid = <dtml-var query_table>.uid\n
]]></string> </value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<key_list>
<key>delivery_mirror_section_title | delivery,catalog/title/z_delivery_related_mirror_section</key>
<key>preferred_gap_id | category,catalog/id/z_related_preferred_gap</key>
<key>preferred_gap_strict_membership_id | category,catalog/id/z_related_strict_membership_preferred_gap</key>
</key_list>
\ No newline at end of file
......@@ -105,7 +105,7 @@
<value> <int>1</int> </value>
</item>
<item>
<key> <string>all_columns</string> </key>
<key> <string>all_columns</string> </key>
<value>
<list>
<tuple>
......@@ -174,7 +174,7 @@
</value>
</item>
<item>
<key> <string>columns</string> </key>
<key> <string>columns</string> </key>
<value>
<list>
<tuple>
......@@ -217,19 +217,19 @@
</value>
</item>
<item>
<key> <string>count_method</string> </key>
<key> <string>count_method</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_params</string> </key>
<key> <string>default_params</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>editable_columns</string> </key>
<key> <string>editable_columns</string> </key>
<value>
<list>
<tuple>
......@@ -276,7 +276,7 @@
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>list_method</string> </key>
<key> <string>list_method</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
......@@ -286,7 +286,7 @@
<value> <int>0</int> </value>
</item>
<item>
<key> <string>portal_types</string> </key>
<key> <string>portal_types</string> </key>
<value>
<list>
<tuple>
......@@ -321,7 +321,7 @@
<value> <int>0</int> </value>
</item>
<item>
<key> <string>search_columns</string> </key>
<key> <string>search_columns</string> </key>
<value>
<list>
<tuple>
......@@ -360,11 +360,11 @@
</value>
</item>
<item>
<key> <string>selection_name</string> </key>
<key> <string>selection_name</string> </key>
<value> <string>accounting_selection</string> </value>
</item>
<item>
<key> <string>sort</string> </key>
<key> <string>sort</string> </key>
<value>
<list>
<tuple>
......@@ -375,7 +375,7 @@
</value>
</item>
<item>
<key> <string>sort_columns</string> </key>
<key> <string>sort_columns</string> </key>
<value>
<list>
<tuple>
......@@ -414,7 +414,7 @@
</value>
</item>
<item>
<key> <string>stat_columns</string> </key>
<key> <string>stat_columns</string> </key>
<value>
<list>
<tuple>
......@@ -429,7 +429,7 @@
</value>
</item>
<item>
<key> <string>stat_method</string> </key>
<key> <string>stat_method</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
</value>
......@@ -439,11 +439,11 @@
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<key> <string>title</string> </key>
<value> <string>Accounting Transactions</string> </value>
</item>
<item>
<key> <string>url_columns</string> </key>
<key> <string>url_columns</string> </key>
<value>
<list>
<tuple>
......
......@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.StandardFields</string>
<string>StringField</string>
</tuple>
<none/>
<global name="StringField" module="Products.Formulator.StandardFields"/>
<tuple/>
</tuple>
</pickle>
<pickle>
......@@ -268,18 +265,15 @@
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.TALESField</string>
<string>TALESMethod</string>
</tuple>
<none/>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>cell/AccountingTransaction_getThirdPartyTitle</string> </value>
<value> <string>cell/delivery_mirror_section_title|cell/AccountingTransaction_getThirdPartyTitle</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -300,32 +300,32 @@
<key> <string>_keys</string> </key>
<value>
<list>
<string>selection</string>
<string>selection_name</string>
<string>selection_domain</string>
<string>selection_report</string>
<string>selection_params</string>
<string>select_expression</string>
<string>from_date</string>
<string>at_date</string>
<string>to_date</string>
<string>node</string>
<string>resource</string>
<string>entity</string>
<string>stat</string>
<string>omit_input</string>
<string>omit_output</string>
<string>amount</string>
<string>amount_range_min</string>
<string>amount_range_max</string>
<string>creation_date_range_min</string>
<string>creation_date_range_max</string>
<string>section_category</string>
<string>count</string>
<string>transaction_uid</string>
<string>specific_reference</string>
<string>no_limit</string>
<string>search_result_keys</string>
<string>selection</string>
<string>selection_name</string>
<string>selection_domain</string>
<string>selection_report</string>
<string>selection_params</string>
<string>select_expression</string>
<string>from_date</string>
<string>at_date</string>
<string>to_date</string>
<string>node</string>
<string>resource</string>
<string>entity</string>
<string>stat</string>
<string>omit_input</string>
<string>omit_output</string>
<string>amount</string>
<string>amount_range_min</string>
<string>amount_range_max</string>
<string>creation_date_range_min</string>
<string>creation_date_range_max</string>
<string>section_category</string>
<string>count</string>
<string>transaction_uid</string>
<string>specific_reference</string>
<string>no_limit</string>
<string>search_result_keys</string>
</list>
</value>
</item>
......@@ -407,7 +407,7 @@ search_result_keys=\'\'</string> </value>
<key> <string>src</string> </key>
<value> <string encoding="cdata"><![CDATA[
<dtml-let query="portal_catalog.buildSQLQuery(query=portal_catalog.getSecurityQuery(**selection_params), **selection_params)">\n
<dtml-let query="portal_catalog.buildSQLQuery(query=portal_catalog.getSecurityQuery(**selection_params), select_expression_key=(\'operation_date\', \'specific_reference\', \'delivery_mirror_section_title\',), **selection_params)">\n
<dtml-let search_result_keys="search_result_keys or portal_catalog.getCatalogSearchResultKeys()">\n
<dtml-let use_movement_table="from_date or to_date or at_date or resource or stat or amount or amount_range_min or amount_range_max">\n
\n
......@@ -598,10 +598,10 @@ search_result_keys=\'\'</string> </value>
<dtml-if stat>\n
SELECT SUM(total_price) AS total_price FROM (\n
SELECT DISTINCT total_price, uid FROM (\n
</dtml-if>\n
\n
<dtml-if count>\n
<dtml-elif count>\n
SELECT COUNT(DISTINCT uid) AS count FROM (\n
<dtml-else>\n
SELECT * from (\n
</dtml-if>\n
\n
\n
......@@ -625,9 +625,16 @@ search_result_keys=\'\'</string> </value>
<dtml-unless sequence-start>,</dtml-unless>\n
<dtml-var sequence-item>\n
</dtml-in>\n
, delivery.start_date as operation_date\n
, catalog.source_reference as specific_reference\n
<dtml-if "not (stat or count) and query[\'order_by_expression\']">\n
,<dtml-var "query[\'order_by_expression\'].split(\' \')[0]">\n
<dtml-let order_column="query[\'order_by_expression\'].split(\' \')[0]">\n
<dtml-if "not order_column in (\'operation_date\', \'specific_reference\')">\n
,<dtml-var "query[\'order_by_expression\'].split(\' \')[0]">\n
</dtml-if>\n
</dtml-let>\n
</dtml-if>\n
<dtml-if delivery_mirror_section_title>, mirror_section_catalog.title as delivery_mirror_section_title</dtml-if>\n
<dtml-if select_expression><dtml-var select_expression> </dtml-if>\n
</dtml-if>\n
\n
......@@ -647,6 +654,7 @@ search_result_keys=\'\'</string> </value>
<dtml-if "stat or omit_input or omit_output or node">\n
stock, catalog as child, </dtml-if>\n
<dtml-if "section_category">category, catalog as section, </dtml-if>\n
<dtml-if "delivery_mirror_section_title">delivery AS mirror_section_delivery, catalog AS mirror_section_catalog,</dtml-if>\n
catalog,\n
delivery\n
\n
......@@ -697,6 +705,11 @@ search_result_keys=\'\'</string> </value>
AND category.category_uid =\n
<dtml-var "portal_categories.restrictedTraverse(section_category).getUid()">\n
</dtml-if>\n
<dtml-if "delivery_mirror_section_title">\n
AND mirror_section_catalog.uid = mirror_section_delivery.destination_section_uid\n
AND mirror_section_delivery.uid = catalog.uid\n
AND <dtml-sqltest delivery_mirror_section_title type=string op=like column=mirror_section_catalog.title>\n
</dtml-if>\n
\n
<dtml-comment>\n
-- FIXME: we want stop date when we are destination_section and start_date when\n
......@@ -790,10 +803,16 @@ UNION\n
<dtml-unless sequence-start>,</dtml-unless>\n
<dtml-var sequence-item>\n
</dtml-in>\n
, delivery.stop_date as operation_date\n
, catalog.destination_reference as specific_reference\n
<dtml-if "not (stat or count) and query[\'order_by_expression\']">\n
,<dtml-var "query[\'order_by_expression\'].split(\' \')[0]">\n
<dtml-let order_column="query[\'order_by_expression\'].split(\' \')[0]">\n
<dtml-if "not order_column in (\'operation_date\', \'specific_reference\')">\n
,<dtml-var "query[\'order_by_expression\'].split(\' \')[0]">\n
</dtml-if>\n
</dtml-let>\n
</dtml-if>\n
\n
<dtml-if delivery_mirror_section_title>, mirror_section_catalog.title as delivery_mirror_section_title</dtml-if>\n
<dtml-if select_expression><dtml-var select_expression> </dtml-if>\n
</dtml-if>\n
\n
......@@ -813,6 +832,7 @@ UNION\n
<dtml-if "stat or omit_input or omit_output or node">\n
stock, catalog as child, </dtml-if>\n
<dtml-if "section_category">category, catalog as section, </dtml-if>\n
<dtml-if "delivery_mirror_section_title">delivery AS mirror_section_delivery, catalog AS mirror_section_catalog,</dtml-if>\n
catalog,\n
delivery\n
\n
......@@ -863,7 +883,12 @@ UNION\n
AND category.category_uid =\n
<dtml-var "portal_categories.restrictedTraverse(section_category).getUid()">\n
</dtml-if>\n
\n
<dtml-if "delivery_mirror_section_title">\n
AND mirror_section_catalog.uid = mirror_section_delivery.source_section_uid\n
AND mirror_section_delivery.uid = catalog.uid\n
AND <dtml-sqltest delivery_mirror_section_title type=string op=like column=mirror_section_catalog.title>\n
</dtml-if>\n
\n
<dtml-comment>\n
-- FIXME: we want stop date when we are destination_section and start_date when\n
-- we are source_section (one solution is to read in stock.date, but we try\n
......@@ -941,14 +966,15 @@ UNION\n
\n
<dtml-if "count">\n
) as catalog\n
</dtml-if>\n
\n
<dtml-if "stat">\n
<dtml-elif "stat">\n
) as sb\n
) as catalog\n
<dtml-else>\n
) as catalog\n
</dtml-if>\n
\n
<dtml-if "not (stat or count)">\n
GROUP BY uid\n
<dtml-if "query[\'order_by_expression\']">\n
ORDER BY <dtml-var "query[\'order_by_expression\'].split(\'.\')[-1]">\n
</dtml-if>\n
......@@ -1007,7 +1033,7 @@ UNION\n
<key> <string>raw</string> </key>
<value> <string encoding="cdata"><![CDATA[
<dtml-let query="portal_catalog.buildSQLQuery(query=portal_catalog.getSecurityQuery(**selection_params), **selection_params)">\n
<dtml-let query="portal_catalog.buildSQLQuery(query=portal_catalog.getSecurityQuery(**selection_params), select_expression_key=(\'operation_date\', \'specific_reference\', \'delivery_mirror_section_title\',), **selection_params)">\n
<dtml-let search_result_keys="search_result_keys or portal_catalog.getCatalogSearchResultKeys()">\n
<dtml-let use_movement_table="from_date or to_date or at_date or resource or stat or amount or amount_range_min or amount_range_max">\n
\n
......@@ -1198,10 +1224,10 @@ UNION\n
<dtml-if stat>\n
SELECT SUM(total_price) AS total_price FROM (\n
SELECT DISTINCT total_price, uid FROM (\n
</dtml-if>\n
\n
<dtml-if count>\n
<dtml-elif count>\n
SELECT COUNT(DISTINCT uid) AS count FROM (\n
<dtml-else>\n
SELECT * from (\n
</dtml-if>\n
\n
\n
......@@ -1225,9 +1251,16 @@ UNION\n
<dtml-unless sequence-start>,</dtml-unless>\n
<dtml-var sequence-item>\n
</dtml-in>\n
, delivery.start_date as operation_date\n
, catalog.source_reference as specific_reference\n
<dtml-if "not (stat or count) and query[\'order_by_expression\']">\n
,<dtml-var "query[\'order_by_expression\'].split(\' \')[0]">\n
<dtml-let order_column="query[\'order_by_expression\'].split(\' \')[0]">\n
<dtml-if "not order_column in (\'operation_date\', \'specific_reference\')">\n
,<dtml-var "query[\'order_by_expression\'].split(\' \')[0]">\n
</dtml-if>\n
</dtml-let>\n
</dtml-if>\n
<dtml-if delivery_mirror_section_title>, mirror_section_catalog.title as delivery_mirror_section_title</dtml-if>\n
<dtml-if select_expression><dtml-var select_expression> </dtml-if>\n
</dtml-if>\n
\n
......@@ -1247,6 +1280,7 @@ UNION\n
<dtml-if "stat or omit_input or omit_output or node">\n
stock, catalog as child, </dtml-if>\n
<dtml-if "section_category">category, catalog as section, </dtml-if>\n
<dtml-if "delivery_mirror_section_title">delivery AS mirror_section_delivery, catalog AS mirror_section_catalog,</dtml-if>\n
catalog,\n
delivery\n
\n
......@@ -1297,6 +1331,11 @@ UNION\n
AND category.category_uid =\n
<dtml-var "portal_categories.restrictedTraverse(section_category).getUid()">\n
</dtml-if>\n
<dtml-if "delivery_mirror_section_title">\n
AND mirror_section_catalog.uid = mirror_section_delivery.destination_section_uid\n
AND mirror_section_delivery.uid = catalog.uid\n
AND <dtml-sqltest delivery_mirror_section_title type=string op=like column=mirror_section_catalog.title>\n
</dtml-if>\n
\n
<dtml-comment>\n
-- FIXME: we want stop date when we are destination_section and start_date when\n
......@@ -1390,10 +1429,16 @@ UNION\n
<dtml-unless sequence-start>,</dtml-unless>\n
<dtml-var sequence-item>\n
</dtml-in>\n
, delivery.stop_date as operation_date\n
, catalog.destination_reference as specific_reference\n
<dtml-if "not (stat or count) and query[\'order_by_expression\']">\n
,<dtml-var "query[\'order_by_expression\'].split(\' \')[0]">\n
<dtml-let order_column="query[\'order_by_expression\'].split(\' \')[0]">\n
<dtml-if "not order_column in (\'operation_date\', \'specific_reference\')">\n
,<dtml-var "query[\'order_by_expression\'].split(\' \')[0]">\n
</dtml-if>\n
</dtml-let>\n
</dtml-if>\n
\n
<dtml-if delivery_mirror_section_title>, mirror_section_catalog.title as delivery_mirror_section_title</dtml-if>\n
<dtml-if select_expression><dtml-var select_expression> </dtml-if>\n
</dtml-if>\n
\n
......@@ -1413,6 +1458,7 @@ UNION\n
<dtml-if "stat or omit_input or omit_output or node">\n
stock, catalog as child, </dtml-if>\n
<dtml-if "section_category">category, catalog as section, </dtml-if>\n
<dtml-if "delivery_mirror_section_title">delivery AS mirror_section_delivery, catalog AS mirror_section_catalog,</dtml-if>\n
catalog,\n
delivery\n
\n
......@@ -1463,7 +1509,12 @@ UNION\n
AND category.category_uid =\n
<dtml-var "portal_categories.restrictedTraverse(section_category).getUid()">\n
</dtml-if>\n
\n
<dtml-if "delivery_mirror_section_title">\n
AND mirror_section_catalog.uid = mirror_section_delivery.source_section_uid\n
AND mirror_section_delivery.uid = catalog.uid\n
AND <dtml-sqltest delivery_mirror_section_title type=string op=like column=mirror_section_catalog.title>\n
</dtml-if>\n
\n
<dtml-comment>\n
-- FIXME: we want stop date when we are destination_section and start_date when\n
-- we are source_section (one solution is to read in stock.date, but we try\n
......@@ -1541,14 +1592,15 @@ UNION\n
\n
<dtml-if "count">\n
) as catalog\n
</dtml-if>\n
\n
<dtml-if "stat">\n
<dtml-elif "stat">\n
) as sb\n
) as catalog\n
<dtml-else>\n
) as catalog\n
</dtml-if>\n
\n
<dtml-if "not (stat or count)">\n
GROUP BY uid\n
<dtml-if "query[\'order_by_expression\']">\n
ORDER BY <dtml-var "query[\'order_by_expression\'].split(\'.\')[-1]">\n
</dtml-if>\n
......
......@@ -66,21 +66,12 @@
<item>
<key> <string>_body</string> </key>
<value> <string># XXX bad name: AccountingTransaction_getMirrorSectionTitle sounds more consistent\n
if selection_name is None:\n
# TODO: this should definitivly be REQUEST chached\n
selection_name = \'accounting_selection\'\n
\n
section_category=context.portal_selections.getSelectionParamsFor(selection_name).get(\'section_category\')\n
if not section_category:\n
return\n
\n
if brain is not None:\n
transaction = brain.getObject()\n
else:\n
transaction = context\n
\n
source_section = transaction.getSourceSectionValue()\n
if source_section is not None and source_section.isMemberOf(section_category):\n
if transaction.AccountingTransaction_isSourceView():\n
return transaction.getDestinationSectionTitle()\n
return transaction.getSourceSectionTitle()\n
</string> </value>
......@@ -131,10 +122,8 @@ return transaction.getSourceSectionTitle()\n
<string>kw</string>
<string>None</string>
<string>_getattr_</string>
<string>context</string>
<string>section_category</string>
<string>transaction</string>
<string>source_section</string>
<string>context</string>
</tuple>
</value>
</item>
......
2008-2-5 yusei
* Fixed third party column issue and optimize the query.
2008-2-4 yusei
* Optimize the query of accounting module list view.
* Fix displayed value of accounting operation date and make specific_reference column sortable.
......
569
\ No newline at end of file
570
\ No newline at end of file
erp5_mysql_innodb/z_delivery_related_mirror_section
erp5_mysql_innodb/z_related_preferred_gap
erp5_mysql_innodb/z_related_strict_membership_preferred_gap
\ No newline at end of file
preferred_gap_id | category,catalog/id/z_related_preferred_gap
preferred_gap_strict_membership_id | category,catalog/id/z_related_strict_membership_preferred_gap
delivery_mirror_section_title | delivery,catalog/title/z_delivery_related_mirror_section
\ No newline at end of file
preferred_gap_strict_membership_id | category,catalog/id/z_related_strict_membership_preferred_gap
\ No newline at end of file
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