New: Debut de l'integration du dev pour la gestion des liens contacts-elements.
This commit is contained in:
parent
beb1b42e0f
commit
604b1b2f7a
@ -50,7 +50,7 @@ $active = 1;
|
||||
// Mettre ici tous les caractéristiques des dictionnaires
|
||||
|
||||
// Ordres d'affichage des dictionnaires (0 pour espace)
|
||||
$taborder=array(4,3,2,0,9,0,1,8,0,5,0,6,0,7,0,10);
|
||||
$taborder=array(4,3,2,0,9,0,1,8,0,5,11, 0,6,0,7,0,10);
|
||||
|
||||
// Nom des tables des dictionnaires
|
||||
$tabname[1] = MAIN_DB_PREFIX."c_forme_juridique";
|
||||
@ -63,6 +63,7 @@ $tabname[7] = MAIN_DB_PREFIX."c_chargesociales";
|
||||
$tabname[8] = MAIN_DB_PREFIX."c_typent";
|
||||
$tabname[9] = MAIN_DB_PREFIX."c_currencies";
|
||||
$tabname[10]= MAIN_DB_PREFIX."c_tva";
|
||||
$tabname[11]= MAIN_DB_PREFIX."c_type_contact";
|
||||
|
||||
// Libellé des dictionnaires
|
||||
$tablib[1] = $langs->trans("DictionnaryCompanyJuridicalType");
|
||||
@ -75,18 +76,20 @@ $tablib[7] = $langs->trans("DictionnarySocialContributions");
|
||||
$tablib[8] = $langs->trans("DictionnaryCompanyType");
|
||||
$tablib[9] = $langs->trans("DictionnaryCurrency");
|
||||
$tablib[10]= $langs->trans("DictionnaryVAT");
|
||||
$tablib[11]= $langs->trans("DictionnaryTypeContact");
|
||||
|
||||
// Requete pour extraction des données des dictionnaires
|
||||
$tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, p.libelle as pays, f.active FROM llx_c_forme_juridique as f, llx_c_pays as p WHERE f.fk_pays=p.rowid";
|
||||
$tabsql[2] = "SELECT d.rowid as rowid, d.code_departement as code , d.nom as libelle, r.nom as region, p.libelle as pays, d.active FROM llx_c_departements as d, llx_c_regions as r, llx_c_pays as p WHERE d.fk_region=r.code_region and r.fk_pays=p.rowid and r.active=1 and p.active=1";
|
||||
$tabsql[3] = "SELECT r.rowid as rowid, code_region as code , nom as libelle, p.libelle as pays, r.active FROM llx_c_regions as r, llx_c_pays as p WHERE r.fk_pays=p.rowid and p.active=1";
|
||||
$tabsql[4] = "SELECT rowid as rowid, code, libelle, active FROM llx_c_pays";
|
||||
$tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.civilite AS libelle, c.active FROM llx_c_civilite AS c";
|
||||
$tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active FROM llx_c_actioncomm AS a";
|
||||
$tabsql[7] = "SELECT a.id as rowid, a.id as code, a.libelle AS libelle, a.deductible, a.active FROM llx_c_chargesociales AS a";
|
||||
$tabsql[8] = "SELECT id as rowid, code, libelle, active FROM llx_c_typent";
|
||||
$tabsql[9] = "SELECT code as rowid, code, code_iso, label as libelle, active FROM llx_c_currencies";
|
||||
$tabsql[10]= "SELECT t.rowid, t.taux, p.libelle as pays, t.recuperableonly, t.note, t.active FROM llx_c_tva as t, llx_c_pays as p WHERE t.fk_pays=p.rowid";
|
||||
$tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, p.libelle as pays, f.active FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_pays as p WHERE f.fk_pays=p.rowid";
|
||||
$tabsql[2] = "SELECT d.rowid as rowid, d.code_departement as code , d.nom as libelle, r.nom as region, p.libelle as pays, d.active FROM ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_pays as p WHERE d.fk_region=r.code_region and r.fk_pays=p.rowid and r.active=1 and p.active=1";
|
||||
$tabsql[3] = "SELECT r.rowid as rowid, code_region as code , nom as libelle, p.libelle as pays, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_pays as p WHERE r.fk_pays=p.rowid and p.active=1";
|
||||
$tabsql[4] = "SELECT rowid as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_pays";
|
||||
$tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.civilite AS libelle, c.active FROM ".MAIN_DB_PREFIX."c_civilite AS c";
|
||||
$tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active FROM ".MAIN_DB_PREFIX."c_actioncomm AS a";
|
||||
$tabsql[7] = "SELECT a.id as rowid, a.id as code, a.libelle AS libelle, a.deductible, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a";
|
||||
$tabsql[8] = "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_typent";
|
||||
$tabsql[9] = "SELECT code as rowid, code, code_iso, label as libelle, active FROM ".MAIN_DB_PREFIX."c_currencies";
|
||||
$tabsql[10]= "SELECT t.rowid, t.taux, p.libelle as pays, t.recuperableonly, t.note, t.active FROM ".MAIN_DB_PREFIX."c_tva as t, llx_c_pays as p WHERE t.fk_pays=p.rowid";
|
||||
$tabsql[11]= "SELECT t.rowid as rowid, code, element, libelle, active FROM ".MAIN_DB_PREFIX."c_type_contact AS t";
|
||||
|
||||
// Tri par defaut
|
||||
$tabsqlsort[1] ="pays, code ASC";
|
||||
@ -99,6 +102,7 @@ $tabsqlsort[7] ="a.libelle ASC";
|
||||
$tabsqlsort[8] ="libelle ASC";
|
||||
$tabsqlsort[9] ="code ASC";
|
||||
$tabsqlsort[10]="pays ASC, taux ASC, recuperableonly ASC";
|
||||
$tabsqlsort[11]="element ASC, code ASC, libelle ASC";
|
||||
|
||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||
$tabfield[1] = "code,libelle,pays";
|
||||
@ -111,6 +115,7 @@ $tabfield[7] = "libelle,deductible";
|
||||
$tabfield[8] = "code,libelle";
|
||||
$tabfield[9] = "code,code_iso,libelle";
|
||||
$tabfield[10]= "pays,taux,recuperableonly,note";
|
||||
$tabfield[11]= "element,code,libelle";
|
||||
|
||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||
$tabfieldinsert[1] = "code,libelle,fk_pays";
|
||||
@ -123,6 +128,7 @@ $tabfieldinsert[7] = "libelle,deductible";
|
||||
$tabfieldinsert[8] = "code,libelle";
|
||||
$tabfieldinsert[9] = "code,code_iso,libelle";
|
||||
$tabfieldinsert[10]= "fk_pays,taux,recuperableonly,note";
|
||||
$tabfieldinsert[11]= "element,code,libelle";
|
||||
|
||||
// Nom du rowid si le champ n'est pas de type autoincrément
|
||||
$tabrowid[1] = "";
|
||||
@ -135,6 +141,7 @@ $tabrowid[7] = "id";
|
||||
$tabrowid[8] = "id";
|
||||
$tabrowid[9] = "code";
|
||||
$tabrowid[10]= "";
|
||||
$tabrowid[11]= "rowid";
|
||||
|
||||
|
||||
$msg='';
|
||||
@ -362,6 +369,19 @@ if ($_GET["id"])
|
||||
$html->select_lang(MAIN_LANG_DEFAULT,'lang');
|
||||
print '</td>';
|
||||
}
|
||||
// le type de l'element (pour les type de contact).'
|
||||
elseif ($fieldlist[$field] == 'element') {
|
||||
print '<td>';
|
||||
$elementList = array();
|
||||
// un peu crad mais je n'ai pas de meilleure idee.
|
||||
$elementList["contrat"] = "contrat";
|
||||
$elementList["projet"] = "projet";
|
||||
$elementList["propal"] = "propal";
|
||||
$elementList["facture"] = "facture";
|
||||
|
||||
$html->select_array('element', $elementList);
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'type') {
|
||||
print '<td>';
|
||||
print 'user<input type="hidden" name="type" value="user">';
|
||||
@ -422,9 +442,9 @@ if ($_GET["id"])
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var] class=\"value\">";
|
||||
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
$valuetoshow=$obj->$fieldlist[$field];
|
||||
|
||||
if ($valuetoshow=='all') {
|
||||
$valuetoshow=$langs->trans('All');
|
||||
}
|
||||
|
||||
@ -203,6 +203,7 @@ DictionnaryCivility=Civility title
|
||||
DictionnaryActions=Actions list
|
||||
DictionnarySocialContributions=Social contributions types
|
||||
DictionnaryVAT=VAT Rates
|
||||
DictionnaryTypeContact=Contacts types
|
||||
VATReceivedOnly=Special rate not billed
|
||||
VATManagement=VAT Management
|
||||
VATIsUsed=VAT is used
|
||||
|
||||
@ -203,6 +203,7 @@ DictionnaryCivility=Titres de civilit
|
||||
DictionnaryActions=Liste des actions
|
||||
DictionnarySocialContributions=Types de charges sociales
|
||||
DictionnaryVAT=Taux de TVA
|
||||
DictionnaryTypeContact=Types de contacts
|
||||
VATReceivedOnly=Taux special non facturé
|
||||
VATManagement=Gestion TVA
|
||||
VATIsUsed=Assujéti à TVA
|
||||
|
||||
@ -703,3 +703,20 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 7
|
||||
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, code, element, libelle, active ) values (10, 'BILLING', 'contrat', 'Contact facturation du contrat', 1);
|
||||
insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (11, 'SALESREPSIGN', 'contrat', 'Commercial signataire du contrat', 1);
|
||||
insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (12, 'SALESREPFOLL', 'contrat', 'Commercial suivi du contrat', 1);
|
||||
insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (13, 'CUSTOMER', 'contrat', 'Contact client pour le contrat', 1);
|
||||
|
||||
insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (20, 'BILLING', 'propale', 'Contact facturation de la propale', 1);
|
||||
insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (21, 'SALESREPSIGN', 'propale', 'Commercial signataire de la propale', 1);
|
||||
insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (22, 'SALESREPFOLL', 'propale', 'Commercial suivi de la propale', 1);
|
||||
insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (23, 'CUSTOMER', 'propale', 'Contact client pour la propale', 1);
|
||||
|
||||
insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (80, 'PROJECTLEADER', 'projet', 'Chef de Projet', 1);
|
||||
|
||||
|
||||
@ -1771,27 +1771,6 @@ create table llx_projet_task_actors
|
||||
)type=innodb;
|
||||
|
||||
|
||||
|
||||
create table llx_contrat_contact
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
datecreate datetime,
|
||||
statut smallint DEFAULT 0,
|
||||
nature varchar(80),
|
||||
|
||||
fk_contrat integer NOT NULL,
|
||||
fk_socpeople integer NOT NULL
|
||||
|
||||
)type=innodb;
|
||||
|
||||
|
||||
ALTER TABLE llx_contrat_contact
|
||||
ADD INDEX idx_contrat_contact_fk_contrat (fk_contrat);
|
||||
|
||||
ALTER TABLE llx_contrat_contact
|
||||
ADD CONSTRAINT idx_contrat_contact_fk_contrat
|
||||
FOREIGN KEY (fk_contrat) REFERENCES llx_contrat(rowid);
|
||||
|
||||
create table llx_societe_perms
|
||||
(
|
||||
fk_soc integer,
|
||||
@ -1803,3 +1782,51 @@ create table llx_societe_perms
|
||||
UNIQUE INDEX(fk_soc, fk_user)
|
||||
)type=innodb;
|
||||
|
||||
|
||||
create table llx_c_type_contact
|
||||
(
|
||||
rowid integer PRIMARY KEY,
|
||||
code varchar(16) NOT NULL,
|
||||
element varchar(30) NOT NULL,
|
||||
libelle varchar(64) 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, code);
|
||||
|
||||
|
||||
create table llx_element_contact
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
datecreate datetime NULL,
|
||||
statut smallint DEFAULT 5,
|
||||
|
||||
fk_c_type_contact int NOT NULL,
|
||||
element_id int NOT NULL,
|
||||
|
||||
fk_socpeople integer NOT NULL
|
||||
)type=innodb;
|
||||
|
||||
|
||||
ALTER TABLE llx_element_contact
|
||||
ADD INDEX idx_element_contact_idx1 (element_id, fk_socpeople);
|
||||
|
||||
ALTER TABLE llx_element_contact
|
||||
ADD CONSTRAINT idx_element_contact_fk_c_type_contact
|
||||
FOREIGN KEY (fk_c_type_contact) REFERENCES llx_c_type_contact(rowid);
|
||||
|
||||
|
||||
insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (10, 'BILLING', 'contrat', 'Contact facturation du contrat', 1);
|
||||
insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (11, 'SALESREPSIGN', 'contrat', 'Commercial signataire du contrat', 1);
|
||||
insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (12, 'SALESREPFOLL', 'contrat', 'Commercial suivi du contrat', 1);
|
||||
insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (13, 'CUSTOMER', 'contrat', 'Contact client pour le contrat', 1);
|
||||
|
||||
insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (20, 'BILLING', 'propale', 'Contact facturation de la propale', 1);
|
||||
insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (21, 'SALESREPSIGN', 'propale', 'Commercial signataire de la propale', 1);
|
||||
insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (22, 'SALESREPFOLL', 'propale', 'Commercial suivi de la propale', 1);
|
||||
insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (23, 'CUSTOMER', 'propale', 'Contact client pour la propale', 1);
|
||||
|
||||
insert into llx_c_type_contact(rowid, code, element, libelle, active ) values (80, 'PROJECTLEADER', 'projet', 'Chef de Projet', 1);
|
||||
|
||||
|
||||
45
mysql/tables/llx_c_type_contact.sql
Normal file
45
mysql/tables/llx_c_type_contact.sql
Normal file
@ -0,0 +1,45 @@
|
||||
-- ========================================================================
|
||||
-- Copyright (C) 2005 Patrick Rouillon <patrick.rouillon.net>
|
||||
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
--
|
||||
-- $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,
|
||||
code varchar(16) NOT NULL,
|
||||
element varchar(30) NOT NULL,
|
||||
libelle varchar(64) 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, code);
|
||||
|
||||
@ -21,12 +21,16 @@
|
||||
-- ============================================================================
|
||||
|
||||
|
||||
ALTER TABLE llx_contrat_contact
|
||||
ADD INDEX idx_contrat_contact_fk_contrat (fk_contrat);
|
||||
ALTER TABLE llx_element_contact
|
||||
ADD INDEX idx_element_contact_idx1 (element_id, fk_socpeople);
|
||||
|
||||
ALTER TABLE llx_contrat_contact
|
||||
ADD CONSTRAINT idx_contrat_contact_fk_contrat
|
||||
FOREIGN KEY (fk_contrat) REFERENCES llx_contrat(rowid);
|
||||
|
||||
|
||||
ALTER TABLE llx_element_contact
|
||||
ADD CONSTRAINT idx_element_contact_fk_c_type_contact
|
||||
FOREIGN KEY (fk_c_type_contact) REFERENCES llx_c_type_contact(rowid);
|
||||
|
||||
-- Au cas ou ce serait necessaire.
|
||||
-- Abuser des foreign key et parfois plus genant que utile.
|
||||
-- ALTER TABLE llx_element_contact
|
||||
-- ADD CONSTRAINT idx_element_contact_fk_socpeople
|
||||
-- FOREIGN KEY (fk_socpeople) REFERENCES llx_socpeople(idp);
|
||||
|
||||
@ -18,20 +18,21 @@
|
||||
-- $Id$
|
||||
-- $Source$
|
||||
--
|
||||
-- Association de personnes/societes avec un contrat.
|
||||
-- Permet de definir plusieur type d'intervenant sur un contrat.
|
||||
-- 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_contrat_contact
|
||||
create table llx_element_contact
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
datecreate datetime, -- date de creation de l'enregistrement
|
||||
statut smallint DEFAULT 0, -- 5 inactif, 4 actif
|
||||
nature varchar(80), -- nature du contact.
|
||||
|
||||
fk_contrat integer NOT NULL,
|
||||
fk_socpeople integer NOT NULL
|
||||
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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user