This commit is contained in:
Laurent Destailleur 2022-10-29 12:46:22 +02:00
commit c67f94ca4b
4 changed files with 28 additions and 15 deletions

View File

@ -1967,14 +1967,21 @@ class ExtraFields
$visibility = 1; $visibility = 1;
if (isset($this->attributes[$object->table_element]['list'][$key])) { // 'list' is option for visibility if (isset($this->attributes[$object->table_element]['list'][$key])) { // 'list' is option for visibility
$visibility = dol_eval($this->attributes[$object->table_element]['list'][$key], 1, 1, '1'); $visibility = intval(dol_eval($this->attributes[$object->table_element]['list'][$key], 1, 1, '1'));
} }
$perms = 1; $perms = 1;
if (isset($this->attributes[$object->table_element]['perms'][$key])) { if (isset($this->attributes[$object->table_element]['perms'][$key])) {
$perms = dol_eval($this->attributes[$object->table_element]['perms'][$key], 1, 1, '1'); $perms = dol_eval($this->attributes[$object->table_element]['perms'][$key], 1, 1, '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; continue;
} }
if (empty($visibility)) { if (empty($visibility)) {

View File

@ -250,7 +250,9 @@ CountryMF=Saint Martin
##### Civilities ##### ##### Civilities #####
CivilityMME=Mrs. CivilityMME=Mrs.
CivilityMMEShort=Mrs.
CivilityMR=Mr. CivilityMR=Mr.
CivilityMRShort=Mr.
CivilityMLE=Ms. CivilityMLE=Ms.
CivilityMTRE=Master CivilityMTRE=Master
CivilityDR=Doctor CivilityDR=Doctor

View File

@ -839,7 +839,7 @@ class Project extends CommonObject
} }
// Fetch tasks // Fetch tasks
$this->getLinesArray($user); $this->getLinesArray($user, 0);
// Delete tasks // Delete tasks
$ret = $this->deleteTasks($user); $ret = $this->deleteTasks($user);
@ -2211,13 +2211,14 @@ class Project extends CommonObject
* Create an array of tasks of current project * Create an array of tasks of current project
* *
* @param User $user Object user we want project allowed to * @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 * @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'; require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
$taskstatic = new Task($this->db); $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);
} }
} }

View File

@ -803,9 +803,10 @@ class Task extends CommonObjectLine
* @param int $includebilltime Calculate also the time to bill and billed * @param int $includebilltime Calculate also the time to bill and billed
* @param array $search_array_options Array of search * @param array $search_array_options Array of search
* @param int $loadextras Fetch all Extrafields on each task * @param int $loadextras Fetch all Extrafields on each task
* @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action
* @return array Array of tasks * @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(), $loadextras = 0) 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(), $loadextras = 0, $loadRoleMode = 1)
{ {
global $conf, $hookmanager; global $conf, $hookmanager;
@ -960,6 +961,7 @@ class Task extends CommonObjectLine
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
if ($loadRoleMode) {
if ((!$obj->public) && (is_object($userp))) { // If not public project and we ask a filter on project owned by a user 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)) { if (!$this->getUserRolesForProjectsOrTasks($userp, 0, $obj->projectid, 0)) {
$error++; $error++;
@ -970,6 +972,7 @@ class Task extends CommonObjectLine
$error++; $error++;
} }
} }
}
if (!$error) { if (!$error) {
$tasks[$i] = new Task($this->db); $tasks[$i] = new Task($this->db);