From 9c0cf32ef7dbe94f639c7688cf447cc5ce3e8161 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Thu, 28 Jul 2022 11:56:07 +0200 Subject: [PATCH 1/4] FIX - php V8 user right actioncomm class --- htdocs/comm/action/class/actioncomm.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 68e358f18eb..9a7114a6113 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1558,13 +1558,13 @@ class ActionComm extends CommonObject } $canread = 0; - if ($user->rights->agenda->myactions->read && $this->authorid == $user->id) { + if (!empty($user->rights->agenda->myactions->read) && $this->authorid == $user->id) { $canread = 1; // Can read my event } - if ($user->rights->agenda->myactions->read && array_key_exists($user->id, $this->userassigned)) { + if (!empty($user->rights->agenda->myactions->read) && array_key_exists($user->id, $this->userassigned)) { $canread = 1; // Can read my event i am assigned } - if ($user->rights->agenda->allactions->read) { + if (!empty($user->rights->agenda->allactions->read)) { $canread = 1; // Can read all event of other } if (!$canread) { From 7301ef6bfa1e40d263e647be63526ed364b7c9d8 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Thu, 28 Jul 2022 14:55:42 +0200 Subject: [PATCH 2/4] FIX - strlower to email --- htdocs/contact/class/contact.class.php | 2 +- htdocs/societe/class/societe.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 9fa3602ee4b..9957174dcc3 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -563,7 +563,7 @@ class Contact extends CommonObject $this->ref_ext = trim($this->ref_ext); $this->lastname = trim($this->lastname) ?trim($this->lastname) : trim($this->lastname); $this->firstname = trim($this->firstname); - $this->email = trim($this->email); + $this->email = dol_strtolower(trim($this->email)); $this->phone_pro = trim($this->phone_pro); $this->phone_perso = trim($this->phone_perso); $this->phone_mobile = trim($this->phone_mobile); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 90766323080..2279aa90cdb 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1279,7 +1279,7 @@ class Societe extends CommonObject $this->fax = trim($this->fax); $this->fax = preg_replace("/\s/", "", $this->fax); $this->fax = preg_replace("/\./", "", $this->fax); - $this->email = trim($this->email); + $this->email = dol_strtolower(trim($this->email)); $this->url = $this->url ?clean_url($this->url, 0) : ''; $this->note_private = trim($this->note_private); $this->note_public = trim($this->note_public); From cfc9819e49496ef2c4297f857650de34ec0f3910 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Thu, 28 Jul 2022 15:13:13 +0200 Subject: [PATCH 3/4] FIX - strlower for email --- htdocs/adherents/class/adherent.class.php | 3 +-- htdocs/contact/class/contact.class.php | 4 ++-- htdocs/core/class/commonobject.class.php | 2 ++ htdocs/societe/class/societe.class.php | 5 ++--- htdocs/user/class/user.class.php | 3 ++- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index c860a19d588..dec7584b68e 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -670,11 +670,10 @@ class Adherent extends CommonObject $this->town = ($this->town ? $this->town : $this->town); $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id); $this->state_id = ($this->state_id > 0 ? $this->state_id : $this->state_id); - $this->setUpperOrLowerCase(); $this->note_public = ($this->note_public ? $this->note_public : $this->note_public); $this->note_private = ($this->note_private ? $this->note_private : $this->note_private); $this->url = $this->url ?clean_url($this->url, 0) : ''; - + $this->setUpperOrLowerCase(); // Check parameters if (!empty($conf->global->ADHERENT_MAIL_REQUIRED) && !isValidEMail($this->email)) { $langs->load("errors"); diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 9957174dcc3..799b53cdad0 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -563,7 +563,7 @@ class Contact extends CommonObject $this->ref_ext = trim($this->ref_ext); $this->lastname = trim($this->lastname) ?trim($this->lastname) : trim($this->lastname); $this->firstname = trim($this->firstname); - $this->email = dol_strtolower(trim($this->email)); + $this->email = trim($this->email); $this->phone_pro = trim($this->phone_pro); $this->phone_perso = trim($this->phone_perso); $this->phone_mobile = trim($this->phone_mobile); @@ -571,7 +571,6 @@ class Contact extends CommonObject $this->fax = trim($this->fax); $this->zip = (empty($this->zip) ? '' : trim($this->zip)); $this->town = (empty($this->town) ? '' : trim($this->town)); - $this->setUpperOrLowerCase(); $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id); if (empty($this->statut)) { $this->statut = 0; @@ -579,6 +578,7 @@ class Contact extends CommonObject if (empty($this->civility_code) && !is_numeric($this->civility_id)) { $this->civility_code = $this->civility_id; // For backward compatibility } + $this->setUpperOrLowerCase(); $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET"; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 01665e99ca5..f3c49ae1f75 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -759,6 +759,8 @@ abstract class CommonObject $this->address = dol_strtoupper($this->address); $this->town = dol_strtoupper($this->town); } + $this->email = dol_strtolower($this->email); + $this->personal_email = dol_strtolower($this->personal_email); } /** diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 2279aa90cdb..a65b49d4bb2 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1270,7 +1270,6 @@ class Societe extends CommonObject $this->address = $this->address ?trim($this->address) : trim($this->address); $this->zip = $this->zip ?trim($this->zip) : trim($this->zip); $this->town = $this->town ?trim($this->town) : trim($this->town); - $this->setUpperOrLowerCase(); $this->state_id = trim($this->state_id); $this->country_id = ($this->country_id > 0) ? $this->country_id : 0; $this->phone = trim($this->phone); @@ -1279,7 +1278,7 @@ class Societe extends CommonObject $this->fax = trim($this->fax); $this->fax = preg_replace("/\s/", "", $this->fax); $this->fax = preg_replace("/\./", "", $this->fax); - $this->email = dol_strtolower(trim($this->email)); + $this->email = trim($this->email); $this->url = $this->url ?clean_url($this->url, 0) : ''; $this->note_private = trim($this->note_private); $this->note_public = trim($this->note_public); @@ -1412,7 +1411,7 @@ class Societe extends CommonObject } } } - + $this->setUpperOrLowerCase(); if ($result >= 0) { dol_syslog(get_class($this)."::update verify ok or not done"); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index fcd1505a402..6fca728ee8b 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1864,7 +1864,6 @@ class User extends CommonObject $this->address = trim((string) $this->address); $this->zip = trim((string) $this->zip); $this->town = trim((string) $this->town); - $this->setUpperOrLowerCase(); $this->state_id = ($this->state_id > 0 ? $this->state_id : 0); $this->country_id = ($this->country_id > 0 ? $this->country_id : 0); @@ -1891,6 +1890,8 @@ class User extends CommonObject $this->birth = empty($this->birth) ? '' : $this->birth; $this->fk_warehouse = (int) $this->fk_warehouse; + $this->setUpperOrLowerCase(); + // Check parameters $badCharUnauthorizedIntoLoginName = getDolGlobalString('MAIN_LOGIN_BADCHARUNAUTHORIZED', ',@<>"\''); From df727f3b5dd79ac7c3766be7bebe200ddad7add1 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Thu, 28 Jul 2022 17:22:21 +0200 Subject: [PATCH 4/4] FIX - Add colone last_main_doc in societe for migration Error to generate doc --- htdocs/install/mysql/migration/16.0.0-17.0.0.sql | 1 + htdocs/societe/class/societe.class.php | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index 6713d410fc6..24b4e20a7b7 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -62,4 +62,5 @@ ALTER TABLE llx_inventory ADD COLUMN categories_product VARCHAR(255) DEFAULT NUL ALTER TABLE llx_ticket ADD COLUMN ip varchar(250); +ALTER TABLE llx_societe ADD last_main_doc VARCHAR(255) NULL AFTER model_pdf; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 90766323080..a3f3c45806f 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -232,6 +232,7 @@ class Societe extends CommonObject 'fk_incoterms' =>array('type'=>'integer', 'label'=>'Fk incoterms', 'enabled'=>1, 'visible'=>-1, 'position'=>425), 'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'Location incoterms', 'enabled'=>1, 'visible'=>-1, 'position'=>430), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>435), + 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>270), 'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>-1, 'position'=>440), 'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Multicurrency code', 'enabled'=>1, 'visible'=>-1, 'position'=>445), 'fk_account' =>array('type'=>'integer', 'label'=>'AccountingAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>450),