New: early development of multi-company module
This commit is contained in:
parent
9d47744153
commit
ed159235f5
@ -17,5 +17,33 @@
|
||||
-- $Id$
|
||||
--
|
||||
|
||||
--
|
||||
-- Constantes communes de configuration
|
||||
--
|
||||
UPDATE llx_const SET entity=0 WHERE name='MAIN_MODULE_MULTICOMPANY' AND entity=1;
|
||||
UPDATE llx_const SET entity=0 WHERE name='MAIN_MODULE_USER' AND entity=1;
|
||||
UPDATE llx_const SET entity=0 WHERE name='MAIN_MODULE_MULTICOMPANY' AND entity=1;
|
||||
UPDATE llx_const SET entity=0 WHERE name='MAIN_POPUP_CALENDAR' AND entity=1;
|
||||
UPDATE llx_const SET entity=0 WHERE name='MAIN_MAIL_SMTP_SERVER' AND entity=1;
|
||||
UPDATE llx_const SET entity=0 WHERE name='MAIN_MAIL_SMTP_PORT' AND entity=1;
|
||||
UPDATE llx_const SET entity=0 WHERE name='MAIN_UPLOAD_DOC' AND entity=1;
|
||||
UPDATE llx_const SET entity=0 WHERE name='MAIN_FEATURES_LEVEL' AND entity=1;
|
||||
UPDATE llx_const SET entity=0 WHERE name='MAIN_SEARCHFORM_SOCIETE' AND entity=1;
|
||||
UPDATE llx_const SET entity=0 WHERE name='MAIN_SEARCHFORM_CONTACT' AND entity=1;
|
||||
UPDATE llx_const SET entity=0 WHERE name='MAIN_SEARCHFORM_PRODUITSERVICE' AND entity=1;
|
||||
UPDATE llx_const SET entity=0 WHERE name='MAIN_SEARCHFORM_ADHERENT' AND entity=1;
|
||||
|
||||
--
|
||||
-- IHM
|
||||
--
|
||||
UPDATE llx_const SET entity=0 WHERE name='MAIN_SIZE_LISTE_LIMIT' AND entity=1;
|
||||
UPDATE llx_const SET entity=0 WHERE name='MAIN_SHOW_WORKBOARD' AND entity=1;
|
||||
|
||||
--
|
||||
-- Tiers
|
||||
--
|
||||
UPDATE llx_const SET entity=0 WHERE name='SOCIETE_NOLIST_COURRIER' AND entity=1;
|
||||
|
||||
--
|
||||
-- Barcode
|
||||
--
|
||||
UPDATE llx_const SET entity=0 WHERE name='GENBARCODE_LOCATION' AND entity=1;
|
||||
@ -17,5 +17,33 @@
|
||||
-- $Id$
|
||||
--
|
||||
|
||||
--
|
||||
-- Constantes communes de configuration
|
||||
--
|
||||
DELETE FROM llx_const WHERE name='MAIN_MODULE_MULTICOMPANY';
|
||||
UPDATE llx_const SET entity=1 WHERE name='MAIN_MODULE_USER' AND entity=0;
|
||||
DELETE FROM llx_const WHERE name='MAIN_MODULE_MULTICOMPANY';
|
||||
UPDATE llx_const SET entity=1 WHERE name='MAIN_POPUP_CALENDAR' AND entity=0;
|
||||
UPDATE llx_const SET entity=1 WHERE name='MAIN_MAIL_SMTP_SERVER' AND entity=0;
|
||||
UPDATE llx_const SET entity=1 WHERE name='MAIN_MAIL_SMTP_PORT' AND entity=0;
|
||||
UPDATE llx_const SET entity=1 WHERE name='MAIN_UPLOAD_DOC' AND entity=0;
|
||||
UPDATE llx_const SET entity=1 WHERE name='MAIN_FEATURES_LEVEL' AND entity=0;
|
||||
UPDATE llx_const SET entity=1 WHERE name='MAIN_SEARCHFORM_SOCIETE' AND entity=0;
|
||||
UPDATE llx_const SET entity=1 WHERE name='MAIN_SEARCHFORM_CONTACT' AND entity=0;
|
||||
UPDATE llx_const SET entity=1 WHERE name='MAIN_SEARCHFORM_PRODUITSERVICE' AND entity=0;
|
||||
UPDATE llx_const SET entity=1 WHERE name='MAIN_SEARCHFORM_ADHERENT' AND entity=0;
|
||||
|
||||
--
|
||||
-- IHM
|
||||
--
|
||||
UPDATE llx_const SET entity=1 WHERE name='MAIN_SIZE_LISTE_LIMIT' AND entity=0;
|
||||
UPDATE llx_const SET entity=1 WHERE name='MAIN_SHOW_WORKBOARD' AND entity=0;
|
||||
|
||||
--
|
||||
-- Tiers
|
||||
--
|
||||
UPDATE llx_const SET entity=1 WHERE name='SOCIETE_NOLIST_COURRIER' AND entity=0;
|
||||
|
||||
--
|
||||
-- Barcode
|
||||
--
|
||||
UPDATE llx_const SET entity=1 WHERE name='GENBARCODE_LOCATION' AND entity=0;
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (c) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2005 Lionel Cousteix <etm_ltd@tiscali.co.uk>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -63,6 +63,7 @@ class User extends CommonObject
|
||||
var $user_mobile;
|
||||
var $admin;
|
||||
var $login;
|
||||
var $entity;
|
||||
|
||||
//! Clear password in memory
|
||||
var $pass;
|
||||
@ -146,7 +147,7 @@ class User extends CommonObject
|
||||
$sql.= " u.admin, u.login, u.webcal_login, u.phenix_login, u.phenix_pass, u.note,";
|
||||
$sql.= " u.pass, u.pass_crypted, u.pass_temp,";
|
||||
$sql.= " u.fk_societe, u.fk_socpeople, u.fk_member, u.ldap_sid,";
|
||||
$sql.= " u.statut, u.lang,";
|
||||
$sql.= " u.statut, u.lang, u.entity,";
|
||||
$sql.= " ".$this->db->pdate("u.datec")." as datec,";
|
||||
$sql.= " ".$this->db->pdate("u.tms")." as datem,";
|
||||
$sql.= " ".$this->db->pdate("u.datelastlogin")." as datel,";
|
||||
@ -194,6 +195,7 @@ class User extends CommonObject
|
||||
$this->note = $obj->note;
|
||||
$this->statut = $obj->statut;
|
||||
$this->lang = $obj->lang;
|
||||
$this->entity = $obj->entity;
|
||||
|
||||
$this->datec = $obj->datec;
|
||||
$this->datem = $obj->datem;
|
||||
@ -980,6 +982,7 @@ class User extends CommonObject
|
||||
$sql.= ", phenix_login = '".addslashes($this->phenix_login)."'";
|
||||
$sql.= ", phenix_pass = '".addslashes($this->phenix_pass)."'";
|
||||
$sql.= ", note = '".addslashes($this->note)."'";
|
||||
//$sql.= ", entity = '".$this->entity."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog("User::update sql=".$sql, LOG_DEBUG);
|
||||
@ -1027,6 +1030,8 @@ class User extends CommonObject
|
||||
|
||||
$adh->user_id=$this->id;
|
||||
$adh->user_login=$this->login;
|
||||
|
||||
//$adh->entity=$this->entity;
|
||||
|
||||
$result=$adh->update($user,0,1);
|
||||
if ($result < 0)
|
||||
@ -1702,7 +1707,7 @@ class User extends CommonObject
|
||||
function info($id)
|
||||
{
|
||||
$sql = "SELECT u.rowid, u.login as ref, ".$this->db->pdate("datec")." as datec,";
|
||||
$sql.= $this->db->pdate("u.tms")." as date_modification";
|
||||
$sql.= $this->db->pdate("u.tms")." as date_modification, u.entity";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE u.rowid = ".$id;
|
||||
|
||||
@ -1718,6 +1723,7 @@ class User extends CommonObject
|
||||
$this->ref = (! $obj->ref) ? $obj->rowid : $obj->ref;
|
||||
$this->date_creation = $obj->datec;
|
||||
$this->date_modification = $obj->date_modification;
|
||||
$this->entity = $obj->entity;
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
|
||||
@ -125,6 +125,13 @@ ALTER TABLE llx_categorie_association ADD UNIQUE INDEX uk_categorie_association_
|
||||
|
||||
-- Multi company
|
||||
ALTER TABLE llx_const ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER tms;
|
||||
ALTER TABLE llx_user ADD COLUMN entity varchar(20) DEFAULT 1 NOT NULL AFTER lang;
|
||||
ALTER TABLE llx_usergroup ADD COLUMN entity varchar(20) DEFAULT 1 NOT NULL AFTER note;
|
||||
|
||||
ALTER TABLE llx_const DROP INDEX name;
|
||||
ALTER TABLE llx_user DROP INDEX uk_user_login;
|
||||
ALTER TABLE llx_usergroup DROP INDEX nom;
|
||||
|
||||
ALTER TABLE llx_const ADD UNIQUE INDEX uk_const (name, entity);
|
||||
ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_login (login, entity);
|
||||
ALTER TABLE llx_usergroup ADD UNIQUE INDEX uk_usergroup_name (nom, entity);
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
-- ===========================================================================
|
||||
|
||||
|
||||
ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_login (login);
|
||||
ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_login (login, entity);
|
||||
|
||||
ALTER TABLE llx_user ADD INDEX uk_user_fk_societe (fk_societe);
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
-- ============================================================================
|
||||
-- Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2007 Regis Houssin <regis@dolibarr.fr>
|
||||
-- Copyright (C) 2007-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
--
|
||||
-- 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
|
||||
@ -50,5 +50,16 @@ create table llx_user
|
||||
egroupware_id integer,
|
||||
ldap_sid varchar(255) DEFAULT NULL,
|
||||
statut tinyint DEFAULT 1,
|
||||
lang varchar(6)
|
||||
lang varchar(6),
|
||||
entity varchar(20) DEFAULT 1 NOT NULL -- multi company id
|
||||
)type=innodb;
|
||||
|
||||
--
|
||||
-- List of codes for the field entity
|
||||
--
|
||||
-- 0 : common user
|
||||
-- 1 : first company user
|
||||
-- 2 : second company user
|
||||
-- 1,3 : first and third company user
|
||||
-- etc...
|
||||
--
|
||||
22
mysql/tables/llx_usergroup.key.sql
Normal file
22
mysql/tables/llx_usergroup.key.sql
Normal file
@ -0,0 +1,22 @@
|
||||
-- ============================================================================
|
||||
-- Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
|
||||
--
|
||||
-- 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 2 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, write to the Free Software
|
||||
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
--
|
||||
-- $Id$
|
||||
-- ============================================================================
|
||||
|
||||
|
||||
ALTER TABLE llx_usergroup ADD UNIQUE INDEX uk_usergroup_name (nom, entity);
|
||||
@ -1,6 +1,7 @@
|
||||
-- ============================================================================
|
||||
-- Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
--
|
||||
-- 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
|
||||
@ -24,7 +25,17 @@ create table llx_usergroup
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
datec datetime,
|
||||
tms timestamp,
|
||||
nom varchar(255) NOT NULL UNIQUE,
|
||||
note text
|
||||
|
||||
nom varchar(255) NOT NULL,
|
||||
note text,
|
||||
entity varchar(20) DEFAULT 1 NOT NULL -- multi company id
|
||||
)type=innodb;
|
||||
|
||||
--
|
||||
-- List of codes for the field entity
|
||||
--
|
||||
-- 0 : common group
|
||||
-- 1 : first company group
|
||||
-- 2 : second company group
|
||||
-- 1,3 : first and third company group
|
||||
-- etc...
|
||||
--
|
||||
Loading…
Reference in New Issue
Block a user