New: early development of multi-company module

This commit is contained in:
Regis Houssin 2009-05-02 15:18:42 +00:00
parent 828bf22670
commit b3360827ba
3 changed files with 24 additions and 16 deletions

View File

@ -32,6 +32,7 @@ ALTER TABLE llx_expedition ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER re
ALTER TABLE llx_facture_fourn ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER facnumber;
ALTER TABLE llx_livraison ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref;
ALTER TABLE llx_fichinter ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref;
ALTER TABLE llx_contrat ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref;
ALTER TABLE llx_rights_def DROP PRIMARY KEY;
ALTER TABLE llx_user_param DROP INDEX fk_user;
@ -75,4 +76,5 @@ ALTER TABLE llx_facture ADD UNIQUE INDEX idx_facture_uk_facnumber (facnumber, en
ALTER TABLE llx_expedition ADD UNIQUE INDEX idx_expedition_uk_ref (ref, entity);
ALTER TABLE llx_facture_fourn ADD UNIQUE INDEX uk_facture_fourn_ref (facnumber, fk_soc, entity);
ALTER TABLE llx_livraison ADD UNIQUE INDEX idx_livraison_uk_ref (ref, entity);
ALTER TABLE llx_fichinter ADD UNIQUE INDEX uk_fichinter_ref (ref, entity);
ALTER TABLE llx_fichinter ADD UNIQUE INDEX uk_fichinter_ref (ref, entity);
ALTER TABLE llx_contrat ADD UNIQUE INDEX uk_contrat_ref (ref, entity);

View File

@ -1,6 +1,7 @@
-- ============================================================================
-- Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2004-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
@ -25,6 +26,8 @@
-- V4 DELETE llx_contrat FROM llx_contrat LEFT JOIN llx_societe ON llx_contrat.fk_soc = llx_societe.rowid WHERE llx_societe.rowid IS NULL;
-- V4 DELETE llx_contrat FROM llx_contrat LEFT JOIN llx_user ON llx_contrat.fk_user_author = llx_user.rowid WHERE llx_user.rowid IS NULL;
ALTER TABLE llx_contrat ADD UNIQUE INDEX uk_contrat_ref (ref, entity);
ALTER TABLE llx_contrat ADD INDEX idx_contrat_fk_soc (fk_soc);
ALTER TABLE llx_contrat ADD INDEX idx_contrat_fk_user_author (fk_user_author);

View File

@ -1,6 +1,7 @@
-- ============================================================================
-- Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2004-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
@ -21,23 +22,25 @@
create table llx_contrat
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
ref varchar(30), -- reference de contrat
tms timestamp,
datec datetime, -- date de creation de l'enregistrement
date_contrat datetime,
statut smallint DEFAULT 0,
mise_en_service datetime,
fin_validite datetime,
date_cloture datetime,
fk_soc integer NOT NULL,
fk_projet integer,
fk_commercial_signature integer NOT NULL, -- obsolete
rowid integer AUTO_INCREMENT PRIMARY KEY,
ref varchar(30), -- reference de contrat
entity integer DEFAULT 1 NOT NULL, -- multi company id
tms timestamp,
datec datetime, -- date de creation de l enregistrement
date_contrat datetime,
statut smallint DEFAULT 0,
mise_en_service datetime,
fin_validite datetime,
date_cloture datetime,
fk_soc integer NOT NULL,
fk_projet integer,
fk_commercial_signature integer NOT NULL, -- obsolete
fk_commercial_suivi integer NOT NULL, -- obsolete
fk_user_author integer NOT NULL default 0,
fk_user_mise_en_service integer,
fk_user_cloture integer,
note text,
note_public text
fk_user_cloture integer,
note text,
note_public text
)type=innodb;