Commit 13d428d5 authored by Yusei Tahara's avatar Yusei Tahara

Optimization for third party title and url.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19540 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent da2ab792
......@@ -636,6 +636,8 @@ destination_section_where_expression</string> </value>
SELECT COUNT(DISTINCT uid) AS count FROM (\n
<dtml-else>\n
SELECT catalog.*,\n
( SELECT path FROM catalog as mirror_catalog WHERE mirror_catalog.uid=catalog.delivery_mirror_section_uid ) AS delivery_mirror_section_path,\n
( SELECT title FROM catalog as mirror_catalog WHERE mirror_catalog.uid=catalog.delivery_mirror_section_uid ) AS delivery_mirror_section_title,\n
( SELECT IFNULL(SUM(stock.total_price), 0) FROM stock, catalog AS child WHERE child.uid = stock.uid AND child.parent_uid = catalog.uid AND stock.section_uid=catalog.category_uid AND stock.total_price > 0 AND <dtml-sqltest accounting_movement_list type=string column=child.portal_type op=eq multiple>) AS debit,\n
( SELECT IFNULL(-SUM(stock.total_price), 0) FROM stock, catalog AS child WHERE child.uid = stock.uid AND child.parent_uid = catalog.uid AND stock.section_uid=catalog.category_uid AND stock.total_price < 0 AND <dtml-sqltest accounting_movement_list type=string column=child.portal_type op=eq multiple>) AS credit\n
FROM (\n
......@@ -662,6 +664,7 @@ destination_section_where_expression</string> </value>
<dtml-var sequence-item>\n
</dtml-in>\n
, delivery.start_date as operation_date\n
, delivery.destination_section_uid as delivery_mirror_section_uid\n
, \'source\' as section_mark\n
, catalog.source_reference as specific_reference\n
<dtml-if "section_category">, category.uid as category_uid</dtml-if>\n
......@@ -672,10 +675,6 @@ destination_section_where_expression</string> </value>
</dtml-if>\n
</dtml-let>\n
</dtml-if>\n
<dtml-if delivery_mirror_section_title>\n
, mirror_section_catalog.title as delivery_mirror_section_title\n
, mirror_section_catalog.path as delivery_mirror_section_path\n
</dtml-if>\n
<dtml-if select_expression><dtml-var select_expression> </dtml-if>\n
</dtml-if>\n
\n
......@@ -854,6 +853,7 @@ UNION\n
<dtml-var sequence-item>\n
</dtml-in>\n
, delivery.stop_date as operation_date\n
, delivery.source_section_uid as delivery_mirror_section_uid\n
, \'destination\' as section_mark\n
, catalog.destination_reference as specific_reference\n
<dtml-if "section_category">, category.uid as category_uid</dtml-if>\n
......@@ -864,10 +864,6 @@ UNION\n
</dtml-if>\n
</dtml-let>\n
</dtml-if>\n
<dtml-if delivery_mirror_section_title>\n
, mirror_section_catalog.title as delivery_mirror_section_title\n
, mirror_section_catalog.path as delivery_mirror_section_path\n
</dtml-if>\n
<dtml-if select_expression><dtml-var select_expression> </dtml-if>\n
</dtml-if>\n
\n
......@@ -1297,6 +1293,8 @@ UNION\n
SELECT COUNT(DISTINCT uid) AS count FROM (\n
<dtml-else>\n
SELECT catalog.*,\n
( SELECT path FROM catalog as mirror_catalog WHERE mirror_catalog.uid=catalog.delivery_mirror_section_uid ) AS delivery_mirror_section_path,\n
( SELECT title FROM catalog as mirror_catalog WHERE mirror_catalog.uid=catalog.delivery_mirror_section_uid ) AS delivery_mirror_section_title,\n
( SELECT IFNULL(SUM(stock.total_price), 0) FROM stock, catalog AS child WHERE child.uid = stock.uid AND child.parent_uid = catalog.uid AND stock.section_uid=catalog.category_uid AND stock.total_price > 0 AND <dtml-sqltest accounting_movement_list type=string column=child.portal_type op=eq multiple>) AS debit,\n
( SELECT IFNULL(-SUM(stock.total_price), 0) FROM stock, catalog AS child WHERE child.uid = stock.uid AND child.parent_uid = catalog.uid AND stock.section_uid=catalog.category_uid AND stock.total_price < 0 AND <dtml-sqltest accounting_movement_list type=string column=child.portal_type op=eq multiple>) AS credit\n
FROM (\n
......@@ -1323,6 +1321,7 @@ UNION\n
<dtml-var sequence-item>\n
</dtml-in>\n
, delivery.start_date as operation_date\n
, delivery.destination_section_uid as delivery_mirror_section_uid\n
, \'source\' as section_mark\n
, catalog.source_reference as specific_reference\n
<dtml-if "section_category">, category.uid as category_uid</dtml-if>\n
......@@ -1333,10 +1332,6 @@ UNION\n
</dtml-if>\n
</dtml-let>\n
</dtml-if>\n
<dtml-if delivery_mirror_section_title>\n
, mirror_section_catalog.title as delivery_mirror_section_title\n
, mirror_section_catalog.path as delivery_mirror_section_path\n
</dtml-if>\n
<dtml-if select_expression><dtml-var select_expression> </dtml-if>\n
</dtml-if>\n
\n
......@@ -1515,6 +1510,7 @@ UNION\n
<dtml-var sequence-item>\n
</dtml-in>\n
, delivery.stop_date as operation_date\n
, delivery.source_section_uid as delivery_mirror_section_uid\n
, \'destination\' as section_mark\n
, catalog.destination_reference as specific_reference\n
<dtml-if "section_category">, category.uid as category_uid</dtml-if>\n
......@@ -1525,10 +1521,6 @@ UNION\n
</dtml-if>\n
</dtml-let>\n
</dtml-if>\n
<dtml-if delivery_mirror_section_title>\n
, mirror_section_catalog.title as delivery_mirror_section_title\n
, mirror_section_catalog.path as delivery_mirror_section_path\n
</dtml-if>\n
<dtml-if select_expression><dtml-var select_expression> </dtml-if>\n
</dtml-if>\n
\n
......
......@@ -77,16 +77,10 @@ if brain is not None:\n
else:\n
transaction = context\n
\n
mirror_section_key = \'mirror_section_value_%s\' % transaction.getId()\n
\n
try:\n
mirror_section = context.REQUEST[mirror_section_key]\n
except KeyError:\n
if transaction.AccountingTransaction_isSourceView():\n
mirror_section = transaction.getDestinationSectionValue()\n
else:\n
mirror_section = transaction.getSourceSectionValue()\n
context.REQUEST.set(mirror_section_key, mirror_section)\n
if transaction.AccountingTransaction_isSourceView():\n
mirror_section = transaction.getDestinationSectionValue()\n
else:\n
mirror_section = transaction.getSourceSectionValue()\n
\n
if mirror_section is not None:\n
return mirror_section.getTitle()\n
......@@ -141,10 +135,7 @@ if mirror_section is not None:\n
<string>AttributeError</string>
<string>None</string>
<string>transaction</string>
<string>mirror_section_key</string>
<string>_getitem_</string>
<string>mirror_section</string>
<string>KeyError</string>
</tuple>
</value>
</item>
......
......@@ -66,10 +66,15 @@
<item>
<key> <string>_body</string> </key>
<value> <string># XXX bad name: AccountingTransaction_getMirrorSectionUrl sounds more consistent\n
url_template = \'%s/Entity_viewAccountingTransactionList?reset:int=1\'\n
view_name = \'Entity_viewAccountingTransactionList?reset:int=1\'\n
\n
try:\n
return url_template % context.getPortalObject().restrictedTraverse(context.delivery_mirror_section_path).absolute_url()\n
delivery_mirror_section_path = context.delivery_mirror_section_path\n
if delivery_mirror_section_path is not None:\n
relative_path = \'/\'.join(delivery_mirror_section_path.split(\'/\')[2:])\n
return \'%s/%s/%s\' % (context.portal_url(), relative_path, view_name)\n
else:\n
return None\n
except AttributeError:\n
pass\n
\n
......@@ -78,19 +83,13 @@ if brain is not None:\n
else:\n
transaction = context\n
\n
mirror_section_key = \'mirror_section_value_%s\' % transaction.getId()\n
\n
try:\n
mirror_section = context.REQUEST[mirror_section_key]\n
except KeyError:\n
if transaction.AccountingTransaction_isSourceView():\n
mirror_section = transaction.getDestinationSectionValue()\n
else:\n
mirror_section = transaction.getSourceSectionValue()\n
context.REQUEST.set(mirror_section_key, mirror_section)\n
if transaction.AccountingTransaction_isSourceView():\n
mirror_section = transaction.getDestinationSectionValue()\n
else:\n
mirror_section = transaction.getSourceSectionValue()\n
\n
if mirror_section is not None:\n
return url_template % mirror_section.absolute_url()\n
return \'%s/%s\' % (mirror_section.absolute_url(), view_name)\n
</string> </value>
</item>
<item>
......@@ -137,16 +136,16 @@ if mirror_section is not None:\n
<string>selection</string>
<string>selection_name</string>
<string>kwd</string>
<string>url_template</string>
<string>view_name</string>
<string>_getattr_</string>
<string>context</string>
<string>AttributeError</string>
<string>delivery_mirror_section_path</string>
<string>None</string>
<string>transaction</string>
<string>mirror_section_key</string>
<string>_getitem_</string>
<string>relative_path</string>
<string>AttributeError</string>
<string>transaction</string>
<string>mirror_section</string>
<string>KeyError</string>
</tuple>
</value>
</item>
......
619
\ No newline at end of file
621
\ 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