From 22f3b69666979af6abcc4001b094f8e4af8be4d0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 22 Dec 2019 11:59:38 +0100 Subject: [PATCH] Fix default value for situation invoice --- htdocs/install/mysql/migration/10.0.0-11.0.0.sql | 3 +++ htdocs/install/mysql/migration/repair.sql | 3 +++ htdocs/install/mysql/tables/llx_facturedet.sql | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 7f4cdb9c7bb..b73593c3dfd 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -59,6 +59,9 @@ ALTER TABLE llx_emailcollector_emailcollectoraction ADD COLUMN position integer -- For v11 +ALTER TABLE llx_facturedet MODIFY COLUMN situation_percent real DEFAULT 100; +UPDATE llx_facturedet SET situation_percent = 100 WHERE situation_percent IS NULL AND fk_prev_id IS NULL; + INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 20, 'BAS-K1-MINI', 'The Swedish mini chart of accounts', 1); ALTER TABLE llx_c_action_trigger MODIFY COLUMN elementtype varchar(64) NOT NULL; diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 69bdea770c9..47d3127274f 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -470,6 +470,9 @@ UPDATE llx_accounting_bookkeeping set date_creation = tms where date_creation IS -- UPDATE llx_facturedet_rec set label = NULL WHERE label IS NOT NULL; +UPDATE llx_facturedet SET situation_percent = 100 WHERE situation_percent IS NULL AND fk_prev_id IS NULL; + + -- Note to make all deposit as payed when there is already a discount generated from it. --drop table tmp_invoice_deposit_mark_as_available; --create table tmp_invoice_deposit_mark_as_available as select * from llx_facture as f where f.type = 3 and f.paye = 0 and f.rowid in (select fk_facture_source from llx_societe_remise_except); diff --git a/htdocs/install/mysql/tables/llx_facturedet.sql b/htdocs/install/mysql/tables/llx_facturedet.sql index 842bc5c206e..ff2b28d9a7f 100644 --- a/htdocs/install/mysql/tables/llx_facturedet.sql +++ b/htdocs/install/mysql/tables/llx_facturedet.sql @@ -63,8 +63,9 @@ create table llx_facturedet fk_code_ventilation integer DEFAULT 0 NOT NULL, -- Id in table llx_accounting_bookeeping to know accounting account for product line - situation_percent real, -- % progression of lines invoicing + situation_percent real DEFAULT 100, -- % progression of lines invoicing fk_prev_id integer, -- id of the line in the previous situation + fk_user_author integer, -- user making creation fk_user_modif integer, -- user making last change