New: early development of multi-company module

This commit is contained in:
Regis Houssin 2009-04-30 11:44:14 +00:00
parent 467ec4a641
commit 88d0f1ede7
3 changed files with 33 additions and 25 deletions

View File

@ -29,6 +29,7 @@ ALTER TABLE llx_commande_fournisseur ADD COLUMN entity integer DEFAULT 1 NOT NUL
ALTER TABLE llx_product_fournisseur ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref_fourn;
ALTER TABLE llx_facture ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER facnumber;
ALTER TABLE llx_expedition ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref;
ALTER TABLE llx_facture_fourn ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER facnumber;
ALTER TABLE llx_rights_def DROP PRIMARY KEY;
ALTER TABLE llx_user_param DROP INDEX fk_user;
@ -47,6 +48,7 @@ ALTER TABLE llx_product_fournisseur DROP INDEX fk_product;
ALTER TABLE llx_product_fournisseur DROP INDEX fk_soc;
ALTER TABLE llx_facture DROP INDEX idx_facture_uk_facnumber;
ALTER TABLE llx_expedition DROP INDEX idx_expedition_uk_ref;
ALTER TABLE llx_facture_fourn DROP INDEX uk_facture_fourn_ref;
ALTER TABLE llx_rights_def ADD PRIMARY KEY (id, entity);
ALTER TABLE llx_user_param ADD UNIQUE INDEX uk_user_param (fk_user,param,entity);
@ -65,4 +67,5 @@ ALTER TABLE llx_product_fournisseur ADD UNIQUE INDEX uk_product_fournisseur_ref
ALTER TABLE llx_product_fournisseur ADD INDEX idx_product_fourn_fk_product (fk_product, entity);
ALTER TABLE llx_product_fournisseur ADD INDEX idx_product_fourn_fk_soc (fk_soc, entity);
ALTER TABLE llx_facture ADD UNIQUE INDEX idx_facture_uk_facnumber (facnumber, entity);
ALTER TABLE llx_expedition ADD UNIQUE INDEX idx_expedition_uk_ref (ref, entity);
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);

View File

@ -1,5 +1,6 @@
-- ============================================================================
-- 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
@ -19,7 +20,7 @@
-- ============================================================================
ALTER TABLE llx_facture_fourn ADD UNIQUE INDEX uk_facture_fourn_ref (facnumber, fk_soc);
ALTER TABLE llx_facture_fourn ADD UNIQUE INDEX uk_facture_fourn_ref (facnumber, fk_soc, entity);
ALTER TABLE llx_facture_fourn ADD INDEX idx_facture_fourn_date_lim_reglement (date_lim_reglement);

View File

@ -1,6 +1,7 @@
-- ===========================================================================
-- Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net>
-- 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
@ -21,33 +22,36 @@
create table llx_facture_fourn
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
facnumber varchar(50) NOT NULL,
type smallint DEFAULT 0 NOT NULL,
fk_soc integer NOT NULL,
datec datetime, -- date de creation de la facture
datef date, -- date de la facture
libelle varchar(255),
paye smallint DEFAULT 0 NOT NULL,
amount double(24,8) DEFAULT 0 NOT NULL,
remise double(24,8) DEFAULT 0,
tva double(24,8) DEFAULT 0,
total double(24,8) DEFAULT 0,
total_ht double(24,8) DEFAULT 0,
total_tva double(24,8) DEFAULT 0,
total_ttc double(24,8) DEFAULT 0,
rowid integer AUTO_INCREMENT PRIMARY KEY,
facnumber varchar(50) NOT NULL,
entity integer DEFAULT 1 NOT NULL, -- multi company id
type smallint DEFAULT 0 NOT NULL,
fk_soc integer NOT NULL,
datec datetime, -- date de creation de la facture
datef date, -- date de la facture
libelle varchar(255),
paye smallint DEFAULT 0 NOT NULL,
amount double(24,8) DEFAULT 0 NOT NULL,
remise double(24,8) DEFAULT 0,
tva double(24,8) DEFAULT 0,
total double(24,8) DEFAULT 0,
total_ht double(24,8) DEFAULT 0,
total_tva double(24,8) DEFAULT 0,
total_ttc double(24,8) DEFAULT 0,
fk_statut smallint DEFAULT 0 NOT NULL,
fk_statut smallint DEFAULT 0 NOT NULL,
fk_user_author integer, -- createur de la facture
fk_user_valid integer, -- valideur de la facture
fk_user_author integer, -- createur de la facture
fk_user_valid integer, -- valideur de la facture
fk_projet integer, -- projet auquel est associée la facture
fk_projet integer, -- projet auquel est associée la facture
fk_cond_reglement integer DEFAULT 1 NOT NULL, -- condition de reglement (30 jours, fin de mois ...)
date_lim_reglement date, -- date limite de reglement
date_lim_reglement date, -- date limite de reglement
note text,
note_public text,
import_key varchar(14)
note text,
note_public text,
import_key varchar(14)
)type=innodb;