diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 2e76d9ce4dbdd189e02e7b2a92ffb5b1952fc857..7abd140b9b98ad0dd666baa5af041f7d8a300fb2 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4208,7 +4208,7 @@ class FactureLigne extends CommonInvoiceLine $sql.= ' fd.date_start as date_start, fd.date_end as date_end, fd.fk_product_fournisseur_price as fk_fournprice, fd.buy_price_ht as pa_ht,'; $sql.= ' fd.info_bits, fd.special_code, fd.total_ht, fd.total_tva, fd.total_ttc, fd.total_localtax1, fd.total_localtax2, fd.rang,'; $sql.= ' fd.fk_code_ventilation,'; - $sql.= ' fd.fk_unit,'; + $sql.= ' fd.fk_unit, fk_user_author, fk_user_modif,'; $sql.= ' fd.situation_percent, fd.fk_prev_id,'; $sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc'; $sql.= ' , fd.multicurrency_subprice'; @@ -4261,7 +4261,9 @@ class FactureLigne extends CommonInvoiceLine $this->product_label = $objp->product_libelle; $this->product_desc = $objp->product_desc; $this->fk_unit = $objp->fk_unit; - + $this->fk_user_modif = $objp->fk_user_modif; + $this->fk_user_author = $objp->fk_user_author; + $this->situation_percent = $objp->situation_percent; $this->fk_prev_id = $objp->fk_prev_id; @@ -4361,8 +4363,8 @@ class FactureLigne extends CommonInvoiceLine $sql.= ' rang, special_code, fk_product_fournisseur_price, buy_price_ht,'; $sql.= ' info_bits, total_ht, total_tva, total_ttc, total_localtax1, total_localtax2,'; $sql.= ' situation_percent, fk_prev_id,'; - $sql.= ' fk_unit'; - $sql.= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; + $sql.= ' fk_unit, fk_user_author, fk_user_modif,'; + $sql.= ' fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; $sql.= ')'; $sql.= " VALUES (".$this->fk_facture.","; $sql.= " ".($this->fk_parent_line>0?"'".$this->fk_parent_line."'":"null").","; @@ -4393,9 +4395,11 @@ class FactureLigne extends CommonInvoiceLine $sql.= " ".price2num($this->total_ttc).","; $sql.= " ".price2num($this->total_localtax1).","; $sql.= " ".price2num($this->total_localtax2); - $sql .= ", " . $this->situation_percent; - $sql .= ", " . $this->fk_prev_id; - $sql .= ", ".(!$this->fk_unit ? 'NULL' : $this->fk_unit); + $sql.= ", " . $this->situation_percent; + $sql.= ", " . $this->fk_prev_id; + $sql.= ", ".(!$this->fk_unit ? 'NULL' : $this->fk_unit); + $sql.= ", ".$user->id; + $sql.= ", ".$user->id; $sql.= ", ".(int) $this->fk_multicurrency; $sql.= ", '".$this->db->escape($this->multicurrency_code)."'"; $sql.= ", ".price2num($this->multicurrency_subprice); @@ -4581,6 +4585,7 @@ class FactureLigne extends CommonInvoiceLine if (! empty($this->rang)) $sql.= ", rang=".$this->rang; $sql.= ", situation_percent=" . $this->situation_percent; $sql.= ", fk_unit=".(!$this->fk_unit ? 'NULL' : $this->fk_unit); + $sql.= ", fk_user_modif =".$user->id; // Multicurrency $sql.= ", multicurrency_subprice=".price2num($this->multicurrency_subprice).""; diff --git a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql index df35f12d33c21fd923c7f6a5f9f42093bf783be4..fb862457b45fcc50f439654740e50b371f9f81de 100644 --- a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql +++ b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql @@ -48,6 +48,9 @@ ALTER TABLE llx_don ADD COLUMN date_valid datetime; DELETE FROM llx_menu where module='expensereport'; +ALTER TABLE llx_facturedet ADD COLUMN fk_user_author integer after fk_unit; +ALTER TABLE llx_facturedet ADD COLUMN fk_user_modif integer after fk_unit; + ALTER TABLE llx_user DROP COLUMN phenix_login; ALTER TABLE llx_user DROP COLUMN phenix_pass; ALTER TABLE llx_user ADD COLUMN dateemployment datetime; diff --git a/htdocs/install/mysql/tables/llx_facturedet.sql b/htdocs/install/mysql/tables/llx_facturedet.sql index 0bf124975abd64f94b6421ab1b6b7990e79af8f9..28c07e6d5089c71e62bd37a88b3038f408a8526b 100644 --- a/htdocs/install/mysql/tables/llx_facturedet.sql +++ b/htdocs/install/mysql/tables/llx_facturedet.sql @@ -65,6 +65,8 @@ create table llx_facturedet situation_percent real, -- % progression of lines invoicing fk_prev_id integer, -- id of the line in the previous situation, fk_unit integer DEFAULT NULL, -- id of the unit codeĀ” + fk_user_author integer, -- user making creation + fk_user_modif integer, -- user making last change fk_multicurrency integer, multicurrency_code varchar(255),