1-- ============================================================================
2-- Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3-- Copyright (C) 2006-2013 Laurent Destailleur  <eldy@users.sourceforge.net>
4-- Copyright (C) 2007-2013 Regis Houssin        <regis.houssin@inodbox.com>
5--
6-- This program is free software; you can redistribute it and/or modify
7-- it under the terms of the GNU General Public License as published by
8-- the Free Software Foundation; either version 3 of the License, or
9-- (at your option) any later version.
10--
11-- This program is distributed in the hope that it will be useful,
12-- but WITHOUT ANY WARRANTY; without even the implied warranty of
13-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14-- GNU General Public License for more details.
15--
16-- You should have received a copy of the GNU General Public License
17-- along with this program. If not, see <https://www.gnu.org/licenses/>.
18-- ===========================================================================
19
20create table llx_user
21(
22  rowid             integer AUTO_INCREMENT PRIMARY KEY,
23  entity            integer DEFAULT 1 NOT NULL, -- multi company id
24
25  ref_ext			varchar(50),				-- reference into an external system (not used by dolibarr)
26  ref_int			varchar(50),				-- reference into an internal system (deprecated)
27
28  admin             smallint DEFAULT 0,			-- user has admin profile
29
30  employee          tinyint        DEFAULT 1,	-- 1 if user is an employee
31  fk_establishment  integer        DEFAULT 0,
32
33  datec             datetime,
34  tms               timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
35  fk_user_creat     integer,
36  fk_user_modif     integer,
37  login             varchar(50) NOT NULL,
38  pass_encoding     varchar(24),
39  pass              varchar(128),
40  pass_crypted      varchar(128),
41  pass_temp         varchar(128),				-- temporary password when asked for forget password or 'hashtoallowreset:YYYMMDDHHMMSS' (where date is max date of validity)
42  api_key           varchar(128),				-- key to use REST API by this user
43  gender            varchar(10),
44  civility          varchar(6),
45  lastname          varchar(50),
46  firstname         varchar(50),
47  address           varchar(255),				-- user personal address
48  zip               varchar(25),				-- zipcode
49  town              varchar(50),				-- town
50  fk_state          integer        DEFAULT 0,
51  fk_country        integer        DEFAULT 0,
52  birth             date,						-- birthday
53  job		        varchar(128),
54  office_phone      varchar(20),
55  office_fax        varchar(20),
56  user_mobile       varchar(20),
57  personal_mobile   varchar(20),
58  email             varchar(255),
59  personal_email    varchar(255),
60  signature         text DEFAULT NULL,
61
62  socialnetworks    text DEFAULT NULL,       -- json with socialnetworks
63
64  --module_comm       smallint DEFAULT 1,
65  --module_compta     smallint DEFAULT 1,
66
67  fk_soc			integer,					-- id thirdparty if user linked to a company (external user)
68  fk_socpeople      integer,					-- id contact origin if user linked to a contact
69  fk_member         integer,					-- if member if suer linked to a member
70  fk_user           integer,					-- Supervisor, hierarchic parent
71  fk_user_expense_validator           integer,
72  fk_user_holiday_validator           integer,
73
74  idpers1			varchar(128),
75  idpers2			varchar(128),
76  idpers3			varchar(128),
77
78  note_public		text,
79  note              text DEFAULT NULL,
80  model_pdf         varchar(255) DEFAULT NULL,
81  datelastlogin     datetime,
82  datepreviouslogin datetime,
83  datelastpassvalidation datetime,				-- last date we change password or we made a disconnect all
84  datestartvalidity datetime,
85  dateendvalidity   datetime,
86  iplastlogin       varchar(250),
87  ippreviouslogin   varchar(250),
88  egroupware_id     integer,
89  ldap_sid          varchar(255) DEFAULT NULL,
90  openid            varchar(255),
91  statut            tinyint DEFAULT 1,
92  photo             varchar(255),				-- filename or url of photo
93  lang              varchar(6),					-- default language for communication. Note that language selected by user as interface language is savec into llx_user_param.
94  color				varchar(6),
95  barcode			varchar(255) DEFAULT NULL,
96  fk_barcode_type	integer      DEFAULT 0,
97  accountancy_code  varchar(32) NULL,
98  nb_holiday		integer      DEFAULT 0,
99  thm				double(24,8),
100  tjm				double(24,8),
101
102  salary			double(24,8),				-- denormalized value coming from llx_user_employment
103  salaryextra		double(24,8),				-- denormalized value coming from llx_user_employment
104  dateemployment	date,						-- denormalized value coming from llx_user_employment
105  dateemploymentend	date,						-- denormalized value coming from llx_user_employment
106  weeklyhours		double(16,8),				-- denormalized value coming from llx_user_employment
107
108  import_key        varchar(14),				-- import key
109  default_range     integer,
110  default_c_exp_tax_cat     integer,
111  fk_warehouse      integer						-- default warehouse os user
112)ENGINE=innodb;
113