From f7815d0c8aa815562094116380ab3ac405743da5 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 7 Nov 2009 08:34:45 +0000 Subject: [PATCH] Works on multicompany module --- .../install/mysql/migration/2.6.0-2.7.0.sql | 12 ++++++++++ .../install/mysql/tables/llx_adherent.key.sql | 3 ++- htdocs/install/mysql/tables/llx_adherent.sql | 2 ++ .../mysql/tables/llx_adherent_options.key.sql | 4 +++- .../mysql/tables/llx_adherent_options.sql | 3 ++- .../tables/llx_adherent_options_label.key.sql | 22 +++++++++++++++++++ .../tables/llx_adherent_options_label.sql | 9 +++++--- .../mysql/tables/llx_adherent_type.key.sql | 5 +++-- .../mysql/tables/llx_adherent_type.sql | 4 +++- 9 files changed, 55 insertions(+), 9 deletions(-) create mode 100644 htdocs/install/mysql/tables/llx_adherent_options_label.key.sql diff --git a/htdocs/install/mysql/migration/2.6.0-2.7.0.sql b/htdocs/install/mysql/migration/2.6.0-2.7.0.sql index d6ba3f02f17..71e65520537 100644 --- a/htdocs/install/mysql/migration/2.6.0-2.7.0.sql +++ b/htdocs/install/mysql/migration/2.6.0-2.7.0.sql @@ -133,10 +133,17 @@ ALTER TABLE llx_bank_categ ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER la ALTER TABLE llx_bordereau_cheque ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER number; ALTER TABLE llx_prelevement_bons ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref; ALTER TABLE llx_projet ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref; +ALTER TABLE llx_adherent ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid; +ALTER TABLE llx_adherent_type ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid; +ALTER TABLE llx_adherent_options_label ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER name; ALTER TABLE llx_rights_def DROP PRIMARY KEY; ALTER TABLE llx_dolibarr_modules DROP PRIMARY KEY; +ALTER TABLE llx_adherent_options_label DROP PRIMARY KEY; +ALTER TABLE llx_adherent_options_label MODIFY COLUMN name varchar(64) NOT NULL; +ALTER TABLE llx_adherent_options_label ADD COLUMN rowid integer AUTO_INCREMENT PRIMARY KEY FIRST; + ALTER TABLE llx_user_param DROP INDEX fk_user; ALTER TABLE llx_societe DROP INDEX uk_societe_prefix_comm; ALTER TABLE llx_societe DROP INDEX uk_societe_code_client; @@ -160,6 +167,8 @@ ALTER TABLE llx_fichinter DROP INDEX ref; ALTER TABLE llx_prelevement_bons DROP INDEX ref; ALTER TABLE llx_projet DROP INDEX ref; ALTER TABLE llx_boxes_def DROP INDEX uk_boxes_def; +ALTER TABLE llx_adherent DROP INDEX uk_adherent_login; +ALTER TABLE llx_adherent_type DROP INDEX uk_adherent_type_libelle; ALTER TABLE llx_rights_def ADD PRIMARY KEY pk_rights_def (id, entity); ALTER TABLE llx_dolibarr_modules ADD PRIMARY KEY pk_dolibarr_modules (numero, entity); @@ -189,6 +198,9 @@ ALTER TABLE llx_bordereau_cheque ADD UNIQUE INDEX uk_bordereau_cheque (number, e ALTER TABLE llx_prelevement_bons ADD UNIQUE INDEX uk_prelevement_bons_ref (ref, entity); ALTER TABLE llx_projet ADD UNIQUE INDEX uk_projet_ref (ref, entity); ALTER TABLE llx_boxes_def ADD UNIQUE INDEX uk_boxes_def (file, entity); +ALTER TABLE llx_adherent ADD UNIQUE INDEX uk_adherent_login (login, entity); +ALTER TABLE llx_adherent_type ADD UNIQUE INDEX uk_adherent_type_libelle (libelle, entity); +ALTER TABLE llx_adherent_options_label ADD UNIQUE INDEX uk_adherent_options_label_name (name, entity); ALTER TABLE llx_projet ADD INDEX idx_projet_fk_soc (fk_soc); ALTER TABLE llx_projet ADD CONSTRAINT fk_projet_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); diff --git a/htdocs/install/mysql/tables/llx_adherent.key.sql b/htdocs/install/mysql/tables/llx_adherent.key.sql index 4fd40cb8e4d..94342e19463 100644 --- a/htdocs/install/mysql/tables/llx_adherent.key.sql +++ b/htdocs/install/mysql/tables/llx_adherent.key.sql @@ -1,5 +1,6 @@ -- ============================================================================ -- Copyright (C) 2009 Laurent Destailleur +-- Copyright (C) 2009 Regis Houssin -- -- 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 @@ -19,7 +20,7 @@ -- ============================================================================ -ALTER TABLE llx_adherent ADD UNIQUE INDEX uk_adherent_login (login); +ALTER TABLE llx_adherent ADD UNIQUE INDEX uk_adherent_login (login, entity); ALTER TABLE llx_adherent ADD UNIQUE INDEX uk_adherent_fk_soc (fk_soc); ALTER TABLE llx_adherent ADD INDEX idx_adherent_fk_soc (fk_soc); diff --git a/htdocs/install/mysql/tables/llx_adherent.sql b/htdocs/install/mysql/tables/llx_adherent.sql index 77161ad590d..af6f908ddf4 100644 --- a/htdocs/install/mysql/tables/llx_adherent.sql +++ b/htdocs/install/mysql/tables/llx_adherent.sql @@ -2,6 +2,7 @@ -- Copyright (C) 2002-2004 Rodolphe Quiedeville -- Copyright (C) 2002-2003 Jean-Louis Bergamo -- Copyright (C) 2006-2009 Laurent Destailleur +-- Copyright (C) 2009 Regis Houssin -- -- 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 @@ -28,6 +29,7 @@ create table llx_adherent ( rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer DEFAULT 1 NOT NULL, -- multi company id nom varchar(50), prenom varchar(50), login varchar(50) NOT NULL, -- login diff --git a/htdocs/install/mysql/tables/llx_adherent_options.key.sql b/htdocs/install/mysql/tables/llx_adherent_options.key.sql index c8522d21bd7..d299481a230 100644 --- a/htdocs/install/mysql/tables/llx_adherent_options.key.sql +++ b/htdocs/install/mysql/tables/llx_adherent_options.key.sql @@ -1,6 +1,7 @@ -- =================================================================== -- Copyright (C) 2002-2003 Rodolphe Quiedeville --- Copyright (C) 2002-2003 Jean-Louis Bergamo +-- Copyright (C) 2002-2003 Jean-Louis Bergamo +-- Copyright (C) 2009 Regis Houssin -- -- 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 @@ -19,4 +20,5 @@ -- $Id$ -- =================================================================== + ALTER TABLE llx_adherent_options ADD INDEX idx_adherent_options (adhid); diff --git a/htdocs/install/mysql/tables/llx_adherent_options.sql b/htdocs/install/mysql/tables/llx_adherent_options.sql index 54bb92db3ea..9752cf5703f 100644 --- a/htdocs/install/mysql/tables/llx_adherent_options.sql +++ b/htdocs/install/mysql/tables/llx_adherent_options.sql @@ -1,6 +1,7 @@ -- =================================================================== -- Copyright (C) 2002-2003 Rodolphe Quiedeville --- Copyright (C) 2002-2003 Jean-Louis Bergamo +-- Copyright (C) 2002-2003 Jean-Louis Bergamo +-- Copyright (C) 2009 Regis Houssin -- -- 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 diff --git a/htdocs/install/mysql/tables/llx_adherent_options_label.key.sql b/htdocs/install/mysql/tables/llx_adherent_options_label.key.sql new file mode 100644 index 00000000000..299d512a9f0 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_adherent_options_label.key.sql @@ -0,0 +1,22 @@ +-- =================================================================== +-- Copyright (C) 2009 Regis Houssin +-- +-- 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_adherent_options_label ADD UNIQUE INDEX uk_adherent_options_label_name (name, entity); diff --git a/htdocs/install/mysql/tables/llx_adherent_options_label.sql b/htdocs/install/mysql/tables/llx_adherent_options_label.sql index db32c70829b..78e53d6e46f 100644 --- a/htdocs/install/mysql/tables/llx_adherent_options_label.sql +++ b/htdocs/install/mysql/tables/llx_adherent_options_label.sql @@ -1,6 +1,7 @@ -- =================================================================== -- Copyright (C) 2002-2003 Rodolphe Quiedeville --- Copyright (C) 2002-2003 Jean-Louis Bergamo +-- Copyright (C) 2002-2003 Jean-Louis Bergamo +-- Copyright (C) 2009 Regis Houssin -- -- 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 @@ -21,9 +22,11 @@ create table llx_adherent_options_label ( - name varchar(64) PRIMARY KEY, -- nom de l'attribut + rowid integer AUTO_INCREMENT PRIMARY KEY, + name varchar(64) NOT NULL, -- nom de l'attribut + entity integer DEFAULT 1 NOT NULL, -- multi company id tms timestamp, - label varchar(255) NOT NULL, -- label correspondant a l'attribut + label varchar(255) NOT NULL, -- label correspondant a l'attribut type varchar(8), size integer DEFAULT 0, pos integer DEFAULT 0 diff --git a/htdocs/install/mysql/tables/llx_adherent_type.key.sql b/htdocs/install/mysql/tables/llx_adherent_type.key.sql index 66ae0539b0a..a7efcbd0f6d 100644 --- a/htdocs/install/mysql/tables/llx_adherent_type.key.sql +++ b/htdocs/install/mysql/tables/llx_adherent_type.key.sql @@ -1,5 +1,6 @@ -- ============================================================================ --- Copyright (C) 2007 Laurent Destailleur +-- Copyright (C) 2007-2009 Laurent Destailleur +-- Copyright (C) 2009 Regis Houssin -- -- 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 @@ -19,4 +20,4 @@ -- ============================================================================ -ALTER TABLE llx_adherent_type ADD UNIQUE uk_adherent_type_libelle (libelle); +ALTER TABLE llx_adherent_type ADD UNIQUE INDEX uk_adherent_type_libelle (libelle, entity); diff --git a/htdocs/install/mysql/tables/llx_adherent_type.sql b/htdocs/install/mysql/tables/llx_adherent_type.sql index 1862515277a..458e290759a 100644 --- a/htdocs/install/mysql/tables/llx_adherent_type.sql +++ b/htdocs/install/mysql/tables/llx_adherent_type.sql @@ -1,6 +1,7 @@ -- =================================================================== -- Copyright (C) 2002-2003 Rodolphe Quiedeville --- Copyright (C) 2002-2003 Jean-Louis Bergamo +-- Copyright (C) 2002-2003 Jean-Louis Bergamo +-- Copyright (C) 2009 Regis Houssin -- -- 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 @@ -26,6 +27,7 @@ create table llx_adherent_type ( rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer DEFAULT 1 NOT NULL, -- multi company id tms timestamp, statut smallint NOT NULL DEFAULT 0, libelle varchar(50) NOT NULL,