Skip to content

Commit

Permalink
Merge branch '6.0' of git@github.com:Dolibarr/dolibarr.git into 7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Nov 5, 2018
2 parents e1e0001 + 693cf72 commit 56a70ab
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
36 changes: 21 additions & 15 deletions htdocs/core/class/html.formprojet.class.php
Expand Up @@ -294,22 +294,28 @@ function select_projects_list($socid=-1, $selected='', $htmlname='projectid', $m
/**
* Output a combo list with projects qualified for a third party
*
* @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
* @param int $selected Id task preselected
* @param string $htmlname Name of HTML select
* @param int $maxlength Maximum length of label
* @param int $option_only Return only html options lines without the select tag
* @param string $show_empty Add an empty line ('1' or string to show for empty line)
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
* @param int $forcefocus Force focus on field (works with javascript only)
* @param int $disabled Disabled
* @param string $morecss More css added to the select component
* @return int Nbr of project if OK, <0 if KO
* @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
* @param int $selected Id task preselected
* @param string $htmlname Name of HTML select
* @param int $maxlength Maximum length of label
* @param int $option_only Return only html options lines without the select tag
* @param string $show_empty Add an empty line ('1' or string to show for empty line)
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
* @param int $forcefocus Force focus on field (works with javascript only)
* @param int $disabled Disabled
* @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
*/
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;

if(is_null($usertofilter))
{
$usertofilter = $user;
}

require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';

$out='';
Expand All @@ -318,10 +324,10 @@ function selectTasks($socid=-1, $selected='', $htmlname='taskid', $maxlength=24,
if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true;

$projectsListId = false;
if (empty($user->rights->projet->all->lire))
if (empty($usertofilter->rights->projet->all->lire))
{
$projectstatic=new Project($this->db);
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1);
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertofilter,0,1);
}

// Search all projects
Expand Down Expand Up @@ -366,7 +372,7 @@ function selectTasks($socid=-1, $selected='', $htmlname='taskid', $maxlength=24,
{
$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 ($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
}
Expand Down
2 changes: 1 addition & 1 deletion htdocs/projet/activity/perday.php
Expand Up @@ -408,7 +408,7 @@
$titleassigntask = $langs->transnoentities("AssignTaskToMe");
if ($usertoprocess->id != $user->id) $titleassigntask = $langs->transnoentities("AssignTaskToUser", $usertoprocess->getFullName($langs));
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 ' ';
print $formcompany->selectTypeContact($object, '', 'type','internal','rowid', 0, 'maxwidth200');
Expand Down
2 changes: 1 addition & 1 deletion htdocs/projet/activity/perweek.php
Expand Up @@ -408,7 +408,7 @@
$titleassigntask = $langs->transnoentities("AssignTaskToMe");
if ($usertoprocess->id != $user->id) $titleassigntask = $langs->transnoentities("AssignTaskToUser", $usertoprocess->getFullName($langs));
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 ' ';
print $formcompany->selectTypeContact($object, '', 'type','internal','rowid', 0, 'maxwidth200');
Expand Down

0 comments on commit 56a70ab

Please sign in to comment.