Merge pull request #9920 from ATM-Marc/FIX_6.0_task_activity_access

FIX: task time screen: bad task assignments
This commit is contained in:
Laurent Destailleur 2018-11-05 10:21:28 +01:00 committed by GitHub
commit 693cf72fca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 17 deletions

View File

@ -305,12 +305,18 @@ class FormProjets
* @param int $forcefocus Force focus on field (works with javascript only) * @param int $forcefocus Force focus on field (works with javascript only)
* @param int $disabled Disabled * @param int $disabled Disabled
* @param string $morecss More css added to the select component * @param string $morecss More css added to the select component
* @param User $usertofilter User object to use for filtering
* @return int Nbr of project if OK, <0 if KO * @return int Nbr of project if OK, <0 if KO
*/ */
function selectTasks($socid=-1, $selected='', $htmlname='taskid', $maxlength=24, $option_only=0, $show_empty='1', $discard_closed=0, $forcefocus=0, $disabled=0, $morecss='maxwidth500') function selectTasks($socid=-1, $selected='', $htmlname='taskid', $maxlength=24, $option_only=0, $show_empty='1', $discard_closed=0, $forcefocus=0, $disabled=0, $morecss='maxwidth500', $usertofilter=null)
{ {
global $user,$conf,$langs; global $user,$conf,$langs;
if(is_null($usertofilter))
{
$usertofilter = $user;
}
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$out=''; $out='';
@ -319,10 +325,10 @@ class FormProjets
if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true; if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true;
$projectsListId = false; $projectsListId = false;
if (empty($user->rights->projet->all->lire)) if (empty($usertofilter->rights->projet->all->lire))
{ {
$projectstatic=new Project($this->db); $projectstatic=new Project($this->db);
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1); $projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertofilter,0,1);
} }
// Search all projects // Search all projects
@ -367,7 +373,7 @@ class FormProjets
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
// If we ask to filter on a company and user has no permission to see all companies and project is linked to another company, we hide project. // If we ask to filter on a company and user has no permission to see all companies and project is linked to another company, we hide project.
if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && empty($user->rights->societe->lire)) if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && empty($usertofilter->rights->societe->lire))
{ {
// Do nothing // Do nothing
} }

View File

@ -399,7 +399,7 @@ print '<div class="float valignmiddle">';
$titleassigntask = $langs->trans("AssignTaskToMe"); $titleassigntask = $langs->trans("AssignTaskToMe");
if ($usertoprocess->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", $usertoprocess->getFullName($langs)); if ($usertoprocess->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", $usertoprocess->getFullName($langs));
print '<div class="taskiddiv inline-block">'; print '<div class="taskiddiv inline-block">';
$formproject->selectTasks($socid?$socid:-1, $taskid, 'taskid', 32, 0, 1, 1); $formproject->selectTasks($socid?$socid:-1, $taskid, 'taskid', 32, 0, 1, 1, 0, 0, '', $usertoprocess);
print '</div>'; print '</div>';
print ' '; print ' ';
print $formcompany->selectTypeContact($object, '', 'type','internal','rowid', 0, 'maxwidth200'); print $formcompany->selectTypeContact($object, '', 'type','internal','rowid', 0, 'maxwidth200');

View File

@ -402,7 +402,7 @@ print '<div class="float valignmiddle">';
$titleassigntask = $langs->trans("AssignTaskToMe"); $titleassigntask = $langs->trans("AssignTaskToMe");
if ($usertoprocess->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", $usertoprocess->getFullName($langs)); if ($usertoprocess->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", $usertoprocess->getFullName($langs));
print '<div class="taskiddiv inline-block">'; print '<div class="taskiddiv inline-block">';
$formproject->selectTasks($socid?$socid:-1, $taskid, 'taskid', 32, 0, 1, 1); $formproject->selectTasks($socid?$socid:-1, $taskid, 'taskid', 32, 0, 1, 1, 0, 0, '', $usertoprocess);
print '</div>'; print '</div>';
print ' '; print ' ';
print $formcompany->selectTypeContact($object, '', 'type','internal','rowid', 0, 'maxwidth200'); print $formcompany->selectTypeContact($object, '', 'type','internal','rowid', 0, 'maxwidth200');