From c5c0628ee86e12f8a7371c33720bf2c698c8c7a2 Mon Sep 17 00:00:00 2001 From: jpb Date: Tue, 11 Oct 2022 10:05:56 +0200 Subject: [PATCH 1/5] add short cicility --- htdocs/langs/en_US/dict.lang | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/langs/en_US/dict.lang b/htdocs/langs/en_US/dict.lang index 0524cf1ca18..9eaeb52f8f2 100644 --- a/htdocs/langs/en_US/dict.lang +++ b/htdocs/langs/en_US/dict.lang @@ -250,7 +250,9 @@ CountryMF=Saint Martin ##### Civilities ##### CivilityMME=Mrs. +CivilityMMEShort=CivilityMMEShort CivilityMR=Mr. +CivilityMRShort=CivilityMRShort CivilityMLE=Ms. CivilityMTRE=Master CivilityDR=Doctor From 82ca472245b551df5d05f35813cf8d78b7d9a494 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 18 Oct 2022 10:50:21 +0200 Subject: [PATCH 2/5] FIX: only modify hidden checkbox/multislected extrafields on update if they are provided in request --- htdocs/core/class/extrafields.class.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 384d4f1fba4..1fbadc2ee81 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2084,13 +2084,21 @@ class ExtraFields $enabled = 1; if (isset($this->attributes[$object->table_element]['list'][$key])) { - $enabled = dol_eval($this->attributes[$object->table_element]['list'][$key], 1); + $enabled = intval(dol_eval($this->attributes[$object->table_element]['list'][$key], 1)); } $perms = 1; if (isset($this->attributes[$object->table_element]['perms'][$key])) { $perms = dol_eval($this->attributes[$object->table_element]['perms'][$key], 1); } - if (empty($enabled)) { + if ( + empty($enabled) + || ( + $onlykey === '@GETPOSTISSET' + && in_array($this->attributes[$object->table_element]['type'][$key], array('boolean', 'chkbxlst')) + && in_array(abs($enabled), array(2, 5)) + && ! GETPOSTISSET('options_' . $key) // Update hidden checkboxes and multiselect only if they are provided + ) + ) { continue; } if (empty($perms)) { From 6050f607043d9b83462e4a5eea0f620c393879b7 Mon Sep 17 00:00:00 2001 From: jpb Date: Tue, 18 Oct 2022 11:36:17 +0200 Subject: [PATCH 3/5] add loadRoleMode on getlinearray --- htdocs/projet/class/project.class.php | 11 ++++++----- htdocs/projet/class/task.class.php | 23 ++++++++++++----------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index b127d3aa686..63b8d0077ee 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -838,7 +838,7 @@ class Project extends CommonObject } // Fetch tasks - $this->getLinesArray($user); + $this->getLinesArray($user, 0); // Delete tasks $ret = $this->deleteTasks($user); @@ -2204,14 +2204,15 @@ class Project extends CommonObject /** * Create an array of tasks of current project * - * @param User $user Object user we want project allowed to - * @return int >0 if OK, <0 if KO + * @param User $user Object user we want project allowed to + * @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action + * @return int >0 if OK, <0 if KO */ - public function getLinesArray($user) + public function getLinesArray($user, $loadRoleMode = 1) { require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; $taskstatic = new Task($this->db); - $this->lines = $taskstatic->getTasksArray(0, $user, $this->id, 0, 0); + $this->lines = $taskstatic->getTasksArray(0, $user, $this->id, 0, 0, '', '-1', '', 0, 0, array(), 0, array(), 0, $loadRoleMode); } } diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index cda8494682b..2663053b549 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -772,9 +772,10 @@ class Task extends CommonObject * @param array $extrafields Show additional column from project or task * @param int $includebilltime Calculate also the time to bill and billed * @param array $search_array_options Array of search + * @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action * @return array Array of tasks */ - public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array()) + public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array(), $loadRoleMode = 1) { global $conf, $hookmanager; @@ -925,18 +926,18 @@ class Task extends CommonObject $error = 0; $obj = $this->db->fetch_object($resql); - - if ((!$obj->public) && (is_object($userp))) { // If not public project and we ask a filter on project owned by a user - if (!$this->getUserRolesForProjectsOrTasks($userp, 0, $obj->projectid, 0)) { - $error++; + if ($loadRoleMode) { + if ((!$obj->public) && (is_object($userp))) { // If not public project and we ask a filter on project owned by a user + if (!$this->getUserRolesForProjectsOrTasks($userp, 0, $obj->projectid, 0)) { + $error++; + } + } + if (is_object($usert)) { // If we ask a filter on a user affected to a task + if (!$this->getUserRolesForProjectsOrTasks(0, $usert, $obj->projectid, $obj->taskid)) { + $error++; + } } } - if (is_object($usert)) { // If we ask a filter on a user affected to a task - if (!$this->getUserRolesForProjectsOrTasks(0, $usert, $obj->projectid, $obj->taskid)) { - $error++; - } - } - if (!$error) { $tasks[$i] = new Task($this->db); $tasks[$i]->id = $obj->taskid; From 71bae4f94b42d6099d50ceafd4e837e7c583d7f9 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 18 Oct 2022 09:43:55 +0000 Subject: [PATCH 4/5] Fixing style errors. --- htdocs/projet/class/project.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 63b8d0077ee..2e6bdd8cec0 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -2208,7 +2208,7 @@ class Project extends CommonObject * @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action * @return int >0 if OK, <0 if KO */ - public function getLinesArray($user, $loadRoleMode = 1) + public function getLinesArray($user, $loadRoleMode = 1) { require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; $taskstatic = new Task($this->db); From 87339de68da4232024d8cc090b75cf6597be8468 Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 19 Oct 2022 09:29:11 +0200 Subject: [PATCH 5/5] add human readeable trad --- htdocs/langs/en_US/dict.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/dict.lang b/htdocs/langs/en_US/dict.lang index 9eaeb52f8f2..00ab5a05f24 100644 --- a/htdocs/langs/en_US/dict.lang +++ b/htdocs/langs/en_US/dict.lang @@ -250,9 +250,9 @@ CountryMF=Saint Martin ##### Civilities ##### CivilityMME=Mrs. -CivilityMMEShort=CivilityMMEShort +CivilityMMEShort=Mrs. CivilityMR=Mr. -CivilityMRShort=CivilityMRShort +CivilityMRShort=Mr. CivilityMLE=Ms. CivilityMTRE=Master CivilityDR=Doctor