Fix missing auto increment key. Fix error duplicate of type of contact.

This commit is contained in:
Laurent Destailleur 2022-07-29 16:03:21 +02:00
parent 7de18b9f79
commit 51d022914b
4 changed files with 79 additions and 58 deletions

View File

@ -2375,7 +2375,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
print '<td>'; print '<td>';
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'lang'); print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'lang');
print '</td>'; print '</td>';
} elseif (in_array($value, array('element', 'source'))) { //Example: the type and source of the element (for contact types) } elseif (in_array($value, array('element', 'source'))) { // Example: the type and source of the element (for contact types)
print '<td>'; print '<td>';
print $form->selectarray($value, $elementList, (!empty($obj->{$value}) ? $obj->{$value}:'')); print $form->selectarray($value, $elementList, (!empty($obj->{$value}) ? $obj->{$value}:''));
print '</td>'; print '</td>';

View File

@ -32,88 +32,89 @@
-- --
-- The types of contact of an element -- The types of contact of an element
-- Les types de contact d'un element --
-- The unique key is set on (element, source, code)
-- --
-- Contract / Contrat -- Contract / Contrat
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (10, 'contrat', 'internal', 'SALESREPSIGN', 'Commercial signataire du contrat', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('contrat', 'internal', 'SALESREPSIGN', 'Commercial signataire du contrat', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (11, 'contrat', 'internal', 'SALESREPFOLL', 'Commercial suivi du contrat', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('contrat', 'internal', 'SALESREPFOLL', 'Commercial suivi du contrat', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (20, 'contrat', 'external', 'BILLING', 'Contact client facturation contrat', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('contrat', 'external', 'BILLING', 'Contact client facturation contrat', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (21, 'contrat', 'external', 'CUSTOMER', 'Contact client suivi contrat', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('contrat', 'external', 'CUSTOMER', 'Contact client suivi contrat', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (22, 'contrat', 'external', 'SALESREPSIGN', 'Contact client signataire contrat', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('contrat', 'external', 'SALESREPSIGN', 'Contact client signataire contrat', 1);
-- Proposal / Propal -- Proposal / Propal
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (31, 'propal', 'internal', 'SALESREPFOLL', 'Commercial à l''origine de la propale', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('propal', 'internal', 'SALESREPFOLL', 'Commercial à l''origine de la propale', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (40, 'propal', 'external', 'BILLING', 'Contact client facturation propale', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('propal', 'external', 'BILLING', 'Contact client facturation propale', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (41, 'propal', 'external', 'CUSTOMER', 'Contact client suivi propale', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('propal', 'external', 'CUSTOMER', 'Contact client suivi propale', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (42, 'propal', 'external', 'SHIPPING', 'Contact client livraison propale', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('propal', 'external', 'SHIPPING', 'Contact client livraison propale', 1);
-- Customer Invoice / Facture -- Customer Invoice / Facture
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (50, 'facture', 'internal', 'SALESREPFOLL', 'Responsable suivi du paiement', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('facture', 'internal', 'SALESREPFOLL', 'Responsable suivi du paiement', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (60, 'facture', 'external', 'BILLING', 'Contact client facturation', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('facture', 'external', 'BILLING', 'Contact client facturation', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (61, 'facture', 'external', 'SHIPPING', 'Contact client livraison', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('facture', 'external', 'SHIPPING', 'Contact client livraison', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (62, 'facture', 'external', 'SERVICE', 'Contact client prestation', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('facture', 'external', 'SERVICE', 'Contact client prestation', 1);
-- Supplier Invoice -- Supplier Invoice
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (70, 'invoice_supplier', 'internal', 'SALESREPFOLL', 'Responsable suivi du paiement', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('invoice_supplier', 'internal', 'SALESREPFOLL', 'Responsable suivi du paiement', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (71, 'invoice_supplier', 'external', 'BILLING', 'Contact fournisseur facturation', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('invoice_supplier', 'external', 'BILLING', 'Contact fournisseur facturation', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (72, 'invoice_supplier', 'external', 'SHIPPING', 'Contact fournisseur livraison', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('invoice_supplier', 'external', 'SHIPPING', 'Contact fournisseur livraison', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (73, 'invoice_supplier', 'external', 'SERVICE', 'Contact fournisseur prestation', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('invoice_supplier', 'external', 'SERVICE', 'Contact fournisseur prestation', 1);
-- Agenda -- Agenda
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (80, 'agenda', 'internal', 'ACTOR', 'Responsable', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('agenda', 'internal', 'ACTOR', 'Responsable', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (81, 'agenda', 'internal', 'GUEST', 'Guest', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('agenda', 'internal', 'GUEST', 'Guest', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (85, 'agenda', 'external', 'ACTOR', 'Responsable', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('agenda', 'external', 'ACTOR', 'Responsable', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (86, 'agenda', 'external', 'GUEST', 'Guest', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('agenda', 'external', 'GUEST', 'Guest', 1);
-- Customer Order / Commande -- Customer Order / Commande
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (91, 'commande', 'internal', 'SALESREPFOLL', 'Responsable suivi de la commande', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('commande', 'internal', 'SALESREPFOLL', 'Responsable suivi de la commande', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (100,'commande', 'external', 'BILLING', 'Contact client facturation commande', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('commande', 'external', 'BILLING', 'Contact client facturation commande', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (101,'commande', 'external', 'CUSTOMER', 'Contact client suivi commande', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('commande', 'external', 'CUSTOMER', 'Contact client suivi commande', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (102,'commande', 'external', 'SHIPPING', 'Contact client livraison commande', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('commande', 'external', 'SHIPPING', 'Contact client livraison commande', 1);
-- Intervention / Fichinter -- Intervention / Fichinter
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (120, 'fichinter', 'internal', 'INTERREPFOLL', 'Responsable suivi de l''intervention', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('fichinter', 'internal', 'INTERREPFOLL', 'Responsable suivi de l''intervention', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (121, 'fichinter', 'internal', 'INTERVENING', 'Intervenant', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('fichinter', 'internal', 'INTERVENING', 'Intervenant', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (130, 'fichinter', 'external', 'BILLING', 'Contact client facturation intervention', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('fichinter', 'external', 'BILLING', 'Contact client facturation intervention', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (131, 'fichinter', 'external', 'CUSTOMER', 'Contact client suivi de l''intervention', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('fichinter', 'external', 'CUSTOMER', 'Contact client suivi de l''intervention', 1);
-- Supplier Order -- Supplier Order
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (140, 'order_supplier', 'internal', 'SALESREPFOLL', 'Responsable suivi de la commande', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('order_supplier', 'internal', 'SALESREPFOLL', 'Responsable suivi de la commande', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (141, 'order_supplier', 'internal', 'SHIPPING', 'Responsable réception de la commande', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('order_supplier', 'internal', 'SHIPPING', 'Responsable réception de la commande', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (142, 'order_supplier', 'external', 'BILLING', 'Contact fournisseur facturation commande', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('order_supplier', 'external', 'BILLING', 'Contact fournisseur facturation commande', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (143, 'order_supplier', 'external', 'CUSTOMER', 'Contact fournisseur suivi commande', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('order_supplier', 'external', 'CUSTOMER', 'Contact fournisseur suivi commande', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (145, 'order_supplier', 'external', 'SHIPPING', 'Contact fournisseur livraison commande', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('order_supplier', 'external', 'SHIPPING', 'Contact fournisseur livraison commande', 1);
-- Resource -- Resource
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (150, 'dolresource', 'internal', 'USERINCHARGE', 'In charge of resource', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('dolresource', 'internal', 'USERINCHARGE', 'In charge of resource', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (151, 'dolresource', 'external', 'THIRDINCHARGE', 'In charge of resource', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('dolresource', 'external', 'THIRDINCHARGE', 'In charge of resource', 1);
-- Tickets -- Tickets
insert into llx_c_type_contact (rowid, element, source, code, libelle, active, module) values (155, 'ticket', 'internal', 'SUPPORTTEC', 'Utilisateur contact support', 1, NULL); insert into llx_c_type_contact (element, source, code, libelle, active, module) values ('ticket', 'internal', 'SUPPORTTEC', 'Utilisateur contact support', 1, NULL);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active, module) values (156, 'ticket', 'internal', 'CONTRIBUTOR', 'Intervenant', 1, NULL); insert into llx_c_type_contact (element, source, code, libelle, active, module) values ('ticket', 'internal', 'CONTRIBUTOR', 'Intervenant', 1, NULL);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active, module) values (157, 'ticket', 'external', 'SUPPORTCLI', 'Contact client suivi incident', 1, NULL); insert into llx_c_type_contact (element, source, code, libelle, active, module) values ('ticket', 'external', 'SUPPORTCLI', 'Contact client suivi incident', 1, NULL);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active, module) values (158, 'ticket', 'external', 'CONTRIBUTOR', 'Intervenant', 1, NULL); insert into llx_c_type_contact (element, source, code, libelle, active, module) values ('ticket', 'external', 'CONTRIBUTOR', 'Intervenant', 1, NULL);
-- Projects / Projet - All project code can start with 'PROJECT' -- Projects / Projet - All project code can start with 'PROJECT'
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (160, 'project', 'internal', 'PROJECTLEADER', 'Chef de Projet', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('project', 'internal', 'PROJECTLEADER', 'Chef de Projet', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (161, 'project', 'internal', 'PROJECTCONTRIBUTOR', 'Intervenant', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('project', 'internal', 'PROJECTCONTRIBUTOR', 'Intervenant', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (170, 'project', 'external', 'PROJECTLEADER', 'Chef de Projet', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('project', 'external', 'PROJECTLEADER', 'Chef de Projet', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (171, 'project', 'external', 'PROJECTCONTRIBUTOR', 'Intervenant', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('project', 'external', 'PROJECTCONTRIBUTOR', 'Intervenant', 1);
-- Project Tasks - All task code can start with 'TASK' -- Project Tasks - All task code can start with 'TASK'
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (180, 'project_task', 'internal', 'TASKEXECUTIVE', 'Responsable', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('project_task', 'internal', 'TASKEXECUTIVE', 'Responsable', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (181, 'project_task', 'internal', 'TASKCONTRIBUTOR', 'Intervenant', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('project_task', 'internal', 'TASKCONTRIBUTOR', 'Intervenant', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (190, 'project_task', 'external', 'TASKEXECUTIVE', 'Responsable', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('project_task', 'external', 'TASKEXECUTIVE', 'Responsable', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (191, 'project_task', 'external', 'TASKCONTRIBUTOR', 'Intervenant', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('project_task', 'external', 'TASKCONTRIBUTOR', 'Intervenant', 1);
-- Supplier proposal -- Supplier proposal
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (110, 'supplier_proposal', 'internal', 'SALESREPFOLL', 'Responsable suivi de la demande', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('supplier_proposal', 'internal', 'SALESREPFOLL', 'Responsable suivi de la demande', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (111, 'supplier_proposal', 'external', 'BILLING', 'Contact fournisseur facturation', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('supplier_proposal', 'external', 'BILLING', 'Contact fournisseur facturation', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (112, 'supplier_proposal', 'external', 'SHIPPING', 'Contact fournisseur livraison', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('supplier_proposal', 'external', 'SHIPPING', 'Contact fournisseur livraison', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (113, 'supplier_proposal', 'external', 'SERVICE', 'Contact fournisseur prestation', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('supplier_proposal', 'external', 'SERVICE', 'Contact fournisseur prestation', 1);
-- Event Organization -- Event Organization
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (210, 'conferenceorbooth', 'internal', 'MANAGER', 'Conference or Booth manager', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('conferenceorbooth', 'internal', 'MANAGER', 'Conference or Booth manager', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (211, 'conferenceorbooth', 'external', 'SPEAKER', 'Conference Speaker', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('conferenceorbooth', 'external', 'SPEAKER', 'Conference Speaker', 1);
insert into llx_c_type_contact (rowid, element, source, code, libelle, active ) values (212, 'conferenceorbooth', 'external', 'RESPONSIBLE', 'Booth responsible', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('conferenceorbooth', 'external', 'RESPONSIBLE', 'Booth responsible', 1);

View File

@ -135,8 +135,28 @@ ALTER TABLE llx_partnership ADD UNIQUE INDEX uk_fk_type_fk_member (fk_type, fk_m
ALTER TABLE llx_bank ADD COLUMN amount_main_currency double(24,8) NULL; ALTER TABLE llx_bank ADD COLUMN amount_main_currency double(24,8) NULL;
-- v16 -- v16
ALTER TABLE llx_element_contact DROP FOREIGN KEY fk_element_contact_fk_c_type_contact;
ALTER TABLE llx_societe_contacts DROP FOREIGN KEY fk_societe_contacts_fk_c_type_contact;
--VMYSQL4.3 ALTER TABLE llx_c_type_contact ADD PRIMARY KEY(rowid);
--VMYSQL4.3 ALTER TABLE llx_c_type_contact CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
--VPGSQL8.2 CREATE SEQUENCE llx_c_type_contact_rowid_seq OWNED BY llx_c_type_contact.rowid;
--VPGSQL8.2 ALTER TABLE llx_c_type_contact ADD PRIMARY KEY (rowid);
--VPGSQL8.2 ALTER TABLE llx_c_type_contact ALTER COLUMN rowid SET DEFAULT nextval('llx_c_type_contact_rowid_seq');
--VPGSQL8.2 SELECT setval('llx_c_type_contact_rowid_seq', MAX(rowid)) FROM llx_c_type_contact;
insert into llx_c_type_contact(element, source, code, libelle, active ) values ('conferenceorbooth', 'internal', 'MANAGER', 'Conference or Booth manager', 1);
insert into llx_c_type_contact(element, source, code, libelle, active ) values ('conferenceorbooth', 'external', 'SPEAKER', 'Conference Speaker', 1);
insert into llx_c_type_contact(element, source, code, libelle, active ) values ('conferenceorbooth', 'external', 'RESPONSIBLE', 'Booth responsible', 1);
ALTER TABLE llx_element_contact ADD CONSTRAINT fk_element_contact_fk_c_type_contact FOREIGN KEY (fk_c_type_contact) REFERENCES llx_c_type_contact(rowid);
ALTER TABLE llx_societe_contacts ADD CONSTRAINT fk_societe_contacts_fk_c_type_contact FOREIGN KEY (fk_c_type_contact) REFERENCES llx_c_type_contact(rowid);
DROP TABLE llx_payment_salary_extrafields; DROP TABLE llx_payment_salary_extrafields;
DROP TABLE llx_asset_model_extrafields; DROP TABLE llx_asset_model_extrafields;
DROP TABLE llx_asset_type_extrafields; DROP TABLE llx_asset_type_extrafields;

View File

@ -29,7 +29,7 @@
create table llx_c_type_contact create table llx_c_type_contact
( (
rowid integer PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
element varchar(30) NOT NULL, element varchar(30) NOT NULL,
source varchar(8) DEFAULT 'external' NOT NULL, source varchar(8) DEFAULT 'external' NOT NULL,
code varchar(32) NOT NULL, code varchar(32) NOT NULL,