From 4b4bb7faf6301a2ec7edf2a32979130f031bcf49 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Oct 2025 15:21:24 +0200 Subject: [PATCH] FIX Status if thirdparty not synchronized with status WON of opportunity. --- htdocs/install/mysql/migration/repair.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 361e2987ede..ec79eb7fc2e 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -619,6 +619,10 @@ DELETE from llx_c_regions WHERE fk_pays NOT IN (select rowid from llx_c_country) UPDATE llx_mrp_production SET disable_stock_change = 0 WHERE disable_stock_change IS NULL; +-- Fix status of thirdparty when there is at least one win opportunity +UPDATE llx_societe as s SET s.client = 1 WHERE s.client = 0 AND EXISTS (SELECT rowid FROM llx_projet as p WHERE p.fk_soc = s.rowid AND p.fk_opp_status IN (SELECT rowid FROM llx_c_lead_status as ls WHERE ls.code = 'WON')); +UPDATE llx_societe as s SET s.client = 3 WHERE s.client = 2 AND EXISTS (SELECT rowid FROM llx_projet as p WHERE p.fk_soc = s.rowid AND p.fk_opp_status IN (SELECT rowid FROM llx_c_lead_status as ls WHERE ls.code = 'WON')); + -- Drop duplicate indexes not named correctly and create the only one we should have alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combination; alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_2;