Index: data/data.sql =================================================================== RCS file: /cvsroot/dolibarr/dolibarr/mysql/data/data.sql,v retrieving revision 1.154 diff -u -r1.154 data.sql --- data/data.sql 25 Aug 2005 22:10:00 -0000 1.154 +++ data/data.sql 7 Sep 2005 21:30:14 -0000 @@ -703,3 +703,15 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 8,2, '21','0','Taux à 21',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 9,7, '0','0','VAT Rate 0',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (10,7,'17.5','0','VAT Rate 17.5',1); + + +-- +-- Les types de contact d'un element +-- +insert into llx_c_type_contact(rowid, element, libelle, active ) values (0, 'contrat', 'Signataire', 1); +insert into llx_c_type_contact(rowid, element, libelle, active ) values (1, 'contrat', 'Facturation', 1); +insert into llx_c_type_contact(rowid, element, libelle, active ) values (2, 'contrat', 'Contact Client', 1); +insert into llx_c_type_contact(rowid, element, libelle, active ) values (3, 'contrat', 'Sous traitant', 1); + +insert into llx_c_type_contact(rowid, element, libelle, active ) values (4, 'projet', 'Chef de Projet', 1); + Index: tables/llx_c_type_contact.sql =================================================================== RCS file: tables/llx_c_type_contact.sql diff -N tables/llx_c_type_contact.sql --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tables/llx_c_type_contact.sql 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,44 @@ +-- ======================================================================== +-- Copyright (C) 2005 Patrick Rouillon +-- Copyright (C) 2005 Laurent Destailleur +-- +-- $Id: $ +-- $Source: $ +-- +-- 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. +-- +-- Defini les types de contact d'un element sert de reference pour +-- la table llx_element_contact +-- +-- element est le nom de la table utilisant le type de contact. +-- i.e. contact, facture, projet, societe (sans le llx_ devant). +-- Libelle est un texte décrivant le type de contact. +-- active précide si cette valeur est active ou 'archivé'. +-- +-- ======================================================================== + +create table llx_c_type_contact +( + rowid integer PRIMARY KEY, + element varchar(30) NOT NULL, + libelle varchar(30) NOT NULL, + active tinyint DEFAULT 1 NOT NULL +)type=innodb; + + +ALTER TABLE llx_c_type_contact + ADD UNIQUE INDEX idx_c_type_contact_uk (element, libelle); + + Index: tables/llx_element_contact.key.sql =================================================================== RCS file: tables/llx_element_contact.key.sql diff -N tables/llx_element_contact.key.sql --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tables/llx_element_contact.key.sql 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,36 @@ +-- ============================================================================ +-- Copyright (C) 2005 patrick Rouillon +-- +-- 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: $ +-- $Source: $ +-- +-- ============================================================================ + + +ALTER TABLE llx_element_contact + ADD INDEX idx_element_contact_idx1 (fk_element_contact, elementId); + +ALTER TABLE llx_element_contact + ADD CONSTRAINT idx_contrat_contact_fk_c_type_contact + FOREIGN KEY (fk_c_type_contact) REFERENCES llx_c_type_contact(id); + +-- Au cas ou ce serait necessaire. +-- Abuser des foreign key et parfois plus genant que utile. +-- ALTER TABLE llx_element_contact +-- ADD CONSTRAINT idx_contrat_contact_fk_socpeople +-- FOREIGN KEY (fk_socpeople) REFERENCES llx_socpeople(idp); + Index: tables/llx_element_contact.sql =================================================================== RCS file: tables/llx_element_contact.sql diff -N tables/llx_element_contact.sql --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tables/llx_element_contact.sql 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,38 @@ +-- ============================================================================ +-- Copyright (C) 2005 patrick Rouillon +-- +-- 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: $ +-- $Source: $ +-- +-- Association de personnes/societes avec un element de la base (contrat, projet, propal). +-- Permet de definir plusieur type d'intervenant sur un element. +-- i.e. commercial, adresse de facturation, prestataire... +-- ============================================================================ + +create table llx_element_contact +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + datecreate datetime NULL, -- date de creation de l'enregistrement + statut smallint DEFAULT 5, -- 5 inactif, 4 actif + + fk_c_type_contact int NOT NULL, -- nature du contact. + element_id int NOT NULL, -- la reference de l'element. + -- pour connaitre la table associée a ce contact regarder fk_element_contact->element + + fk_socpeople integer NOT NULL +)type=innodb; +