FIX creation of tasks must hide closed project
This commit is contained in:
parent
cfcedc1170
commit
88d3bf0148
@ -470,9 +470,11 @@ class FormOther
|
||||
* @param int $mode 0=Return list of tasks and their projects, 1=Return projects and tasks if exists
|
||||
* @param int $useempty 0=Allow empty values
|
||||
* @param int $disablechildoftaskid 1=Disable task that are child of the provided task id
|
||||
* @param string $filteronprojstatus Filter on project status ('-1'=no filter, '0,1'=Draft+Validated status)
|
||||
* @param string $morecss More css
|
||||
* @return void
|
||||
*/
|
||||
function selectProjectTasks($selectedtask='', $projectid=0, $htmlname='task_parent', $modeproject=0, $modetask=0, $mode=0, $useempty=0, $disablechildoftaskid=0)
|
||||
function selectProjectTasks($selectedtask='', $projectid=0, $htmlname='task_parent', $modeproject=0, $modetask=0, $mode=0, $useempty=0, $disablechildoftaskid=0, $filteronprojstatus='', $morecss='')
|
||||
{
|
||||
global $user, $langs;
|
||||
|
||||
@ -480,10 +482,10 @@ class FormOther
|
||||
|
||||
//print $modeproject.'-'.$modetask;
|
||||
$task=new Task($this->db);
|
||||
$tasksarray=$task->getTasksArray($modetask?$user:0, $modeproject?$user:0, $projectid, 0, $mode);
|
||||
$tasksarray=$task->getTasksArray($modetask?$user:0, $modeproject?$user:0, $projectid, 0, $mode, '', $filteronprojstatus);
|
||||
if ($tasksarray)
|
||||
{
|
||||
print '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
print '<select class="flat'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
if ($useempty) print '<option value="0"> </option>';
|
||||
$j=0;
|
||||
$level=0;
|
||||
@ -569,6 +571,7 @@ class FormOther
|
||||
if ($disabled) print ' disabled';
|
||||
print '>';
|
||||
print $langs->trans("Project").' '.$lines[$i]->projectref;
|
||||
print ' '.$lines[$i]->projectlabel;
|
||||
if (empty($lines[$i]->public))
|
||||
{
|
||||
print ' ('.$langs->trans("Visibility").': '.$langs->trans("PrivateProject").')';
|
||||
|
||||
@ -687,13 +687,13 @@ class Task extends CommonObject
|
||||
* @param int $socid Third party id
|
||||
* @param int $mode 0=Return list of tasks and their projects, 1=Return projects and tasks if exists
|
||||
* @param string $filteronproj Filter on project ref or label
|
||||
* @param string $filteronprojstatus Filter on project status
|
||||
* @param string $filteronprojstatus Filter on project status ('-1'=no filter, '0,1'=Draft+Validated only)
|
||||
* @param string $morewherefilter Add more filter into where SQL request (must start with ' AND ...')
|
||||
* @param string $filteronprojuser Filter on user that is a contact of project
|
||||
* @param string $filterontaskuser Filter on user assigned to task
|
||||
* @return array Array of tasks
|
||||
*/
|
||||
function getTasksArray($usert=null, $userp=null, $projectid=0, $socid=0, $mode=0, $filteronproj='', $filteronprojstatus=-1, $morewherefilter='',$filteronprojuser=0,$filterontaskuser=0)
|
||||
function getTasksArray($usert=null, $userp=null, $projectid=0, $socid=0, $mode=0, $filteronproj='', $filteronprojstatus='-1', $morewherefilter='',$filteronprojuser=0,$filterontaskuser=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -769,7 +769,7 @@ class Task extends CommonObject
|
||||
if ($socid) $sql.= " AND p.fk_soc = ".$socid;
|
||||
if ($projectid) $sql.= " AND p.rowid in (".$projectid.")";
|
||||
if ($filteronproj) $sql.= natural_search(array("p.ref", "p.title"), $filteronproj);
|
||||
if ($filteronprojstatus > -1) $sql.= " AND p.fk_statut IN (".$filteronprojstatus.")";
|
||||
if ($filteronprojstatus && $filteronprojstatus != '-1') $sql.= " AND p.fk_statut IN (".$filteronprojstatus.")";
|
||||
if ($morewherefilter) $sql.=$morewherefilter;
|
||||
$sql.= " ORDER BY p.ref, t.rang, t.dateo";
|
||||
|
||||
@ -1828,10 +1828,10 @@ class Task extends CommonObject
|
||||
|
||||
// For external user, no check is done on company because readability is managed by public status of project and assignement.
|
||||
//$socid=$user->societe_id;
|
||||
|
||||
|
||||
$projectstatic = new Project($this->db);
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1,$socid);
|
||||
|
||||
|
||||
// List of tasks (does not care about permissions. Filtering will be done later)
|
||||
$sql = "SELECT p.rowid as projectid, p.fk_statut as projectstatus,";
|
||||
$sql.= " t.rowid as taskid, t.progress as progress, t.fk_statut as status,";
|
||||
@ -1850,7 +1850,7 @@ class Task extends CommonObject
|
||||
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
|
||||
// if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";
|
||||
|
||||
|
||||
//print $sql;
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@ -462,7 +462,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
|
||||
|
||||
// List of projects
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("ChildOfProjectTask").'</td><td>';
|
||||
print $formother->selectProjectTasks(GETPOST('task_parent'),$projectid?$projectid:$object->id, 'task_parent', 0, 0, 1, 1);
|
||||
print $formother->selectProjectTasks(GETPOST('task_parent'), $projectid?$projectid:$object->id, 'task_parent', 0, 0, 1, 1, 0, '0,1', 'maxwidth500');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("AffectedTo").'</td><td>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user