From ae4fc565e187880f635d8fa7a5fe173e7aec00e8 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 22 Feb 2021 05:38:31 +0100 Subject: [PATCH] Widget & commonobject --- htdocs/core/boxes/box_factures.php | 4 ++-- htdocs/core/boxes/box_factures_imp.php | 6 +++--- htdocs/core/class/commonobject.class.php | 2 +- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 2 ++ htdocs/install/mysql/tables/llx_facture_rec.sql | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index 20e83fb442c..8daabcf840c 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -89,8 +89,8 @@ class box_factures extends ModeleBoxes if ($user->rights->facture->lire) { $sql = "SELECT f.rowid as facid"; - $sql .= ", f.ref, f.type, f.total as total_ht"; - $sql .= ", f.tva as total_tva"; + $sql .= ", f.ref, f.type, f.total_ht"; + $sql .= ", f.total_tva"; $sql .= ", f.total_ttc"; $sql .= ", f.datef as df"; $sql .= ", f.paye, f.fk_statut, f.datec, f.tms"; diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index b47f948f4ca..68d03ce56af 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -95,8 +95,8 @@ class box_factures_imp extends ModeleBoxes $sql .= ", f.ref, f.date_lim_reglement as datelimite"; $sql .= ", f.type"; $sql .= ", f.datef as df"; - $sql .= ", f.total as total_ht"; - $sql .= ", f.tva as total_tva"; + $sql .= ", f.total_ht"; + $sql .= ", f.total_tva"; $sql .= ", f.total_ttc"; $sql .= ", f.paye, f.fk_statut, f.rowid as facid"; $sql .= ", sum(pf.amount) as am"; @@ -112,7 +112,7 @@ class box_factures_imp extends ModeleBoxes if ($user->socid) $sql .= " AND s.rowid = ".$user->socid; $sql .= " GROUP BY s.rowid, s.nom, s.name_alias, s.code_client, s.code_compta, s.client, s.logo, s.email, s.entity, s.tva_intra, s.siren, s.siret, s.ape, s.idprof4, s.idprof5, s.idprof6,"; $sql .= " f.ref, f.date_lim_reglement,"; - $sql .= " f.type, f.datef, f.total, f.tva, f.total_ttc, f.paye, f.fk_statut, f.rowid"; + $sql .= " f.type, f.datef, f.total_ht, f.total_tva, f.total_ttc, f.paye, f.fk_statut, f.rowid"; //$sql.= " ORDER BY f.datef DESC, f.ref DESC "; $sql .= " ORDER BY datelimite ASC, f.ref ASC "; $sql .= $this->db->plimit($max, 0); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 394138ce2ce..92d312a055e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3228,7 +3228,7 @@ abstract class CommonObject $fieldlocaltax2 = 'localtax2'; $fieldttc = 'total_ttc'; // Specific code for backward compatibility with old field names - if ($this->element == 'facture' || $this->element == 'facturerec') $fieldht = 'total'; + if ($this->element == 'facture' || $this->element == 'facturerec') $fieldtva = 'total_tva'; if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') $fieldtva = 'total_tva'; if ($this->element == 'propal') { $fieldttc = 'total'; diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index c755ba1b359..dd932d639c8 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -182,4 +182,6 @@ ALTER TABLE llx_supplier_proposal CHANGE COLUMN total total_ttc double(24,8) def ALTER TABLE llx_propal CHANGE COLUMN tva total_tva double(24,8) default 0; ALTER TABLE llx_facture CHANGE COLUMN tva total_tva double(24,8) default 0; ALTER TABLE llx_facture CHANGE COLUMN total total_ht double(24,8) default 0; +ALTER TABLE llx_facture_rec CHANGE COLUMN tva total_tva double(24,8) default 0; +ALTER TABLE llx_facture_rec CHANGE COLUMN total total_ht double(24,8) default 0; diff --git a/htdocs/install/mysql/tables/llx_facture_rec.sql b/htdocs/install/mysql/tables/llx_facture_rec.sql index 0db78d62252..c3cb6aeed46 100644 --- a/htdocs/install/mysql/tables/llx_facture_rec.sql +++ b/htdocs/install/mysql/tables/llx_facture_rec.sql @@ -36,11 +36,11 @@ create table llx_facture_rec remise_absolue real DEFAULT 0, vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here. - tva double(24,8) DEFAULT 0, + total_tva double(24,8) DEFAULT 0, localtax1 double(24,8) DEFAULT 0, -- amount localtax1 localtax2 double(24,8) DEFAULT 0, -- amount localtax2 revenuestamp double(24,8) DEFAULT 0, -- amount total revenuestamp - total double(24,8) DEFAULT 0, + total_ht double(24,8) DEFAULT 0, total_ttc double(24,8) DEFAULT 0, fk_user_author integer, -- user creating