Commit 12e67125 authored by Nicolas Dumazet's avatar Nicolas Dumazet

Use dictionaries instead of tuples when indexing quantity_unit/measure objects

It makes maintenance easier as column names are included in code as dict keys


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33320 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c6366035
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
</item> </item>
<item> <item>
<key> <string>arguments_src</string> </key> <key> <string>arguments_src</string> </key>
<value> <string>uid\n <value> <string>uid\r\n
getMeasureRowList</string> </value> getMeasureRowList</string> </value>
</item> </item>
<item> <item>
...@@ -116,11 +116,11 @@ INSERT INTO `measure`\n ...@@ -116,11 +116,11 @@ INSERT INTO `measure`\n
VALUES\n VALUES\n
<dtml-in measure_list prefix="loop">\n <dtml-in measure_list prefix="loop">\n
(\n (\n
<dtml-sqlvar expr="loop_item[0]" type="int">,\n <dtml-sqlvar expr="loop_item[\'uid\']" type="int">,\n
<dtml-sqlvar expr="loop_item[1]" type="int">,\n <dtml-sqlvar expr="loop_item[\'resource_uid\']" type="int">,\n
<dtml-sqlvar expr="loop_item[2]" type="string">,\n <dtml-sqlvar expr="loop_item[\'variation\']" type="string">,\n
<dtml-sqlvar expr="loop_item[3]" type="int">,\n <dtml-sqlvar expr="loop_item[\'metric_type_uid\']" type="int">,\n
<dtml-sqlvar expr="loop_item[4]" type="float">\n <dtml-sqlvar expr="loop_item[\'quantity\']" type="float">\n
)\n )\n
<dtml-unless sequence-end>,</dtml-unless>\n <dtml-unless sequence-end>,</dtml-unless>\n
</dtml-in>\n </dtml-in>\n
...@@ -182,11 +182,11 @@ INSERT INTO `measure`\n ...@@ -182,11 +182,11 @@ INSERT INTO `measure`\n
VALUES\n VALUES\n
<dtml-in measure_list prefix="loop">\n <dtml-in measure_list prefix="loop">\n
(\n (\n
<dtml-sqlvar expr="loop_item[0]" type="int">,\n <dtml-sqlvar expr="loop_item[\'uid\']" type="int">,\n
<dtml-sqlvar expr="loop_item[1]" type="int">,\n <dtml-sqlvar expr="loop_item[\'resource_uid\']" type="int">,\n
<dtml-sqlvar expr="loop_item[2]" type="string">,\n <dtml-sqlvar expr="loop_item[\'variation\']" type="string">,\n
<dtml-sqlvar expr="loop_item[3]" type="int">,\n <dtml-sqlvar expr="loop_item[\'metric_type_uid\']" type="int">,\n
<dtml-sqlvar expr="loop_item[4]" type="float">\n <dtml-sqlvar expr="loop_item[\'quantity\']" type="float">\n
)\n )\n
<dtml-unless sequence-end>,</dtml-unless>\n <dtml-unless sequence-end>,</dtml-unless>\n
</dtml-in>\n </dtml-in>\n
......
...@@ -78,7 +78,7 @@ getQuantityUnitConversionDefinitionRowList\r\n ...@@ -78,7 +78,7 @@ getQuantityUnitConversionDefinitionRowList\r\n
Make sure that we get no duplicates, and also aggregate the uids of the modified resources for deletion\n Make sure that we get no duplicates, and also aggregate the uids of the modified resources for deletion\n
</dtml-comment>\n </dtml-comment>\n
<dtml-in loop_item prefix="inner">\n <dtml-in loop_item prefix="inner">\n
<dtml-call expr="quantity_unit_conversion_dict.setdefault(inner_item[1], {}).setdefault(inner_item[2], inner_item)">\n <dtml-call expr="quantity_unit_conversion_dict.setdefault(inner_item[\'uid\'], {}).setdefault(inner_item[\'resource_uid\'], inner_item)">\n
</dtml-in>\n </dtml-in>\n
</dtml-if>\n </dtml-if>\n
</dtml-in>\n </dtml-in>\n
...@@ -98,10 +98,10 @@ INSERT INTO `quantity_unit_conversion`\n ...@@ -98,10 +98,10 @@ INSERT INTO `quantity_unit_conversion`\n
VALUES\n VALUES\n
<dtml-in "value_list" prefix="loop">\n <dtml-in "value_list" prefix="loop">\n
(\n (\n
<dtml-sqlvar expr="loop_item[0]" type="int" optional>,\n <dtml-sqlvar expr="loop_item[\'uid\']" type="int" optional>,\n
<dtml-sqlvar expr="loop_item[1]" type="int">,\n <dtml-sqlvar expr="loop_item[\'resource_uid\']" type="int">,\n
<dtml-sqlvar expr="loop_item[2]" type="int">,\n <dtml-sqlvar expr="loop_item[\'quantity_unit_uid\']" type="int">,\n
<dtml-sqlvar expr="loop_item[3]" type="float">\n <dtml-sqlvar expr="loop_item[\'quantity\']" type="float">\n
)\n )\n
<dtml-unless sequence-end>,</dtml-unless>\n <dtml-unless sequence-end>,</dtml-unless>\n
</dtml-in>\n </dtml-in>\n
...@@ -155,7 +155,7 @@ VALUES\n ...@@ -155,7 +155,7 @@ VALUES\n
Make sure that we get no duplicates, and also aggregate the uids of the modified resources for deletion\n Make sure that we get no duplicates, and also aggregate the uids of the modified resources for deletion\n
</dtml-comment>\n </dtml-comment>\n
<dtml-in loop_item prefix="inner">\n <dtml-in loop_item prefix="inner">\n
<dtml-call expr="quantity_unit_conversion_dict.setdefault(inner_item[1], {}).setdefault(inner_item[2], inner_item)">\n <dtml-call expr="quantity_unit_conversion_dict.setdefault(inner_item[\'uid\'], {}).setdefault(inner_item[\'resource_uid\'], inner_item)">\n
</dtml-in>\n </dtml-in>\n
</dtml-if>\n </dtml-if>\n
</dtml-in>\n </dtml-in>\n
...@@ -175,10 +175,10 @@ INSERT INTO `quantity_unit_conversion`\n ...@@ -175,10 +175,10 @@ INSERT INTO `quantity_unit_conversion`\n
VALUES\n VALUES\n
<dtml-in "value_list" prefix="loop">\n <dtml-in "value_list" prefix="loop">\n
(\n (\n
<dtml-sqlvar expr="loop_item[0]" type="int" optional>,\n <dtml-sqlvar expr="loop_item[\'uid\']" type="int" optional>,\n
<dtml-sqlvar expr="loop_item[1]" type="int">,\n <dtml-sqlvar expr="loop_item[\'resource_uid\']" type="int">,\n
<dtml-sqlvar expr="loop_item[2]" type="int">,\n <dtml-sqlvar expr="loop_item[\'quantity_unit_uid\']" type="int">,\n
<dtml-sqlvar expr="loop_item[3]" type="float">\n <dtml-sqlvar expr="loop_item[\'quantity\']" type="float">\n
)\n )\n
<dtml-unless sequence-end>,</dtml-unless>\n <dtml-unless sequence-end>,</dtml-unless>\n
</dtml-in>\n </dtml-in>\n
......
180 181
\ No newline at end of file \ 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