Commit 42d3e5db authored by Alexandre Boeglin's avatar Alexandre Boeglin

When cataloging movements, delete then insert instead of replacing, as some...

When cataloging movements, delete then insert instead of replacing, as some objects might not be movements anylonger.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19835 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a6a1fd58
...@@ -3,11 +3,8 @@ ...@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="SQL" module="Products.ZSQLMethods.SQL"/>
<string>Products.ZSQLMethods.SQL</string> <tuple/>
<string>SQL</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
...@@ -129,21 +126,21 @@ ...@@ -129,21 +126,21 @@
<key> <string>_keys</string> </key> <key> <string>_keys</string> </key>
<value> <value>
<list> <list>
<string>isMovement</string> <string>isMovement</string>
<string>uid</string> <string>uid</string>
<string>getExplanationUid</string> <string>getExplanationUid</string>
<string>getSourceUid</string> <string>getSourceUid</string>
<string>getDestinationUid</string> <string>getDestinationUid</string>
<string>getResourceUid</string> <string>getResourceUid</string>
<string>getInventoriatedQuantity</string> <string>getInventoriatedQuantity</string>
<string>getStartDate</string> <string>getStartDate</string>
<string>getStopDate</string> <string>getStopDate</string>
<string>getPrice</string> <string>getPrice</string>
<string>isAccountable</string> <string>isAccountable</string>
<string>isOrderable</string> <string>isOrderable</string>
<string>isDeliverable</string> <string>isDeliverable</string>
<string>isDivergent</string> <string>isDivergent</string>
<string>getVariationText</string> <string>getVariationText</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -214,14 +211,22 @@ getVariationText</string> </value> ...@@ -214,14 +211,22 @@ getVariationText</string> </value>
<key> <string>src</string> </key> <key> <string>src</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
<dtml-let movement_list="[]">\n DELETE FROM\n
movement\n
WHERE\n
<dtml-in uid>\n
uid=<dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if>\n
</dtml-in>\n
;\n
\n
<dtml-var "\'\\0\'"><dtml-let movement_list="[]">\n
<dtml-in prefix="loop" expr="_.range(_.len(uid))">\n <dtml-in prefix="loop" expr="_.range(_.len(uid))">\n
<dtml-if "isMovement[loop_item]">\n <dtml-if "isMovement[loop_item]">\n
<dtml-call expr="movement_list.append(loop_item)">\n <dtml-call expr="movement_list.append(loop_item)">\n
</dtml-if>\n </dtml-if>\n
</dtml-in>\n </dtml-in>\n
<dtml-if expr="_.len(movement_list) > 0">\n <dtml-if expr="_.len(movement_list) > 0">\n
REPLACE INTO\n INSERT INTO\n
movement\n movement\n
VALUES\n VALUES\n
<dtml-in prefix="loop" expr="movement_list">\n <dtml-in prefix="loop" expr="movement_list">\n
...@@ -254,9 +259,11 @@ VALUES\n ...@@ -254,9 +259,11 @@ VALUES\n
<value> <value>
<object> <object>
<klass> <klass>
<global name="SQL" module="Shared.DC.ZRDB.DA"/> <global name="__newobj__" module="copy_reg"/>
</klass> </klass>
<none/> <tuple>
<global name="SQL" module="Shared.DC.ZRDB.DA"/>
</tuple>
<state> <state>
<dictionary> <dictionary>
<item> <item>
...@@ -283,14 +290,22 @@ VALUES\n ...@@ -283,14 +290,22 @@ VALUES\n
<key> <string>raw</string> </key> <key> <string>raw</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
<dtml-let movement_list="[]">\n DELETE FROM\n
movement\n
WHERE\n
<dtml-in uid>\n
uid=<dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if>\n
</dtml-in>\n
;\n
\n
<dtml-var "\'\\0\'"><dtml-let movement_list="[]">\n
<dtml-in prefix="loop" expr="_.range(_.len(uid))">\n <dtml-in prefix="loop" expr="_.range(_.len(uid))">\n
<dtml-if "isMovement[loop_item]">\n <dtml-if "isMovement[loop_item]">\n
<dtml-call expr="movement_list.append(loop_item)">\n <dtml-call expr="movement_list.append(loop_item)">\n
</dtml-if>\n </dtml-if>\n
</dtml-in>\n </dtml-in>\n
<dtml-if expr="_.len(movement_list) > 0">\n <dtml-if expr="_.len(movement_list) > 0">\n
REPLACE INTO\n INSERT INTO\n
movement\n movement\n
VALUES\n VALUES\n
<dtml-in prefix="loop" expr="movement_list">\n <dtml-in prefix="loop" expr="movement_list">\n
......
99 100
\ 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