Add tables to store working employee contracts

This commit is contained in:
Laurent Destailleur
2016-09-28 19:23:34 +02:00
parent 86d86f8442
commit 2d6877ac67
5 changed files with 71 additions and 9 deletions

View File

@@ -21,8 +21,8 @@
ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_login (login, entity);
ALTER TABLE llx_user ADD INDEX idx_user_fk_societe (fk_soc);
ALTER TABLE llx_user ADD INDEX idx_user_fk_societe (fk_soc);
ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_fk_socpeople (fk_socpeople);
ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_fk_member (fk_member);
ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_api_key (api_key);
ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_api_key (api_key);

View File

@@ -78,7 +78,7 @@ create table llx_user
nb_holiday integer DEFAULT 0,
thm double(24,8),
tjm double(24,8),
salary double(24,8),
salaryextra double(24,8),
weeklyhours double(16,8)
salary double(24,8), -- denormalized value coming from llx_user_employment
salaryextra double(24,8), -- denormalized value coming from llx_user_employment
weeklyhours double(16,8) -- denormalized value coming from llx_user_employment
)ENGINE=innodb;

View File

@@ -0,0 +1,21 @@
-- ============================================================================
-- Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- ===========================================================================
ALTER TABLE llx_user_employment ADD UNIQUE INDEX uk_user_employment (ref,entity);
ALTER TABLE llx_user_employment ADD CONSTRAINT fk_user_employment_fk_user FOREIGN KEY (fk_user) REFERENCES llx_user (rowid);

View File

@@ -0,0 +1,39 @@
-- ============================================================================
-- Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- This table can be used to store employee working contracts
-- ===========================================================================
create table llx_user_employment
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1 NOT NULL, -- multi company id
ref varchar(50), -- reference
ref_ext varchar(50), -- reference into an external system (not used by dolibarr)
fk_user integer,
datec datetime,
tms timestamp,
fk_user_creat integer,
fk_user_modif integer,
job varchar(128), -- job position. may be a dictionnary
status integer NOT NULL, -- draft, active, closed
salary double(24,8), -- last and current value stored into llx_user
salaryextra double(24,8), -- last and current value stored into llx_user
weeklyhours double(16,8) -- last and current value stored into llx_user
dateemployment date, -- last and current value stored into llx_user
dateemploymentend date, -- last and current value stored into llx_user
)ENGINE=innodb;

View File

@@ -115,11 +115,13 @@ class User extends CommonObject
var $parentof; // To store an array of all parents for all ids.
var $accountancy_code; // Accountancy code in prevision of the complete accountancy module
var $thm; // Average cost of employee
var $thm; // Average cost of employee - Used for valuation of time spent
var $tjm; // Average cost of employee
var $salary; // Monthly salary
var $salaryextra; // Monthly salary extra
var $weeklyhours; // Weekly hours
var $salary; // Monthly salary - Denormalized value from llx_user_employment
var $salaryextra; // Monthly salary extra - Denormalized value from llx_user_employment
var $weeklyhours; // Weekly hours - Denormalized value from llx_user_employment
var $color; // Define background color for user in agenda