diff --git a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql index b7a12f34262..5ab46b6c4f2 100755 --- a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql +++ b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql @@ -66,4 +66,4 @@ ALTER TABLE llx_propaldet_extrafields ADD INDEX idx_propaldet_extrafields (fk_ob DROP table llx_adherent_options; DROP table llx_adherent_options_label; - +ALTER TABLE `llx_user` ADD `accountancy_code` VARCHAR( 24 ) NULL; diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index 6042b0906ce..9fd1db59c91 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -62,5 +62,6 @@ create table llx_user statut tinyint DEFAULT 1, photo varchar(255), -- filename or url of photo lang varchar(6), - color varchar(6) + color varchar(6), + accountancy_code varchar(24) NULL )ENGINE=innodb; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index a98e5c5dbd8..39fc2132042 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -96,6 +96,8 @@ class User extends CommonObject var $users; // To store all tree of users hierarchy var $parentof; // To store an array of all parents for all ids. + + var $accountancy_code; // Accountancy code in prevision of the complete accountancy module /** @@ -149,6 +151,7 @@ class User extends CommonObject $sql.= " u.datepreviouslogin as datep,"; $sql.= " u.photo as photo,"; $sql.= " u.openid as openid,"; + $sql.= " u.accountancy_code,"; $sql.= " u.ref_int, u.ref_ext"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; @@ -209,6 +212,7 @@ class User extends CommonObject $this->openid = $obj->openid; $this->lang = $obj->lang; $this->entity = $obj->entity; + $this->accountancy_code = $obj->accountancy_code; $this->datec = $this->db->jdate($obj->datec); $this->datem = $this->db->jdate($obj->datem); @@ -1114,6 +1118,7 @@ class User extends CommonObject $this->address = empty($this->address)?'':$this->address; $this->zip = empty($this->zip)?'':$this->zip; $this->town = empty($this->town)?'':$this->town; + $this->accountancy_code = trim($this->accountancy_code); // Check parameters if (! empty($conf->global->USER_MAIL_REQUIRED) && ! isValidEMail($this->email)) @@ -1142,6 +1147,7 @@ class User extends CommonObject $sql.= ", email = '".$this->db->escape($this->email)."'"; $sql.= ", job = '".$this->db->escape($this->job)."'"; $sql.= ", signature = '".$this->db->escape($this->signature)."'"; + $sql.= ", accountancy_code = '".$this->db->escape($this->accountancy_code)."'"; $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"); diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 53de51df268..66cb62ef362 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -188,6 +188,7 @@ if ($action == 'add' && $canadduser) $object->email = GETPOST("email"); $object->job = GETPOST("job"); $object->signature = GETPOST("signature"); + $object->accountancy_code = GETPOST("accountancy_code"); $object->note = GETPOST("note"); $object->ldap_sid = GETPOST("ldap_sid"); @@ -324,6 +325,7 @@ if ($action == 'update' && ! $_POST["cancel"]) $object->email = GETPOST("email"); $object->job = GETPOST("job"); $object->signature = GETPOST("signature"); + $object->accountancy_code = GETPOST("accountancy_code"); $object->openid = GETPOST("openid"); $object->fk_user = GETPOST("fk_user")>0?GETPOST("fk_user"):0; @@ -1192,6 +1194,10 @@ else } print ''; print "\n"; + + // Accountancy code + print '