From 246c5f5bd573f22a7debb8e88d1cdb9bdb89dc69 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 30 May 2007 07:23:11 +0000 Subject: [PATCH] Fix: renommage du champ fk_user de llx_socpeople en fk_user_create --- htdocs/contact.class.php | 19 ++++++++++--------- htdocs/user.class.php | 2 +- mysql/migration/2.1.0-2.2.0.sql | 4 +++- mysql/tables/llx_socpeople.sql | 2 +- mysql/tables/llx_user.sql | 2 +- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/htdocs/contact.class.php b/htdocs/contact.class.php index 2a769f96598..4dd1d327814 100644 --- a/htdocs/contact.class.php +++ b/htdocs/contact.class.php @@ -96,14 +96,15 @@ class Contact $this->name=trim($this->name); if (! $this->socid) $this->socid = 0; - $sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople (datec, fk_soc, name, fk_user)"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople (datec, fk_soc, name, fk_user_create)"; $sql.= " VALUES (now(),"; if ($this->socid > 0) $sql.= " ".$this->socid.","; else $sql.= "null,"; $sql.= "'".addslashes($this->name)."',"; - $sql.= $user->id; - $sql.= ")"; - dolibarr_syslog("Contact.class::create sql=".$sql); + $sql.= $user->id; + $sql.= ")"; + + dolibarr_syslog("Contact.class::create sql=".$sql); $resql=$this->db->query($sql); if ($resql) @@ -578,10 +579,10 @@ class Contact */ function info($id) { - $sql = "SELECT c.idp, ".$this->db->pdate("datec")." as datec, fk_user"; - $sql .= ", ".$this->db->pdate("tms")." as tms, fk_user_modif"; + $sql = "SELECT c.idp, ".$this->db->pdate("c.datec")." as datec, c.fk_user_create"; + $sql .= ", ".$this->db->pdate("c.tms")." as tms, c.fk_user_modif"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c"; - $sql .= " WHERE c.idp = $id"; + $sql .= " WHERE c.idp = ".$id; $resql=$this->db->query($sql); if ($resql) @@ -592,8 +593,8 @@ class Contact $this->id = $obj->idp; - if ($obj->fk_user) { - $cuser = new User($this->db, $obj->fk_user); + if ($obj->fk_user_create) { + $cuser = new User($this->db, $obj->fk_user_create); $cuser->fetch(); $this->user_creation = $cuser; } diff --git a/htdocs/user.class.php b/htdocs/user.class.php index 80705fdabdd..20aa77d0a87 100644 --- a/htdocs/user.class.php +++ b/htdocs/user.class.php @@ -762,7 +762,7 @@ class User if ($resql) { $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople"; - $sql.= " SET fk_user = ".$this->id; + $sql.= " SET fk_user_create = ".$this->id; $sql.= " WHERE idp = ".$contact->id; $resql=$this->db->query($sql); diff --git a/mysql/migration/2.1.0-2.2.0.sql b/mysql/migration/2.1.0-2.2.0.sql index 2cc158353f8..3db9bbe958c 100644 --- a/mysql/migration/2.1.0-2.2.0.sql +++ b/mysql/migration/2.1.0-2.2.0.sql @@ -532,4 +532,6 @@ insert into `llx_menu_const` (`rowid`, `fk_menu`, `fk_constraint`, `user`) value ALTER TABLE llx_product ADD COLUMN volume float DEFAULT NULL after weight_units; ALTER TABLE llx_product ADD COLUMN volume_units tinyint DEFAULT NULL after volume; -ALTER TABLE llx_product modify ref varchar(32) NOT NULL; \ No newline at end of file +ALTER TABLE llx_product modify ref varchar(32) NOT NULL; + +ALTER TABLE `llx_socpeople` CHANGE `fk_user` `fk_user_create` INT( 11 ) NULL DEFAULT '0'; \ No newline at end of file diff --git a/mysql/tables/llx_socpeople.sql b/mysql/tables/llx_socpeople.sql index b492f8d1f1c..b8d099c7af7 100644 --- a/mysql/tables/llx_socpeople.sql +++ b/mysql/tables/llx_socpeople.sql @@ -41,7 +41,7 @@ create table llx_socpeople fax varchar(30), email varchar(255), jabberid varchar(255), - fk_user integer DEFAULT 0, -- user qui a créé l'enregistrement + fk_user_create integer DEFAULT 0, -- user qui a créé l'enregistrement fk_user_modif integer, note text )type=innodb; diff --git a/mysql/tables/llx_user.sql b/mysql/tables/llx_user.sql index b0768a9f9e4..98e705796cc 100644 --- a/mysql/tables/llx_user.sql +++ b/mysql/tables/llx_user.sql @@ -48,6 +48,6 @@ create table llx_user datepreviouslogin datetime, egroupware_id integer, ldap_sid varchar(255) DEFAULT NULL, - statut tinyint DEFAULT 1, + statut tinyint DEFAULT 1, lang varchar(6) )type=innodb;