Commit 163c208d authored by Yoshinori Okuji's avatar Yoshinori Okuji

2005-12-08 yo

* Fix the LEFT JOIN syntax in PaymentTransaction_zSelectMovement and SaleInvoiceTransaction_zSelectMovemen.

2005-12-06 yo
* Remove Resource_zGetInventory_old.
* Fix the LEFT JOIN in Account_zGetAccountingTransactionList.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4556 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 325c15ce
......@@ -239,7 +239,11 @@ SELECT\n
stock.quantity AS source_balance\n
FROM\n
movement,\n
stock,\n
stock\n
LEFT JOIN catalog AS destination_section \n
ON destination_section.uid = stock.mirror_section_uid\n
AND stock.node_uid = <dtml-var getUid>,\n
\n
catalog,\n
catalog AS transaction_line,\n
catalog AS transaction,\n
......@@ -250,10 +254,6 @@ FROM\n
<dtml-if selection_domain>, <dtml-var "selection_domain.asSqlJoinExpression()"> </dtml-if>\n
<dtml-if selection_report>, <dtml-var "selection_report.asSqlJoinExpression()"> </dtml-if>\n
<dtml-if where_expression>, category </dtml-if>\n
\n
LEFT JOIN catalog AS destination_section \n
ON destination_section.uid = stock.mirror_section_uid\n
AND stock.node_uid = <dtml-var getUid>\n
\n
WHERE stock.node_uid = <dtml-var getUid>\n
AND transaction_line.uid = stock.uid \n
......@@ -362,7 +362,11 @@ SELECT\n
stock.quantity AS source_balance\n
FROM\n
movement,\n
stock,\n
stock\n
LEFT JOIN catalog AS destination_section \n
ON destination_section.uid = stock.mirror_section_uid\n
AND stock.node_uid = <dtml-var getUid>,\n
\n
catalog,\n
catalog AS transaction_line,\n
catalog AS transaction,\n
......@@ -373,10 +377,6 @@ FROM\n
<dtml-if selection_domain>, <dtml-var "selection_domain.asSqlJoinExpression()"> </dtml-if>\n
<dtml-if selection_report>, <dtml-var "selection_report.asSqlJoinExpression()"> </dtml-if>\n
<dtml-if where_expression>, category </dtml-if>\n
\n
LEFT JOIN catalog AS destination_section \n
ON destination_section.uid = stock.mirror_section_uid\n
AND stock.node_uid = <dtml-var getUid>\n
\n
WHERE stock.node_uid = <dtml-var getUid>\n
AND transaction_line.uid = stock.uid \n
......
......@@ -149,17 +149,15 @@ FROM\n
, catalog as grandparent\n
, catalog as grandgrandparent\n
, catalog as grandgrandgrandparent\n
<dtml-in from_table_list> \n
, <dtml-var sequence-item> AS <dtml-var sequence-key>\n
<dtml-in prefix="table" expr="from_table_list"> \n
<dtml-if expr="table_key != \'catalog\'">\n
, <dtml-var table_item> AS <dtml-var table_key>\n
</dtml-if>\n
</dtml-in>\n
\n
LEFT JOIN catalog AS base_category \n
ON base_category.relative_url = "delivery"\n
AND base_category.portal_type = "Base Category"\n
LEFT JOIN category \n
ON catalog.uid=category.uid\n
AND base_category.uid=category.base_category_uid\n
\n
, catalog\n
LEFT JOIN category \n
ON (catalog.uid = category.uid\n
AND category.base_category_uid = <dtml-sqlvar "portal_categories.delivery.getUid()" type="int">)\n
WHERE\n
1=1\n
<dtml-if where_expression>\n
......@@ -229,17 +227,15 @@ FROM\n
, catalog as grandparent\n
, catalog as grandgrandparent\n
, catalog as grandgrandgrandparent\n
<dtml-in from_table_list> \n
, <dtml-var sequence-item> AS <dtml-var sequence-key>\n
<dtml-in prefix="table" expr="from_table_list"> \n
<dtml-if expr="table_key != \'catalog\'">\n
, <dtml-var table_item> AS <dtml-var table_key>\n
</dtml-if>\n
</dtml-in>\n
\n
LEFT JOIN catalog AS base_category \n
ON base_category.relative_url = "delivery"\n
AND base_category.portal_type = "Base Category"\n
LEFT JOIN category \n
ON catalog.uid=category.uid\n
AND base_category.uid=category.base_category_uid\n
\n
, catalog\n
LEFT JOIN category \n
ON (catalog.uid = category.uid\n
AND category.base_category_uid = <dtml-sqlvar "portal_categories.delivery.getUid()" type="int">)\n
WHERE\n
1=1\n
<dtml-if where_expression>\n
......
<?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>_Use_Database_Methods_Permission</string> </key>
<value>
<list>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</list>
</value>
</item>
<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>at_date</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>from_date</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>node</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>node_category</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>node_uid</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>omit_input</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>omit_output</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>omit_simulation</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>query</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>resource</string> </key>
<value>
<dictionary>
<item>
<key> <string>type</string> </key>
<value> <string>list</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>resource_category</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>resource_uid</string> </key>
<value>
<dictionary>
<item>
<key> <string>type</string> </key>
<value> <string>list</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>section</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>section_category</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>section_uid</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>simulation_state</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>to_date</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>variation_text</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string>None</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>_keys</string> </key>
<value>
<list>
<string>resource_uid</string>
<string>resource</string>
<string>from_date</string>
<string>to_date</string>
<string>at_date</string>
<string>node</string>
<string>section</string>
<string>node_uid</string>
<string>section_uid</string>
<string>variation_text</string>
<string>node_category</string>
<string>section_category</string>
<string>resource_category</string>
<string>omit_simulation</string>
<string>omit_input</string>
<string>omit_output</string>
<string>simulation_state</string>
<string>query</string>
</list>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_dav_writelocks</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</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>resource_uid:list\r\n
resource:list\r\n
from_date\r\n
to_date\r\n
at_date\r\n
node\r\n
section\r\n
node_uid\r\n
section_uid\r\n
variation_text=None\r\n
node_category\r\n
section_category\r\n
resource_category\r\n
omit_simulation\r\n
omit_input\r\n
omit_output\r\n
simulation_state\r\n
query</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>InventoryBrain.py</string> </value>
</item>
<item>
<key> <string>class_name_</string> </key>
<value> <string>InventoryBrain</string> </value>
</item>
<item>
<key> <string>connection_hook</string> </key>
<value> <string></string> </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>Resource_zGetInventory_old</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>0</int> </value>
</item>
<item>
<key> <string>src</string> </key>
<value> <string encoding="cdata"><![CDATA[
SELECT\n
\tSUM(stock.quantity) AS inventory,\n
\tSUM(stock.quantity) AS quantity,\n
\tCOUNT(DISTINCT node.title) AS node_title,\n
\tCOUNT(DISTINCT node.relative_url) AS node_relative_url,\n
\tCOUNT(DISTINCT section.title) AS section_title,\n
\tCOUNT(DISTINCT section.relative_url) AS section_relative_url,\n
\tCOUNT(DISTINCT resource.title) AS resource_title,\n
\tCOUNT(DISTINCT resource.relative_url) AS resource_relative_url,\n
\tCOUNT(DISTINCT movement.variation_text) AS variation_text,\n
\tMAX(stock.resource_uid) AS resource_uid,\n
\tCOUNT(DISTINCT stock.uid) AS stock_uid\n
FROM\n
movement\n
LEFT JOIN catalog ON (movement.uid = catalog.uid)\n
LEFT JOIN stock ON (movement.uid = stock.uid)\n
\t, catalog AS node, catalog AS section, catalog AS resource <dtml-if node_category>, catalog AS node_c, catalog AS node_bc, category AS node_membership </dtml-if> <dtml-if section_category>, catalog AS section_c, catalog AS section_bc, category AS section_membership</dtml-if> <dtml-if resource_category>, catalog AS resource_c, catalog AS resource_bc, category AS resource_membership </dtml-if> <dtml-if query>, category </dtml-if>\n
WHERE\n
\t1 = 1\n
<dtml-if resource>AND\t(<dtml-in resource> resource.relative_url = <dtml-sqlvar sequence-item type="string"><dtml-if sequence-end><dtml-else> OR </dtml-if></dtml-in>)\n
</dtml-if><dtml-if resource_uid>AND\t(<dtml-in resource_uid> movement.resource_uid = <dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if></dtml-in>)\n
</dtml-if><dtml-if "variation_text not in (None, \'None\')">AND\tmovement.variation_text = <dtml-sqlvar variation_text type="string">\n
</dtml-if>AND\tmovement.is_accountable = 1\n
AND\tnode.uid = stock.node_uid\n
AND\tsection.uid = stock.section_uid\n
AND\tstock.resource_uid = resource.uid\n
<dtml-if from_date>AND\tmovement.stop_date >= <dtml-sqlvar from_date type="string">\n
</dtml-if><dtml-if to_date>AND\tmovement.stop_date < <dtml-sqlvar to_date type="string">\n
</dtml-if><dtml-if at_date>AND\tmovement.stop_date <= <dtml-sqlvar at_date type="string">\n
</dtml-if><dtml-if node_uid>AND\tstock.node_uid = <dtml-sqlvar node_uid type="int">\n
</dtml-if><dtml-if section_uid>AND\tstock.section_uid = <dtml-sqlvar section_uid type="int">\n
</dtml-if><dtml-if node>AND\tnode.relative_url = <dtml-sqlvar node type="string">\n
</dtml-if><dtml-if section>AND\tsection.relative_url = <dtml-sqlvar section type="string">\n
</dtml-if><dtml-if node_category>AND\tnode_c.relative_url = <dtml-sqlvar node_category type="string">\n
AND\tnode_membership.category_uid = node_c.uid\n
AND\tnode_membership.base_category_uid = node_bc.uid\n
AND\tnode_membership.uid = node.uid\n
</dtml-if><dtml-if section_category>AND\tsection_c.relative_url = <dtml-sqlvar section_category type="string">\n
AND\tsection_membership.category_uid = section_c.uid\n
AND\tsection_membership.base_category_uid = section_bc.uid\n
AND\tsection_membership.uid = section.uid\n
</dtml-if><dtml-if resource_category>AND\tresource_c.relative_url = <dtml-sqlvar resource_category type="string">\n
AND\tresource_membership.category_uid = resource_c.uid\n
AND\tresource_membership.base_category_uid = resource_bc.uid\n
AND\tresource_membership.uid = resource.uid\n
</dtml-if><dtml-if omit_simulation>AND\tcatalog.portal_type != "Simulation Movement"\n
</dtml-if><dtml-if omit_input>AND\tstock.quantity > 0 AND ( movement.source_uid <> movement.destination_uid\n
OR stock.section_uid <> stock.mirror_section_uid\n
OR movement.destination_uid IS NULL OR stock.mirror_section_uid IS NULL )\n
</dtml-if><dtml-if omit_output>AND stock.quantity < 0 AND ( movement.source_uid <> movement.destination_uid\n
OR stock.section_uid <> stock.mirror_section_uid\n
OR movement.destination_uid IS NULL OR stock.mirror_section_uid IS NULL )\n
</dtml-if><dtml-if simulation_state>AND\t(<dtml-in simulation_state> catalog.simulation_state = <dtml-sqlvar sequence-item type="string"><dtml-if sequence-end><dtml-else> OR </dtml-if></dtml-in>)\n
</dtml-if><dtml-if query>AND\tcategory.uid = node.uid\n
AND\t<dtml-var query></dtml-if>\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[
SELECT\n
\tSUM(stock.quantity) AS inventory,\n
\tSUM(stock.quantity) AS quantity,\n
\tCOUNT(DISTINCT node.title) AS node_title,\n
\tCOUNT(DISTINCT node.relative_url) AS node_relative_url,\n
\tCOUNT(DISTINCT section.title) AS section_title,\n
\tCOUNT(DISTINCT section.relative_url) AS section_relative_url,\n
\tCOUNT(DISTINCT resource.title) AS resource_title,\n
\tCOUNT(DISTINCT resource.relative_url) AS resource_relative_url,\n
\tCOUNT(DISTINCT movement.variation_text) AS variation_text,\n
\tMAX(stock.resource_uid) AS resource_uid,\n
\tCOUNT(DISTINCT stock.uid) AS stock_uid\n
FROM\n
movement\n
LEFT JOIN catalog ON (movement.uid = catalog.uid)\n
LEFT JOIN stock ON (movement.uid = stock.uid)\n
\t, catalog AS node, catalog AS section, catalog AS resource <dtml-if node_category>, catalog AS node_c, catalog AS node_bc, category AS node_membership </dtml-if> <dtml-if section_category>, catalog AS section_c, catalog AS section_bc, category AS section_membership</dtml-if> <dtml-if resource_category>, catalog AS resource_c, catalog AS resource_bc, category AS resource_membership </dtml-if> <dtml-if query>, category </dtml-if>\n
WHERE\n
\t1 = 1\n
<dtml-if resource>AND\t(<dtml-in resource> resource.relative_url = <dtml-sqlvar sequence-item type="string"><dtml-if sequence-end><dtml-else> OR </dtml-if></dtml-in>)\n
</dtml-if><dtml-if resource_uid>AND\t(<dtml-in resource_uid> movement.resource_uid = <dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if></dtml-in>)\n
</dtml-if><dtml-if "variation_text not in (None, \'None\')">AND\tmovement.variation_text = <dtml-sqlvar variation_text type="string">\n
</dtml-if>AND\tmovement.is_accountable = 1\n
AND\tnode.uid = stock.node_uid\n
AND\tsection.uid = stock.section_uid\n
AND\tstock.resource_uid = resource.uid\n
<dtml-if from_date>AND\tmovement.stop_date >= <dtml-sqlvar from_date type="string">\n
</dtml-if><dtml-if to_date>AND\tmovement.stop_date < <dtml-sqlvar to_date type="string">\n
</dtml-if><dtml-if at_date>AND\tmovement.stop_date <= <dtml-sqlvar at_date type="string">\n
</dtml-if><dtml-if node_uid>AND\tstock.node_uid = <dtml-sqlvar node_uid type="int">\n
</dtml-if><dtml-if section_uid>AND\tstock.section_uid = <dtml-sqlvar section_uid type="int">\n
</dtml-if><dtml-if node>AND\tnode.relative_url = <dtml-sqlvar node type="string">\n
</dtml-if><dtml-if section>AND\tsection.relative_url = <dtml-sqlvar section type="string">\n
</dtml-if><dtml-if node_category>AND\tnode_c.relative_url = <dtml-sqlvar node_category type="string">\n
AND\tnode_membership.category_uid = node_c.uid\n
AND\tnode_membership.base_category_uid = node_bc.uid\n
AND\tnode_membership.uid = node.uid\n
</dtml-if><dtml-if section_category>AND\tsection_c.relative_url = <dtml-sqlvar section_category type="string">\n
AND\tsection_membership.category_uid = section_c.uid\n
AND\tsection_membership.base_category_uid = section_bc.uid\n
AND\tsection_membership.uid = section.uid\n
</dtml-if><dtml-if resource_category>AND\tresource_c.relative_url = <dtml-sqlvar resource_category type="string">\n
AND\tresource_membership.category_uid = resource_c.uid\n
AND\tresource_membership.base_category_uid = resource_bc.uid\n
AND\tresource_membership.uid = resource.uid\n
</dtml-if><dtml-if omit_simulation>AND\tcatalog.portal_type != "Simulation Movement"\n
</dtml-if><dtml-if omit_input>AND\tstock.quantity > 0 AND ( movement.source_uid <> movement.destination_uid\n
OR stock.section_uid <> stock.mirror_section_uid\n
OR movement.destination_uid IS NULL OR stock.mirror_section_uid IS NULL )\n
</dtml-if><dtml-if omit_output>AND stock.quantity < 0 AND ( movement.source_uid <> movement.destination_uid\n
OR stock.section_uid <> stock.mirror_section_uid\n
OR movement.destination_uid IS NULL OR stock.mirror_section_uid IS NULL )\n
</dtml-if><dtml-if simulation_state>AND\t(<dtml-in simulation_state> catalog.simulation_state = <dtml-sqlvar sequence-item type="string"><dtml-if sequence-end><dtml-else> OR </dtml-if></dtml-in>)\n
</dtml-if><dtml-if query>AND\tcategory.uid = node.uid\n
AND\t<dtml-var query></dtml-if>\n
]]></string> </value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Persistence</string>
<string>PersistentMapping</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_container</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -145,17 +145,15 @@ SELECT\n
\n
FROM\n
movement\n
<dtml-in from_table_list> \n
, <dtml-var sequence-item> AS <dtml-var sequence-key>\n
<dtml-in prefix="table" expr="from_table_list"> \n
<dtml-if expr="table_key != \'catalog\'">\n
, <dtml-var table_item> AS <dtml-var table_key>\n
</dtml-if>\n
</dtml-in>\n
\n
LEFT JOIN catalog AS base_category \n
ON base_category.relative_url = "delivery"\n
AND base_category.portal_type = "Base Category"\n
LEFT JOIN category \n
ON catalog.uid=category.uid\n
AND base_category.uid=category.base_category_uid\n
\n
, catalog\n
LEFT JOIN category \n
ON (catalog.uid = category.uid\n
AND category.base_category_uid = <dtml-sqlvar "portal_categories.delivery.getUid()" type="int">)\n
WHERE\n
1=1\n
<dtml-if where_expression>\n
......@@ -217,17 +215,15 @@ SELECT\n
\n
FROM\n
movement\n
<dtml-in from_table_list> \n
, <dtml-var sequence-item> AS <dtml-var sequence-key>\n
<dtml-in prefix="table" expr="from_table_list"> \n
<dtml-if expr="table_key != \'catalog\'">\n
, <dtml-var table_item> AS <dtml-var table_key>\n
</dtml-if>\n
</dtml-in>\n
\n
LEFT JOIN catalog AS base_category \n
ON base_category.relative_url = "delivery"\n
AND base_category.portal_type = "Base Category"\n
LEFT JOIN category \n
ON catalog.uid=category.uid\n
AND base_category.uid=category.base_category_uid\n
\n
, catalog\n
LEFT JOIN category \n
ON (catalog.uid = category.uid\n
AND category.base_category_uid = <dtml-sqlvar "portal_categories.delivery.getUid()" type="int">)\n
WHERE\n
1=1\n
<dtml-if where_expression>\n
......
2005-12-08 yo
* Fix the LEFT JOIN syntax in PaymentTransaction_zSelectMovement and SaleInvoiceTransaction_zSelectMovemen.
2005-12-06 yo
* Remove Resource_zGetInventory_old.
* Fix the LEFT JOIN in Account_zGetAccountingTransactionList.
2005-11-30 yo
* Use portal_preferences.getPreferredAccountingTransactionGap instead of getGap.
......
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