From 150e9f5a6fa636bc2670f779be2fa812c902335c Mon Sep 17 00:00:00 2001 From: Can Arslan <138895927+mc2rcanarslan@users.noreply.github.com> Date: Sat, 11 May 2024 12:45:09 -0600 Subject: [PATCH 1/7] FIX: Ternary operator condition is always true/false (#29649) --- htdocs/comm/action/card.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 1dfd9dff3cb..81b84d89de0 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -772,11 +772,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' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), $tzforfullday ? $tzforfullday : 'tzuserrel'); - $datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), $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' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuserrel'); - $datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), '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 From f5200ad2d9c962615e8eb52202a974d3fc1f5cd3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 May 2024 01:31:01 +0200 Subject: [PATCH 2/7] Fix changelog --- ChangeLog | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9f275d641ad..40bbc2ed275 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2226,7 +2226,7 @@ FIX: Button text on proposal card for create a invoice FIX: calculateCosts of BOM must not be included into fetch FIX: calculation of balance in conciliation page on desc sorting. FIX: card.php -FIX: Change date format of the inventorycode to be equal as mass stock transfert +FIX: Change date format of the inventorycode to be equal as mass stock transfer FIX: check if greater 0 FIX: close cash with some terminals in TakePOS FIX: compatibility with Multicompany @@ -7008,7 +7008,7 @@ FIX: #6253 Supplier invoice list filter does not respect "thirdparty" filter FIX: #6277 FIX: project list and ajax completion return wrong list. FIX: bug margin calculation by user with multicompany -FIX: Can make a stock transfert on product not on sale/purchase. +FIX: Can make a stock transfer on product not on sale/purchase. FIX: extrafield input for varchar was not working with special char within (ie double quotes) FIX: javascript error FIX: link for not found photo when using gravatar. Must use external url. @@ -7488,7 +7488,7 @@ FIX: Check of EAN13 barcode when mask was set to use 13 digits instead of 12 FIX: correct display of minimum buying price FIX: Creation of thumb image for size "small" was not done. FIX: Damn, where was the project ref ? -FIX: Default vat is not set correctly when an error occured and we use VAT identified by a code. +FIX: Default vat is not set correctly when an error occurred and we use VAT identified by a code. FIX: dont retrieve new buying price on margin display FIX: Duplicate records into export FIX: Each time we edit a line, we loose the unit price. @@ -10247,7 +10247,7 @@ For developers: - Can protect a module to not being enabled if javascript disabled. - If module numberwords is installed, code can use langs->getLabelFromNumber to get value of an amount in text. -- A module can add subsitution keys in makesubsitutions() functions. +- A module can add substitution keys in makesubsitutions() functions. - Add $conf->browser->phone defined to optimise code for smartphone browsers. - All external libs are now in same directory /includes. - All install files are now in same directory /install. From 2dd939d2dbb3bc56ca76c5792e213af1b1b1ec0a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 May 2024 02:46:31 +0200 Subject: [PATCH 3/7] Fix dump --- dev/initdemo/mysqldump_dolibarr_19.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/initdemo/mysqldump_dolibarr_19.0.0.sql b/dev/initdemo/mysqldump_dolibarr_19.0.0.sql index 83d4645572a..1c3b3457fb0 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, From 1e2e9a087573dfc0f59528ec541bc83e4324aead Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 May 2024 03:00:31 +0200 Subject: [PATCH 4/7] Doc --- htdocs/install/mysql/tables/llx_c_type_contact.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, From c8c0fe5a20eb6a8627cbd34d4cec75c4cff46511 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 May 2024 03:18:30 +0200 Subject: [PATCH 5/7] Doc --- htdocs/install/mysql/tables/llx_element_contact.sql | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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; From a6caef2dcff724d0f12d392510c170522aa4ba29 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Mon, 13 May 2024 03:25:05 +0200 Subject: [PATCH 6/7] NEW : Add default User roles for Thirdparties (#29242) * firstStepBDD * revert bad changes * add new column for user roles in societe_commerciaux table * merge * Update 19.0.0-20.0.0.sql --------- Co-authored-by: Laurent Destailleur --- htdocs/install/mysql/data/llx_c_type_contact.sql | 9 ++++++--- htdocs/install/mysql/migration/19.0.0-20.0.0.sql | 12 ++++++++++++ .../mysql/tables/llx_societe_commerciaux.key.sql | 5 ++++- .../install/mysql/tables/llx_societe_commerciaux.sql | 2 +- 4 files changed, 23 insertions(+), 5 deletions(-) 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_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; - From a8423b45b37585edd621befcfe181ea5ef60cc8c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 May 2024 03:53:24 +0200 Subject: [PATCH 7/7] CSS --- htdocs/core/tpl/contacts.tpl.php | 8 ++++---- htdocs/theme/eldy/global.inc.php | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) 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/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; }