diff --git a/dev/initdemo/mysqldump_dolibarr_19.0.0.sql b/dev/initdemo/mysqldump_dolibarr_19.0.0.sql
index 78a4358879e..536991aa19d 100644
--- a/dev/initdemo/mysqldump_dolibarr_19.0.0.sql
+++ b/dev/initdemo/mysqldump_dolibarr_19.0.0.sql
@@ -2999,7 +2999,7 @@ DROP TABLE IF EXISTS `llx_c_type_contact`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `llx_c_type_contact` (
- `rowid` int(11) NOT NULL,
+ `rowid` int(11) NOT NULL AUTO_INCREMENT,
`element` varchar(30) NOT NULL,
`source` varchar(8) NOT NULL DEFAULT 'external',
`code` varchar(32) NOT NULL,
diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 3a9356a495a..7f3882d5874 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -770,11 +770,11 @@ if (empty($reshook) && $action == 'update') {
if ($fulldayevent) {
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
// For "full day" events, we must store date in GMT (It must be viewed as same moment everywhere)
- $datep = dol_mktime($fulldayevent ? '00' : GETPOSTINT("aphour"), $fulldayevent ? '00' : GETPOSTINT("apmin"), $fulldayevent ? '00' : GETPOSTINT("apsec"), GETPOSTINT("apmonth"), GETPOSTINT("apday"), GETPOSTINT("apyear"), $tzforfullday ? $tzforfullday : 'tzuserrel');
- $datef = dol_mktime($fulldayevent ? '23' : GETPOSTINT("p2hour"), $fulldayevent ? '59' : GETPOSTINT("p2min"), $fulldayevent ? '59' : GETPOSTINT("apsec"), GETPOSTINT("p2month"), GETPOSTINT("p2day"), GETPOSTINT("p2year"), $tzforfullday ? $tzforfullday : 'tzuserrel');
+ $datep = dol_mktime('00', '00', '00', GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), $tzforfullday ? $tzforfullday : 'tzuserrel');
+ $datef = dol_mktime('23', '59', '59', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), $tzforfullday ? $tzforfullday : 'tzuserrel');
} else {
- $datep = dol_mktime($fulldayevent ? '00' : GETPOSTINT("aphour"), $fulldayevent ? '00' : GETPOSTINT("apmin"), $fulldayevent ? '00' : GETPOSTINT("apsec"), GETPOSTINT("apmonth"), GETPOSTINT("apday"), GETPOSTINT("apyear"), 'tzuserrel');
- $datef = dol_mktime($fulldayevent ? '23' : GETPOSTINT("p2hour"), $fulldayevent ? '59' : GETPOSTINT("p2min"), $fulldayevent ? '59' : GETPOSTINT("apsec"), GETPOSTINT("p2month"), GETPOSTINT("p2day"), GETPOSTINT("p2year"), 'tzuserrel');
+ $datep = dol_mktime(GETPOST("aphour", 'int'), GETPOST("apmin", 'int'), GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuserrel');
+ $datef = dol_mktime(GETPOST("p2hour", 'int'), GETPOST("p2min", 'int'), GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuserrel');
}
if ($object->elementtype == 'ticket') { // code should be TICKET_MSG, TICKET_MSG_PRIVATE, TICKET_MSG_SENTBYMAIL, TICKET_MSG_PRIVATE_SENTBYMAIL
diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php
index af82ebebdd2..f806f409147 100644
--- a/htdocs/core/tpl/contacts.tpl.php
+++ b/htdocs/core/tpl/contacts.tpl.php
@@ -111,7 +111,7 @@ if ($permission) {
print '';
} ?>
-
global->MAIN_INFO_SOCIETE_NOM; ?>
+
select_dolusers($user->id, 'userid', 1, (!empty($userAlreadySelected) ? $userAlreadySelected : null), 0, null, null, 0, 56, 0, '', 0, '', 'minwidth100imp widthcentpercentminusxx maxwidth400 userselectcontact');
@@ -141,7 +141,7 @@ if ($permission) {
if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) {
$tmpobject = $objectsrc;
}
- $formcompany->selectTypeContact($tmpobject, '', 'type', 'internal', 'position', 0, 'minwidth125imp widthcentpercentminusx maxwidth400'); ?>
+ $formcompany->selectTypeContact($tmpobject, '', 'type', 'internal', 'position', 0, 'minwidth150imp widthcentpercentminusx maxwidth400'); ?>
">
@@ -164,7 +164,7 @@ if ($permission) {
socid) ? 0 : $object->socid);
- $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0, '', 'minwidth300imp'); // This also print the select component?>
+ $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0, '', 'minwidth300imp maxwidth400 widthcentpercentminusx'); // This also print the select component?>
element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) {
$tmpobject = $objectsrc;
}
- $formcompany->selectTypeContact($tmpobject, $preselectedtypeofcontact, 'typecontact', 'external', 'position', 0, 'minwidth125imp widthcentpercentminusx maxwidth400'); ?>
+ $formcompany->selectTypeContact($tmpobject, $preselectedtypeofcontact, 'typecontact', 'external', 'position', 0, 'minwidth150imp widthcentpercentminusx maxwidth400'); ?>
diff --git a/htdocs/install/mysql/data/llx_c_type_contact.sql b/htdocs/install/mysql/data/llx_c_type_contact.sql
index 5852e295c6b..07178dacdcd 100644
--- a/htdocs/install/mysql/data/llx_c_type_contact.sql
+++ b/htdocs/install/mysql/data/llx_c_type_contact.sql
@@ -24,7 +24,7 @@
-- Notes
--
-- Do not place a comment at the end of the line, this file is parsed when
--- of the install and all the acronyms '-' are removed.
+-- of the install and all the acronyms '-' are removed.
--
-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors
-- de l'install et tous les sigles '--' sont supprimés.
@@ -33,10 +33,10 @@
--
-- The types of contact of an element
--
--- The unique key is set on (element, source, code)
+-- The unique key is set on (element, source, code)
--
--- Contract / Contrat
+-- Contract / Contrat
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 (element, source, code, libelle, active ) values ('contrat', 'internal', 'SALESREPFOLL', 'Commercial suivi du contrat', 1);
insert into llx_c_type_contact (element, source, code, libelle, active ) values ('contrat', 'external', 'BILLING', 'Contact client facturation contrat', 1);
@@ -118,3 +118,6 @@ insert into llx_c_type_contact (element, source, code, libelle, active ) values
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);
+
+-- Thirdparty
+insert into llx_c_type_contact (element, source, code, libelle, active ) values ('societe', 'internal', 'SALESREPTHIRD', 'Sales Representative', 1);
diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql
index a4fe00e64df..f35af7a0bdb 100644
--- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql
+++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql
@@ -321,6 +321,18 @@ ALTER TABLE llx_rights_def ADD COLUMN enabled text NULL AFTER bydefault;
DELETE FROM llx_c_action_trigger WHERE code = 'BILLREC_AUTOCREATEBILL';
+insert into llx_c_type_contact (element, source, code, libelle, active) values ('thirdparty', 'internal', 'SALESREPTHIRD', 'Sales Representative', 1);
+
+ALTER TABLE llx_societe_commerciaux ADD COLUMN fk_c_type_contact_code varchar(32) NOT NULL DEFAULT 'SALESREPTHIRD';
+
+-- VMYSQL4.1 DROP INDEX uk_societe_commerciaux ON llx_societe_commerciaux;
+-- VPGSQL8.2 DROP INDEX uk_societe_commerciaux;
+ALTER TABLE llx_societe_commerciaux ADD UNIQUE INDEX uk_societe_commerciaux_c_type_contact (fk_soc, fk_user, fk_c_type_contact_code);
+ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_c_type_contact_code FOREIGN KEY (fk_c_type_contact_code) REFERENCES llx_c_type_contact(code);
+ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid);
+ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_user FOREIGN KEY (fk_user) REFERENCES llx_user(rowid);
+
+
-- element_element, see https://github.com/Dolibarr/dolibarr/pull/29329
ALTER TABLE llx_element_element ADD COLUMN relationtype varchar(64) DEFAULT NULL AFTER targettype;
diff --git a/htdocs/install/mysql/tables/llx_c_type_contact.sql b/htdocs/install/mysql/tables/llx_c_type_contact.sql
index 65ddb592ce0..2b309be4445 100644
--- a/htdocs/install/mysql/tables/llx_c_type_contact.sql
+++ b/htdocs/install/mysql/tables/llx_c_type_contact.sql
@@ -31,7 +31,7 @@ create table llx_c_type_contact
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
element varchar(64) NOT NULL,
- source varchar(8) DEFAULT 'external' NOT NULL,
+ source varchar(8) DEFAULT 'external' NOT NULL, -- 'internal' (for link object-user) or 'external' (for link object-third party)
code varchar(32) NOT NULL,
libelle varchar(128) NOT NULL,
active tinyint DEFAULT 1 NOT NULL,
diff --git a/htdocs/install/mysql/tables/llx_element_contact.sql b/htdocs/install/mysql/tables/llx_element_contact.sql
index 1b368be3f5a..78075f0f842 100644
--- a/htdocs/install/mysql/tables/llx_element_contact.sql
+++ b/htdocs/install/mysql/tables/llx_element_contact.sql
@@ -20,12 +20,11 @@
create table llx_element_contact
(
- rowid integer AUTO_INCREMENT PRIMARY KEY,
- datecreate datetime NULL, -- date de creation de l'enregistrement
+ rowid integer AUTO_INCREMENT PRIMARY KEY,
+ datecreate datetime NULL, -- date of creation of record
statut smallint DEFAULT 5, -- 5 inactif, 4 actif
-
- element_id int NOT NULL, -- la reference de l'element.
- fk_c_type_contact int NOT NULL, -- nature du contact.
- fk_socpeople integer NOT NULL
-)ENGINE=innodb;
+ element_id int NOT NULL, -- ID of element.
+ fk_c_type_contact int NOT NULL, -- nature of contact.
+ fk_socpeople integer NOT NULL -- ID of contact
+)ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_societe_commerciaux.key.sql b/htdocs/install/mysql/tables/llx_societe_commerciaux.key.sql
index 300857fffc5..1672ff659c1 100644
--- a/htdocs/install/mysql/tables/llx_societe_commerciaux.key.sql
+++ b/htdocs/install/mysql/tables/llx_societe_commerciaux.key.sql
@@ -16,4 +16,7 @@
--
-- ===================================================================
-ALTER TABLE llx_societe_commerciaux ADD UNIQUE INDEX uk_societe_commerciaux (fk_soc, fk_user);
+ALTER TABLE llx_societe_commerciaux ADD UNIQUE INDEX uk_societe_commerciaux_c_type_contact (fk_soc, fk_user, fk_c_type_contact_code);
+ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_c_type_contact_code FOREIGN KEY (fk_c_type_contact_code) REFERENCES llx_c_type_contact(code);
+ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid);
+ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_user FOREIGN KEY (fk_user) REFERENCES llx_user(rowid);
diff --git a/htdocs/install/mysql/tables/llx_societe_commerciaux.sql b/htdocs/install/mysql/tables/llx_societe_commerciaux.sql
index d8f58825239..39537ef62db 100644
--- a/htdocs/install/mysql/tables/llx_societe_commerciaux.sql
+++ b/htdocs/install/mysql/tables/llx_societe_commerciaux.sql
@@ -22,6 +22,6 @@ create table llx_societe_commerciaux
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_soc integer,
fk_user integer,
+ fk_c_type_contact_code varchar(32) NOT NULL DEFAULT 'SALESREPTHIRD',
import_key varchar(14)
)ENGINE=innodb;
-
diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php
index 697a9ddd260..139d404877b 100644
--- a/htdocs/theme/eldy/global.inc.php
+++ b/htdocs/theme/eldy/global.inc.php
@@ -1781,6 +1781,7 @@ maxscreenheightless200 {
.minwidth50imp { min-width: 50px !important; }
.minwidth75imp { min-width: 75px !important; }
.minwidth100imp { min-width: 100px !important; }
+ .minwidth150imp { min-width: 150px !important; }
.minwidth200imp { min-width: 200px !important; }
.minwidth250imp { min-width: 250px !important; }
.minwidth300imp { min-width: 300px !important; }