Aller au contenu

Logiciel Pastèque/API/Fix dupes in stocks

Un livre de Wikilivres.

Fix for pasteque server issue #15

[modifier | modifier le wikicode]

Issue 15: Doublons appears in inventory

Found on 6.0

Caused by: adding movements with 0 quantities duplicates stockcurrent line with null attributesetinstance_id.

Fix for 7.0: don't save movements with 0 as quantity in StockService

Rebuild a broken STOCKCURRENT table

[modifier | modifier le wikicode]

Use the following script to rebuild the broken table from STOCKDIARY

MySQL :

 -- Kill the crappy STOCKCURRENT
 TRUNCATE STOCKCURRENT;
  
 -- Rebuild from STOCKDIARY
 INSERT INTO STOCKCURRENT (LOCATION, PRODUCT, ATTRIBUTESETINSTANCE_ID, UNITS)
 SELECT LOCATION, PRODUCT, ATTRIBUTESETINSTANCE_ID, SUM(UNITS) AS UNITS FROM STOCKDIARY GROUP BY LOCATION, PRODUCT, ATTRIBUTESETINSTANCE_ID;