Debug visibility on task/projects
This commit is contained in:
parent
e6ebc9c293
commit
bcadc33e31
@ -104,7 +104,7 @@ class box_task extends ModeleBoxes
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => $objp->nb." ".$langs->trans("Tasks"),
|
||||
'url' => DOL_URL_ROOT."/projet/tasks/index.php?leftmenu=projects&viewstatut=".$objp->fk_statut,
|
||||
'url' => DOL_URL_ROOT."/projet/tasks/list.php?leftmenu=projects&viewstatut=".$objp->fk_statut,
|
||||
);
|
||||
$totalnb += $objp->nb;
|
||||
$this->info_box_contents[$i][] = array('td' => 'align="right"', 'text' => ConvertSecondToTime($objp->plannedtot,'all',25200,5));
|
||||
|
||||
@ -794,14 +794,14 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
$dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id];
|
||||
$alreadyspent='';
|
||||
if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin');
|
||||
$tableCell ='<td align="center">';
|
||||
$tableCell.='<span class="timesheetalreadyrecorded"><input type="text" class="center" size="2" disabled id="timespent['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="'.$alreadyspent.'"></span>';
|
||||
$tableCell ='<td align="center" class="hide'.$idw.'">';
|
||||
$tableCell.='<span class="timesheetalreadyrecorded"><input type="text" class="center smallpadd" size="2" disabled id="timespent['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="'.$alreadyspent.'"></span>';
|
||||
//$placeholder=' placeholder="00:00"';
|
||||
$placeholder='';
|
||||
//if (! $disabledtask)
|
||||
//{
|
||||
$tableCell.='+';
|
||||
$tableCell.='<input type="text" alt="'.$langs->trans("AddHereTimeSpentForDay",$tmparray['day'],$tmparray['mon']).'" title="'.$langs->trans("AddHereTimeSpentForDay",$tmparray['day'],$tmparray['mon']).'" '.($disabledtask?'disabled':$placeholder).' class="center" size="2" id="timeadded['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="" cols="2" maxlength="5"';
|
||||
$tableCell.='<input type="text" alt="'.$langs->trans("AddHereTimeSpentForDay",$tmparray['day'],$tmparray['mon']).'" title="'.$langs->trans("AddHereTimeSpentForDay",$tmparray['day'],$tmparray['mon']).'" '.($disabledtask?'disabled':$placeholder).' class="center smallpadd" size="2" id="timeadded['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="" cols="2" maxlength="5"';
|
||||
$tableCell.=' onkeypress="return regexEvent(this,event,\'timeChar\')"';
|
||||
$tableCell.= 'onblur="regexEvent(this,event,\''.$modeinput.'\'); updateTotal('.$idw.',\''.$modeinput.'\')" />';
|
||||
//}
|
||||
|
||||
@ -259,12 +259,12 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3700__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects', 'Activities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3701__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&action=create', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3702__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/index.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3702__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/list.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3703__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/activity/perweek.php?leftmenu=projects', 'NewTimeSpent', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__);
|
||||
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3800__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects&mode=mine', 'MyActivities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3801__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&action=create&mode=mine', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3802__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/tasks/index.php?leftmenu=projects&mode=mine', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3802__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/tasks/list.php?leftmenu=projects&mode=mine', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3803__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/activity/perweek.php?leftmenu=projects&mode=mine', 'NewTimeSpent', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__);
|
||||
-- Tools
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3900__+MAX_llx_menu__, 'tools', 'mailing', 8__+MAX_llx_menu__, '/comm/mailing/index.php?leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 0, __ENTITY__);
|
||||
|
||||
@ -1213,13 +1213,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
// Project affected to user
|
||||
$newmenu->add("/projet/activity/index.php?mode=mine", $langs->trans("MyActivities"), 0, $user->rights->projet->lire);
|
||||
$newmenu->add("/projet/tasks.php?action=create&mode=mine", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
|
||||
$newmenu->add("/projet/tasks/index.php?mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire);
|
||||
$newmenu->add("/projet/tasks/list.php?mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire);
|
||||
$newmenu->add("/projet/activity/perweek.php?mode=mine", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer);
|
||||
|
||||
// All project i have permission on
|
||||
$newmenu->add("/projet/activity/index.php", $langs->trans("Activities"), 0, $user->rights->projet->lire && $user->rights->projet->lire);
|
||||
$newmenu->add("/projet/tasks.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer && $user->rights->projet->creer);
|
||||
$newmenu->add("/projet/tasks/index.php", $langs->trans("List"), 1, $user->rights->projet->lire && $user->rights->projet->lire);
|
||||
$newmenu->add("/projet/tasks/list.php", $langs->trans("List"), 1, $user->rights->projet->lire && $user->rights->projet->lire);
|
||||
$newmenu->add("/projet/activity/perweek.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer && $user->rights->projet->creer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ if (GETPOST('search_project') != '')
|
||||
}
|
||||
if (GETPOST('search_task') != '')
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/projet/tasks/index.php?mode=search&search_all='.urlencode(GETPOST('search_task')));
|
||||
header("Location: ".DOL_URL_ROOT.'/projet/tasks/list.php?mode=search&search_all='.urlencode(GETPOST('search_task')));
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
@ -245,10 +245,10 @@ if ($id)
|
||||
$project->fetch_thirdparty();
|
||||
}
|
||||
|
||||
$onlyopened=1; // or -1
|
||||
$tasksarray=$taskstatic->getTasksArray(0,0,($project->id?$project->id:$projectsListId),$socid,0,'',$onlyopened); // We want to see all task of opened project i am allowed to see, not only mine. Later only mine will be editable later.
|
||||
$projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($usertoprocess,0,($project->id?$project->id:$projectsListId),0);
|
||||
$tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0,$usertoprocess,($project->id?$project->id:$projectsListId),0);
|
||||
$onlyopenedproject=1; // or -1
|
||||
$tasksarray=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, '', $onlyopenedproject); // We want to see all task of opened project i am allowed to see, not only mine. Later only mine will be editable later.
|
||||
$projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id?$project->id:0), 0, $onlyopenedproject);
|
||||
$tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id?$project->id:0), 0, $onlyopenedproject);
|
||||
//var_dump($tasksarray);
|
||||
//var_dump($projectsrole);
|
||||
//var_dump($taskrole);
|
||||
@ -284,11 +284,11 @@ $head=project_timesheet_prepare_head($mode);
|
||||
dol_fiche_head($head, 'inputperday', '', 0, 'task');
|
||||
|
||||
// Show description of content
|
||||
if ($mine) print $langs->trans("MyTasksDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'<br>';
|
||||
if ($mine) print $langs->trans("MyTasksDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>';
|
||||
else
|
||||
{
|
||||
if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'<br>';
|
||||
else print $langs->trans("ProjectsPublicTaskDesc").($onlyopened?' '.$langs->trans("AlsoOnlyOpenedProject"):'').'<br>';
|
||||
if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>';
|
||||
else print $langs->trans("ProjectsPublicTaskDesc").($onlyopenedproject?' '.$langs->trans("AlsoOnlyOpenedProject"):'').'<br>';
|
||||
}
|
||||
if ($mine)
|
||||
{
|
||||
|
||||
@ -215,19 +215,18 @@ $taskstatic = new Task($db);
|
||||
$title=$langs->trans("TimeSpent");
|
||||
if ($mine) $title=$langs->trans("MyTimeSpent");
|
||||
|
||||
//$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1);
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess,0,1); // Return all project i have permission on. I want my tasks and some of my task may be on a public projet that is not my project
|
||||
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess,0,1); // Return all project i have permission on (assigned to me+public). I want my tasks and some of my task may be on a public projet that is not my project
|
||||
//var_dump($projectsListId);
|
||||
if ($id)
|
||||
{
|
||||
$project->fetch($id);
|
||||
$project->fetch_thirdparty();
|
||||
}
|
||||
|
||||
$onlyopened=1; // or -1
|
||||
$tasksarray=$taskstatic->getTasksArray(0,0,($project->id?$project->id:$projectsListId),$socid,0,'',$onlyopened); // We want to see all task of opened project i am allowed to see, not only mine. Later only mine will be editable later.
|
||||
$projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($usertoprocess,0,($project->id?$project->id:$projectsListId),0);
|
||||
$tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0,$usertoprocess,($project->id?$project->id:$projectsListId),0);
|
||||
$onlyopenedproject=1; // or -1
|
||||
$tasksarray=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, '', $onlyopenedproject); // We want to see all task of opened project i am allowed to see, not only mine. Later only mine will be editable later.
|
||||
$projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id?$project->id:0), 0, $onlyopenedproject);
|
||||
$tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id?$project->id:0), 0, $onlyopenedproject);
|
||||
//var_dump($tasksarray);
|
||||
//var_dump($projectsrole);
|
||||
//var_dump($taskrole);
|
||||
@ -261,11 +260,11 @@ $head=project_timesheet_prepare_head($mode);
|
||||
dol_fiche_head($head, 'inputperweek', '', 0, 'task');
|
||||
|
||||
// Show description of content
|
||||
if ($mine) print $langs->trans("MyTasksDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'<br>';
|
||||
if ($mine) print $langs->trans("MyTasksDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>';
|
||||
else
|
||||
{
|
||||
if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'<br>';
|
||||
else print $langs->trans("ProjectsPublicTaskDesc").($onlyopened?' '.$langs->trans("AlsoOnlyOpenedProject"):'').'<br>';
|
||||
if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>';
|
||||
else print $langs->trans("ProjectsPublicTaskDesc").($onlyopenedproject?' '.$langs->trans("AlsoOnlyOpenedProject"):'').'<br>';
|
||||
}
|
||||
if ($mine)
|
||||
{
|
||||
@ -317,7 +316,7 @@ $startday=dol_mktime(12, 0, 0, $startdayarray['first_month'], $startdayarray['fi
|
||||
|
||||
for($i=0;$i<7;$i++)
|
||||
{
|
||||
print '<td width="7%" align="center">'.dol_print_date($startday + ($i * 3600 * 24), '%a').'<br>'.dol_print_date($startday + ($i * 3600 * 24), 'day').'</td>';
|
||||
print '<td width="7%" align="center" class="hide'.$i.'">'.dol_print_date($startday + ($i * 3600 * 24), '%a').'<br>'.dol_print_date($startday + ($i * 3600 * 24), 'day').'</td>';
|
||||
}
|
||||
print '<td class="liste_total"></td>';
|
||||
|
||||
@ -328,18 +327,22 @@ $restrictviewformytask=(empty($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED
|
||||
|
||||
if (count($tasksarray) > 0)
|
||||
{
|
||||
//var_dump($tasksarray);
|
||||
//var_dump($tasksrole);
|
||||
|
||||
$j=0;
|
||||
$level=0;
|
||||
projectLinesPerWeek($j, $firstdaytoshow, $usertoprocess, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask);
|
||||
|
||||
print '<tr class="liste_total">
|
||||
<td class="liste_total" colspan="7" align="right">'.$langs->trans("Total").'</td>
|
||||
<td class="liste_total" width="7%" align="center"><div id="totalDay[0]"> </div></td>
|
||||
<td class="liste_total" width="7%" align="center"><div id="totalDay[1]"> </div></td>
|
||||
<td class="liste_total" width="7%" align="center"><div id="totalDay[2]"> </div></td>
|
||||
<td class="liste_total" width="7%" align="center"><div id="totalDay[3]"> </div></td>
|
||||
<td class="liste_total" width="7%" align="center"><div id="totalDay[4]"> </div></td>
|
||||
<td class="liste_total" width="7%" align="center"><div id="totalDay[5]"> </div></td>
|
||||
<td class="liste_total" width="7%" align="center"><div id="totalDay[6]"> </div></td>
|
||||
<td class="liste_total hide0" width="7%" align="center"><div id="totalDay[0]"> </div></td>
|
||||
<td class="liste_total hide1" width="7%" align="center"><div id="totalDay[1]"> </div></td>
|
||||
<td class="liste_total hide2" width="7%" align="center"><div id="totalDay[2]"> </div></td>
|
||||
<td class="liste_total hide3" width="7%" align="center"><div id="totalDay[3]"> </div></td>
|
||||
<td class="liste_total hide4" width="7%" align="center"><div id="totalDay[4]"> </div></td>
|
||||
<td class="liste_total hide5" width="7%" align="center"><div id="totalDay[5]"> </div></td>
|
||||
<td class="liste_total hide6" width="7%" align="center"><div id="totalDay[6]"> </div></td>
|
||||
<td class="liste_total"></td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
@ -708,7 +708,7 @@ else
|
||||
// Define a complementary filter for search of next/prev ref.
|
||||
if (! $user->rights->projet->all->lire)
|
||||
{
|
||||
$objectsListId = $object->getProjectsAuthorizedForUser($user,$mine,0);
|
||||
$objectsListId = $object->getProjectsAuthorizedForUser($user,0,0);
|
||||
$object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
|
||||
}
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
|
||||
|
||||
@ -557,10 +557,10 @@ class Task extends CommonObject
|
||||
* @param string $filteronprojstatus Filter on project status
|
||||
* @param string $morewherefilter Add more filter into where SQL request
|
||||
* @param string $filteronprojuser Filter on user that is a contact of project
|
||||
* @param string $filterontaskuse Filter on user assigned to task
|
||||
* @param string $filterontaskuser Filter on user assigned to task
|
||||
* @return array Array of tasks
|
||||
*/
|
||||
function getTasksArray($usert=0, $userp=0, $projectid=0, $socid=0, $mode=0, $filteronprojref='', $filteronprojstatus=-1, $morewherefilter='',$filteronprojuser=0,$filterontaskuse=0)
|
||||
function getTasksArray($usert=0, $userp=0, $projectid=0, $socid=0, $mode=0, $filteronprojref='', $filteronprojstatus=-1, $morewherefilter='',$filteronprojuser=0,$filterontaskuser=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -587,11 +587,11 @@ class Task extends CommonObject
|
||||
}
|
||||
else return 'BadValueForParameterMode';
|
||||
|
||||
if ($filteronprojuser)
|
||||
if ($filteronprojuser > 0)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
if ($filterontaskuser)
|
||||
if ($filterontaskuser > 0)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
@ -665,15 +665,16 @@ class Task extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of roles for a user for each projects or each tasks (or a particular project or task).
|
||||
* Return list of roles for a user for each projects or each tasks (or a particular project or a particular task).
|
||||
*
|
||||
* @param User $userp Return roles on project for this internal user (task id can't be defined)
|
||||
* @param User $usert Return roles on task for this internal user
|
||||
* @param int $projectid Project id list separated with , to filter on project
|
||||
* @param int $taskid Task id to filter on a task
|
||||
* @return array Array (projectid => 'list of roles for project' or taskid => 'list of roles for task')
|
||||
* @param User $userp Return roles on project for this internal user. If set, usert and taskid must not be defined.
|
||||
* @param User $usert Return roles on task for this internal user. If set userp must not be defined.
|
||||
* @param int $projectid Project id list separated with , to filter on project
|
||||
* @param int $taskid Task id to filter on a task
|
||||
* @param string $filteronprojstatus Filter on project status if userp is set. Not used if userp not defined.
|
||||
* @return array Array (projectid => 'list of roles for project' or taskid => 'list of roles for task')
|
||||
*/
|
||||
function getUserRolesForProjectsOrTasks($userp,$usert,$projectid='',$taskid=0)
|
||||
function getUserRolesForProjectsOrTasks($userp, $usert, $projectid='', $taskid=0, $filteronprojstatus=-1)
|
||||
{
|
||||
$arrayroles = array();
|
||||
|
||||
@ -694,10 +695,12 @@ class Task extends CommonObject
|
||||
/* Liste des taches et role sur les projets ou taches */
|
||||
$sql = "SELECT pt.rowid as pid, ec.element_id, ctc.code, ctc.source";
|
||||
if ($userp) $sql.= " FROM ".MAIN_DB_PREFIX."projet as pt";
|
||||
if ($usert) $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt";
|
||||
if ($usert) $sql.= " FROM ".MAIN_DB_PREFIX."projet as p, ".MAIN_DB_PREFIX."projet_task as pt";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."element_contact as ec";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc";
|
||||
$sql.= " WHERE pt.rowid = ec.element_id";
|
||||
if ($userp && $filteronprojstatus > -1) $sql.= " AND pt.fk_statut = ".$filteronprojstatus;
|
||||
if ($usert && $filteronprojstatus > -1) $sql.= " AND pt.fk_projet = p.rowid AND p.fk_statut = ".$filteronprojstatus;
|
||||
if ($userp) $sql.= " AND ctc.element = 'project'";
|
||||
if ($usert) $sql.= " AND ctc.element = 'project_task'";
|
||||
$sql.= " AND ctc.rowid = ec.fk_c_type_contact";
|
||||
|
||||
@ -161,7 +161,7 @@ if ($id > 0 || ! empty($ref))
|
||||
// Define a complementary filter for search of next/prev ref.
|
||||
if (! $user->rights->projet->all->lire)
|
||||
{
|
||||
$objectsListId = $object->getProjectsAuthorizedForUser($user,$mine,0);
|
||||
$objectsListId = $object->getProjectsAuthorizedForUser($user,0,0);
|
||||
$object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
|
||||
}
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
|
||||
|
||||
@ -115,7 +115,7 @@ if ($object->id > 0)
|
||||
// Define a complementary filter for search of next/prev ref.
|
||||
if (! $user->rights->projet->all->lire)
|
||||
{
|
||||
$projectsListId = $object->getProjectsAuthorizedForUser($user,$mine,0);
|
||||
$projectsListId = $object->getProjectsAuthorizedForUser($user,0,0);
|
||||
$object->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")";
|
||||
}
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
|
||||
|
||||
@ -125,7 +125,7 @@ print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td>';
|
||||
// Define a complementary filter for search of next/prev ref.
|
||||
if (! $user->rights->projet->all->lire)
|
||||
{
|
||||
$projectsListId = $object->getProjectsAuthorizedForUser($user,$mine,0);
|
||||
$projectsListId = $object->getProjectsAuthorizedForUser($user,0,0);
|
||||
$object->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")";
|
||||
}
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
|
||||
|
||||
@ -109,7 +109,7 @@ if ($id > 0 || ! empty($ref))
|
||||
// Define a complementary filter for search of next/prev ref.
|
||||
if (! $user->rights->projet->all->lire)
|
||||
{
|
||||
$projectsListId = $object->getProjectsAuthorizedForUser($user,$mine,0);
|
||||
$projectsListId = $object->getProjectsAuthorizedForUser($user,0,0);
|
||||
$object->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")";
|
||||
}
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '', $param);
|
||||
|
||||
@ -60,8 +60,6 @@ $offset = $conf->liste_limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
$mine = $_REQUEST['mode']=='mine' ? 1 : 0;
|
||||
|
||||
$search_all=GETPOST("search_all");
|
||||
$search_ref=GETPOST("search_ref");
|
||||
$search_label=GETPOST("search_label");
|
||||
@ -75,6 +73,9 @@ $search_user=GETPOST('search_user','int');
|
||||
$search_sale=GETPOST('search_sale','int');
|
||||
$optioncss = GETPOST('optioncss','alpha');
|
||||
|
||||
$mine = $_REQUEST['mode']=='mine' ? 1 : 0;
|
||||
if ($mine) $search_user = $user->id;
|
||||
|
||||
$day = GETPOST('day','int');
|
||||
$month = GETPOST('month','int');
|
||||
$year = GETPOST('year','int');
|
||||
@ -306,7 +307,7 @@ if ($resql)
|
||||
if (empty($conf->global->PROJECT_LIST_HIDE_STARTDATE)) $colspan++;
|
||||
|
||||
|
||||
// If the user can view prospects other than his'
|
||||
// If the user can view thirdparties other than his'
|
||||
if ($user->rights->societe->client->voir || $socid)
|
||||
{
|
||||
$langs->load("commercial");
|
||||
|
||||
@ -88,7 +88,7 @@ if ($id > 0 || ! empty($ref))
|
||||
// Define a complementary filter for search of next/prev ref.
|
||||
if (! $user->rights->projet->all->lire)
|
||||
{
|
||||
$projectsListId = $object->getProjectsAuthorizedForUser($user,$mine,0);
|
||||
$projectsListId = $object->getProjectsAuthorizedForUser($user,0,0);
|
||||
$object->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")";
|
||||
}
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
|
||||
|
||||
@ -146,7 +146,7 @@ if ($action == 'createtask' && $user->rights->projet->creer)
|
||||
}
|
||||
else if (empty($projectid))
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/projet/tasks/index.php'.(empty($mode)?'':'?mode='.$mode));
|
||||
header("Location: ".DOL_URL_ROOT.'/projet/tasks/list.php'.(empty($mode)?'':'?mode='.$mode));
|
||||
exit;
|
||||
}
|
||||
$id = $projectid;
|
||||
@ -162,7 +162,7 @@ if ($action == 'createtask' && $user->rights->projet->creer)
|
||||
else if (empty($id))
|
||||
{
|
||||
// We go back on task list
|
||||
header("Location: ".DOL_URL_ROOT.'/projet/tasks/index.php'.(empty($mode)?'':'?mode='.$mode));
|
||||
header("Location: ".DOL_URL_ROOT.'/projet/tasks/list.php'.(empty($mode)?'':'?mode='.$mode));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@ -215,7 +215,7 @@ if ($id > 0 || ! empty($ref))
|
||||
// Define a complementary filter for search of next/prev ref.
|
||||
if (! $user->rights->projet->all->lire)
|
||||
{
|
||||
$projectsListId = $object->getProjectsAuthorizedForUser($user,$mine,0);
|
||||
$projectsListId = $object->getProjectsAuthorizedForUser($user,0,0);
|
||||
$object->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")";
|
||||
}
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '', $param);
|
||||
|
||||
@ -173,6 +173,8 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
if ($object->fetch($id, $ref) > 0)
|
||||
{
|
||||
$id = $object->id; // So when doing a search from ref, id is also set correctly.
|
||||
|
||||
$result=$projectstatic->fetch($object->fk_project);
|
||||
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
||||
|
||||
|
||||
@ -143,7 +143,7 @@ if ($object->id > 0)
|
||||
// Define a complementary filter for search of next/prev ref.
|
||||
if (! $user->rights->projet->all->lire)
|
||||
{
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,0);
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0);
|
||||
$projectstatic->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")";
|
||||
}
|
||||
print $form->showrefnav($projectstatic,'project_ref','',1,'ref','ref','',$param.'&withproject=1');
|
||||
@ -203,7 +203,7 @@ if ($object->id > 0)
|
||||
print '</td><td colspan="3">';
|
||||
if (empty($withproject) || empty($projectstatic->id))
|
||||
{
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1);
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1);
|
||||
$object->next_prev_filter=" fk_projet in (".$projectsListId.")";
|
||||
}
|
||||
else $object->next_prev_filter=" fk_projet = ".$projectstatic->id;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/projet/tasks/index.php
|
||||
* \file htdocs/projet/tasks/list.php
|
||||
* \ingroup project
|
||||
* \brief List all task of a project
|
||||
*/
|
||||
@ -43,6 +43,9 @@ $search_task_label=GETPOST('search_task_label');
|
||||
$search_project_user=GETPOST('search_project_user');
|
||||
$search_task_user=GETPOST('search_task_user');
|
||||
|
||||
$mine = $_REQUEST['mode']=='mine' ? 1 : 0;
|
||||
if ($mine) $search_task_user = $user->id;
|
||||
|
||||
// Security check
|
||||
$socid=0;
|
||||
if ($user->societe_id > 0) $socid = $user->societe_id;
|
||||
@ -54,8 +57,6 @@ $page = GETPOST("page");
|
||||
$page = is_numeric($page) ? $page : 0;
|
||||
$page = $page == -1 ? 0 : $page;
|
||||
|
||||
$mine = $_REQUEST['mode']=='mine' ? 1 : 0;
|
||||
|
||||
// Purge criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
@ -64,6 +65,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
$search_status="";
|
||||
$search_task_ref="";
|
||||
$search_task_label="";
|
||||
$search_task_user=-1;
|
||||
$search_project_user=-1;
|
||||
}
|
||||
if (empty($search_status) && $search_status == '') $search_status=1;
|
||||
|
||||
@ -88,6 +91,10 @@ $fieldstosearchall = array(
|
||||
$form=new Form($db);
|
||||
$projectstatic = new Project($db);
|
||||
$taskstatic = new Task($db);
|
||||
$puser=new User($db);
|
||||
$tuser=new User($db);
|
||||
if ($search_project_user > 0) $puser->fetch($search_project_user);
|
||||
if ($search_task_user > 0) $tuser->fetch($search_task_user);
|
||||
|
||||
$title=$langs->trans("Activities");
|
||||
if ($mine) $title=$langs->trans("MyActivities");
|
||||
@ -112,6 +119,7 @@ else
|
||||
|
||||
// Get list of project id allowed to user (in a string list separated by coma)
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid);
|
||||
//var_dump($projectsListId);
|
||||
|
||||
// Get list of tasks in tasksarray and taskarrayfiltered
|
||||
// We need all tasks (even not limited to a user because a task assigned to a user can have a parent that is not assigned to him and we need such parents).
|
||||
@ -119,9 +127,9 @@ $morewherefilter='';
|
||||
if ($search_all) $morewherefilter.=natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
if ($search_task_ref) $morewherefilter.=natural_search('t.ref', $search_task_ref);
|
||||
if ($search_task_label) $morewherefilter.=natural_search('t.label', $search_task_label);
|
||||
|
||||
$tasksarray=$taskstatic->getTasksArray(0, 0, $projectstatic->id, $socid, 0, $search_project, $search_status, $morewherefilter, $search_project_user, $search_task_user);
|
||||
// We load also tasks limited to a particular user
|
||||
$tasksrole=($mine ? $taskstatic->getUserRolesForProjectsOrTasks(0,$user,$projectstatic->id,0) : '');
|
||||
$tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, ($tuser->id?$tuser:null), $projectstatic->id, 0, $search_status); // We load also tasks limited to a particular user
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -130,7 +138,6 @@ print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
print '<input type="hidden" name="mode" value="'.GETPOST('mode').'">';
|
||||
|
||||
if ($search_all)
|
||||
{
|
||||
@ -140,20 +147,23 @@ if ($search_all)
|
||||
|
||||
|
||||
// If the user can view users
|
||||
if ($user->rights->user->user->lire)
|
||||
{
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ' ';
|
||||
$moreforfilter.=$form->select_dolusers($search_project_user, 'search_project_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
$moreforfilter.='</div>';
|
||||
}
|
||||
if ($user->rights->user->user->lire)
|
||||
{
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('TasksWithThisUserAsContact'). ' ';
|
||||
$moreforfilter.=$form->select_dolusers($search_task_user, 'search_task_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
$moreforfilter.='</div>';
|
||||
}
|
||||
//if ($mine) $search_project_user=$user->id; // We want by default all project. "mine" is a filter for task contact on this page
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ' ';
|
||||
$includeonly='';
|
||||
if (empty($user->rights->user->user->lire)) $includeonly=array($user->id);
|
||||
$moreforfilter.=$form->select_dolusers($search_project_user, 'search_project_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
$moreforfilter.='</div>';
|
||||
|
||||
// If the user can view users
|
||||
if ($mine) $search_task_user=$user->id;
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('TasksWithThisUserAsContact'). ': ';
|
||||
$includeonly='';
|
||||
if (empty($user->rights->user->user->lire)) $includeonly=array($user->id);
|
||||
$moreforfilter.=$form->select_dolusers($search_task_user, 'search_task_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
$moreforfilter.='</div>';
|
||||
|
||||
if (! empty($moreforfilter))
|
||||
{
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
@ -217,6 +227,7 @@ else
|
||||
{
|
||||
// Show all lines in taskarray (recursive function to go down on tree)
|
||||
$j=0; $level=0;
|
||||
//var_dump($tasksarray);
|
||||
$nboftaskshown=projectLinesa($j, 0, $tasksarray, $level, true, 1, $tasksrole, $projectsListId, 0);
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ if ($object->id > 0)
|
||||
// Define a complementary filter for search of next/prev ref.
|
||||
if (! $user->rights->projet->all->lire)
|
||||
{
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,0);
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0);
|
||||
$projectstatic->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")";
|
||||
}
|
||||
print $form->showrefnav($projectstatic,'project_ref','',1,'ref','ref','',$param.'&withproject=1');
|
||||
@ -175,7 +175,7 @@ if ($object->id > 0)
|
||||
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td>';
|
||||
if (empty($withproject) || empty($projectstatic->id))
|
||||
{
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1);
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1);
|
||||
$object->next_prev_filter=" fk_projet in (".$projectsListId.")";
|
||||
}
|
||||
else $object->next_prev_filter=" fk_projet = ".$projectstatic->id;
|
||||
|
||||
@ -227,7 +227,7 @@ if ($id > 0 || ! empty($ref))
|
||||
// Define a complementary filter for search of next/prev ref.
|
||||
if (! $user->rights->projet->all->lire)
|
||||
{
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,0);
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0);
|
||||
$projectstatic->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")";
|
||||
}
|
||||
print $form->showrefnav($projectstatic,'project_ref','',1,'ref','ref','',$param.'&withproject=1');
|
||||
@ -402,7 +402,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '</td><td colspan="3">';
|
||||
if (! GETPOST('withproject') || empty($projectstatic->id))
|
||||
{
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1);
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1);
|
||||
$object->next_prev_filter=" fk_projet in (".$projectsListId.")";
|
||||
}
|
||||
else $object->next_prev_filter=" fk_projet = ".$projectstatic->id;
|
||||
|
||||
@ -237,7 +237,7 @@ if ($id > 0 || ! empty($ref))
|
||||
// Define a complementary filter for search of next/prev ref.
|
||||
if (! $user->rights->projet->all->lire)
|
||||
{
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,0);
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0);
|
||||
$projectstatic->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")";
|
||||
}
|
||||
print $form->showrefnav($projectstatic,'project_ref','',1,'ref','ref','',$param.'&withproject=1');
|
||||
@ -296,7 +296,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '</td><td colspan="3">';
|
||||
if (! GETPOST('withproject') || empty($projectstatic->id))
|
||||
{
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1);
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1);
|
||||
$object->next_prev_filter=" fk_projet in (".$projectsListId.")";
|
||||
}
|
||||
else $object->next_prev_filter=" fk_projet = ".$projectstatic->id;
|
||||
|
||||
@ -282,6 +282,10 @@ input.removedassigned {
|
||||
vertical-align: text-bottom;
|
||||
margin-bottom: -3px;
|
||||
}
|
||||
input.smallpadd {
|
||||
padding-left: 0px !important;
|
||||
padding-right: 0px !important;
|
||||
}
|
||||
<?php } ?>
|
||||
|
||||
select.flat, form.flat select {
|
||||
|
||||
@ -276,6 +276,10 @@ input.removedassigned {
|
||||
vertical-align: text-bottom;
|
||||
margin-bottom: -3px;
|
||||
}
|
||||
input.smallpadd {
|
||||
padding-left: 1px !important;
|
||||
padding-right: 1px !important;
|
||||
}
|
||||
<?php } ?>
|
||||
|
||||
select.flat, form.flat select {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user