From eb5e891cf9262aa9c34376fbf26027f4d84ca05b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 16 Mar 2014 20:37:43 +0100 Subject: [PATCH] Fix: Not mandatory field must not be not null Fix: field to store amount must be double(24,8) --- htdocs/install/mysql/migration/3.5.0-3.6.0.sql | 10 +++++----- htdocs/install/mysql/tables/llx_projet_task_time.sql | 3 ++- htdocs/install/mysql/tables/llx_user.sql | 1 + htdocs/user/class/user.class.php | 7 +++---- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql index fef128888d2..214fbe4c89d 100644 --- a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql +++ b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql @@ -1063,9 +1063,9 @@ CREATE TABLE llx_payment_salary ( )ENGINE=innodb; --New 1074 : Stock mouvement link to origin -ALTER TABLE llx_stock_mouvement ADD fk_origin INT NOT NULL ; -ALTER TABLE llx_stock_mouvement ADD origintype VARCHAR( 32 ) NOT NULL ; +ALTER TABLE llx_stock_mouvement ADD fk_origin integer; +ALTER TABLE llx_stock_mouvement ADD origintype VARCHAR(32); ---NEw 1300 : Add THM on user -ALTER TABLE llx_user ADD thm FLOAT NOT NULL ; -ALTER TABLE llx_projet_task_time ADD thm FLOAT NOT NULL ; \ No newline at end of file +--New 1300 : Add THM on user +ALTER TABLE llx_user ADD thm double(24,8); +ALTER TABLE llx_projet_task_time ADD thm double(24,8); diff --git a/htdocs/install/mysql/tables/llx_projet_task_time.sql b/htdocs/install/mysql/tables/llx_projet_task_time.sql index 615bc587a06..8bef980a12e 100644 --- a/htdocs/install/mysql/tables/llx_projet_task_time.sql +++ b/htdocs/install/mysql/tables/llx_projet_task_time.sql @@ -19,9 +19,10 @@ create table llx_projet_task_time ( rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_task integer NOT NULL, + fk_task integer NOT NULL, task_date date, task_duration double, fk_user integer, + thm double(24,8), note text )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index a2d6a32264c..199bfe7e69e 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -54,6 +54,7 @@ create table llx_user fk_socpeople integer, fk_member integer, fk_user integer, -- Hierarchic parent + thm double(24,8), note text DEFAULT NULL, datelastlogin datetime, datepreviouslogin datetime, diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 965088d7358..3241f6dbc12 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -207,7 +207,7 @@ class User extends CommonObject $this->office_fax = $obj->office_fax; $this->user_mobile = $obj->user_mobile; $this->email = $obj->email; - $this->skype = $obj->skype; + $this->skype = $obj->skype; $this->job = $obj->job; $this->signature = $obj->signature; $this->admin = $obj->admin; @@ -218,7 +218,7 @@ class User extends CommonObject $this->lang = $obj->lang; $this->entity = $obj->entity; $this->accountancy_code = $obj->accountancy_code; - $this->thm = $obj->thm; + $this->thm = $obj->thm; $this->datec = $this->db->jdate($obj->datec); $this->datem = $this->db->jdate($obj->datem); @@ -1138,7 +1138,6 @@ class User extends CommonObject $this->zip = empty($this->zip)?'':$this->zip; $this->town = empty($this->town)?'':$this->town; $this->accountancy_code = trim($this->accountancy_code); - $this->thm = price2num($this->thm); // Check parameters if (! empty($conf->global->USER_MAIL_REQUIRED) && ! isValidEMail($this->email)) @@ -1169,7 +1168,7 @@ class User extends CommonObject $sql.= ", job = '".$this->db->escape($this->job)."'"; $sql.= ", signature = '".$this->db->escape($this->signature)."'"; $sql.= ", accountancy_code = '".$this->db->escape($this->accountancy_code)."'"; - $sql.= ", thm = ".$this->thm; + $sql.= ", thm = ".(isset($this->thm)?$this->thm:"null"); // If not set, we use null $sql.= ", note = '".$this->db->escape($this->note)."'"; $sql.= ", photo = ".($this->photo?"'".$this->db->escape($this->photo)."'":"null"); $sql.= ", openid = ".($this->openid?"'".$this->db->escape($this->openid)."'":"null");