From c25b044da586f67d89420dc23497a78f03576868 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 28 Apr 2021 11:56:07 +0200 Subject: [PATCH 1/4] FIX : several fixes on salary and vat --- htdocs/compta/tva/class/tva.class.php | 2 +- htdocs/salaries/class/salary.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index ff35ece947b..465e6f27fd6 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -144,7 +144,7 @@ class Tva extends CommonObject $sql .= " '".$this->db->escape($this->note)."',"; $sql .= " '".$this->db->escape($this->fk_account)."',"; $sql .= " '".$this->db->escape($this->type_payment)."',"; - $sql .= " '".$this->db->escape($this->fk_user_creat)."',"; + $sql .= " '".($this->fk_user_creat > 0 ? (int)$this->fk_user_creat : (int)$user->id)."',"; $sql .= " '".$this->db->escape($this->fk_user_modif)."'"; $sql .= ")"; diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index e3dbb9b735d..9e009543fe0 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -146,7 +146,7 @@ class Salary extends CommonObject $sql .= " note='".$this->db->escape($this->note)."',"; $sql .= " fk_bank=".($this->fk_bank > 0 ? (int) $this->fk_bank : "null").","; $sql .= " fk_user_author=".((int) $this->fk_user_author).","; - $sql .= " fk_user_modif=".($this->fk_user_modif > 0 ? (int) $this->fk_user_modif : 'null'); + $sql .= " fk_user_modif=".($this->fk_user_modif > 0 ? (int)$this->fk_user_modif : (int)$user->id); $sql .= " WHERE rowid=".((int) $this->id); From 4af2f8871a26448fddc2d038cb355aa0ace34d54 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 28 Apr 2021 12:27:07 +0200 Subject: [PATCH 2/4] FIX : on update current_timestamp --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 2 +- htdocs/install/mysql/tables/llx_salary.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 10822a8ec2a..48095160c69 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 @@ -259,7 +259,7 @@ create table llx_salary rowid integer AUTO_INCREMENT PRIMARY KEY, ref varchar(30) NULL, -- payment reference number (currently NULL because there is no numbering manager yet) label varchar(255), - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- Create date fk_user integer NOT NULL, datep date, -- payment date diff --git a/htdocs/install/mysql/tables/llx_salary.sql b/htdocs/install/mysql/tables/llx_salary.sql index af4b869d9bf..b68ac1e7a1e 100644 --- a/htdocs/install/mysql/tables/llx_salary.sql +++ b/htdocs/install/mysql/tables/llx_salary.sql @@ -21,7 +21,7 @@ create table llx_salary ( rowid integer AUTO_INCREMENT PRIMARY KEY, ref varchar(30) NULL, -- payment reference number (currently NULL because there is no numbering manager yet) - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- Create date fk_user integer NOT NULL, datep date, -- payment date From 01ddc13b2ef8fb9665ea0b8805cb3e50df4612ed Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 28 Apr 2021 13:06:19 +0200 Subject: [PATCH 3/4] FIX : on update current_timestamp for postgres --- htdocs/install/pgsql/functions/functions.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index 17339c1f605..d73678bcbab 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -169,6 +169,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitm CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitmentjobposition_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitmentcandidature FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitmentcandidature_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_salary FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_societe FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_societe_address FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_societe_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); From 762378c04468f37613f2844680d824c0bde197da Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 28 Apr 2021 11:12:01 +0000 Subject: [PATCH 4/4] Fixing style errors. --- htdocs/compta/tva/class/tva.class.php | 2 +- htdocs/salaries/class/salary.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index 465e6f27fd6..daed5b19f5e 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -144,7 +144,7 @@ class Tva extends CommonObject $sql .= " '".$this->db->escape($this->note)."',"; $sql .= " '".$this->db->escape($this->fk_account)."',"; $sql .= " '".$this->db->escape($this->type_payment)."',"; - $sql .= " '".($this->fk_user_creat > 0 ? (int)$this->fk_user_creat : (int)$user->id)."',"; + $sql .= " '".($this->fk_user_creat > 0 ? (int) $this->fk_user_creat : (int) $user->id)."',"; $sql .= " '".$this->db->escape($this->fk_user_modif)."'"; $sql .= ")"; diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index 9e009543fe0..e7f1af66e0c 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -146,7 +146,7 @@ class Salary extends CommonObject $sql .= " note='".$this->db->escape($this->note)."',"; $sql .= " fk_bank=".($this->fk_bank > 0 ? (int) $this->fk_bank : "null").","; $sql .= " fk_user_author=".((int) $this->fk_user_author).","; - $sql .= " fk_user_modif=".($this->fk_user_modif > 0 ? (int)$this->fk_user_modif : (int)$user->id); + $sql .= " fk_user_modif=".($this->fk_user_modif > 0 ? (int) $this->fk_user_modif : (int) $user->id); $sql .= " WHERE rowid=".((int) $this->id);