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;
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;
if (isset($this->attributes[$object->table_element]['perms'][$key])) {
$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;
}
if (empty($visibility)) {

View File

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

View File

@ -839,7 +839,7 @@ class Project extends CommonObject
}
// Fetch tasks
$this->getLinesArray($user);
$this->getLinesArray($user, 0);
// Delete tasks
$ret = $this->deleteTasks($user);
@ -2210,14 +2210,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);
}
}

View File

@ -803,9 +803,10 @@ class Task extends CommonObjectLine
* @param int $includebilltime Calculate also the time to bill and billed
* @param array $search_array_options Array of search
* @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
*/
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;
@ -960,14 +961,16 @@ class Task extends CommonObjectLine
$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++;
}
}
}