Logiciel Pastèque/API/Fix dupes in stocks

Fix for pasteque server issue #15

modifier

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

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;