A lot of fix in project module
This commit is contained in:
parent
2fd6e376da
commit
8e675a9c01
@ -366,11 +366,11 @@ function PLineSelect(&$inc, $parent, $lines, $level=0, $selected=0)
|
|||||||
print $langs->trans("Project").' '.$lines[$i]->projectref;
|
print $langs->trans("Project").' '.$lines[$i]->projectref;
|
||||||
if (empty($lines[$i]->public))
|
if (empty($lines[$i]->public))
|
||||||
{
|
{
|
||||||
print ' ('.$langs->trans("PrivateProject").')';
|
print ' ('.$langs->trans("Visibility").': '.$langs->trans("PrivateProject").')';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print ' ('.$langs->trans("SharedProject").')';
|
print ' ('.$langs->trans("Visibility").': '.$langs->trans("SharedProject").')';
|
||||||
}
|
}
|
||||||
//print '-'.$parent.'-'.$lines[$i]->projectid.'-'.$lastprojectid;
|
//print '-'.$parent.'-'.$lines[$i]->projectid.'-'.$lastprojectid;
|
||||||
print "</option>\n";
|
print "</option>\n";
|
||||||
|
|||||||
@ -4,10 +4,12 @@ Project=Project
|
|||||||
Projects=Projects
|
Projects=Projects
|
||||||
SharedProject=Everybody
|
SharedProject=Everybody
|
||||||
PrivateProject=Contacts of project
|
PrivateProject=Contacts of project
|
||||||
MyProjectsDesc=Cette vue projet est restreinte aux projets pour lesquels vous êtes un contact affecté (quelqu'en soit le type).
|
MyProjectsDesc=This view is limited to projects you are a contact for (whatever is the type).
|
||||||
ProjectsDesc=Cette vue présente tous les projets ayant pour visibilité "Tout le monde".
|
ProjectsPublicDesc=This view presents all projects you are allowed to read.
|
||||||
MyTasksDesc=Cette vue est restreinte aux projets et taches pour lesquels vous êtes un contact affecté à au moins une tache (quelqu'en soit le type).
|
ProjectsDesc=This view presents all projects (your user permissions grant you permission to view everything).
|
||||||
TasksDesc=Cette vue présente tous les projets ayant pour visibilité "Tout le monde".
|
MyTasksDesc=This view is limited to projects or tasks you are a contact for (whatever is the type).
|
||||||
|
TasksPublicDesc=This view presents all projects and tasks you are allowed to read.
|
||||||
|
TasksDesc=This view presents all projects and tasks (your user permissions grant you permission to view everything).
|
||||||
Myprojects=My projects
|
Myprojects=My projects
|
||||||
ProjectsArea=Projects area
|
ProjectsArea=Projects area
|
||||||
NewProject=New project
|
NewProject=New project
|
||||||
|
|||||||
@ -217,6 +217,7 @@ function PLinesb(&$inc, $parent, $lines, &$level, &$tasksrole)
|
|||||||
global $form;
|
global $form;
|
||||||
|
|
||||||
$projectstatic = new Project($db);
|
$projectstatic = new Project($db);
|
||||||
|
$taskstatic = new Task($db);
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
@ -230,8 +231,19 @@ function PLinesb(&$inc, $parent, $lines, &$level, &$tasksrole)
|
|||||||
$var = !$var;
|
$var = !$var;
|
||||||
print "<tr $bc[$var]>\n";
|
print "<tr $bc[$var]>\n";
|
||||||
|
|
||||||
|
// Project
|
||||||
|
print "<td>";
|
||||||
|
$projectstatic->id=$lines[$i]->projectid;
|
||||||
|
$projectstatic->ref=$lines[$i]->projectref;
|
||||||
|
print $projectstatic->getNomUrl(1);
|
||||||
|
print "</td>";
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/task.php?id='.$lines[$i]->id.'">'.$lines[$i]->id.'</a></td>';
|
print '<td>';
|
||||||
|
$taskstatic->id=$lines[$i]->id;
|
||||||
|
$taskstatic->ref=$lines[$i]->id;
|
||||||
|
print $taskstatic->getNomUrl(1);
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
// Label task
|
// Label task
|
||||||
print "<td>";
|
print "<td>";
|
||||||
@ -244,32 +256,24 @@ function PLinesb(&$inc, $parent, $lines, &$level, &$tasksrole)
|
|||||||
print $lines[$i]->label;
|
print $lines[$i]->label;
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
// Project
|
|
||||||
print "<td>";
|
|
||||||
$projectstatic->id=$lines[$i]->projectid;
|
|
||||||
$projectstatic->ref=$lines[$i]->projectref;
|
|
||||||
print $projectstatic->getNomUrl(1);
|
|
||||||
print "</td>";
|
|
||||||
|
|
||||||
$heure = intval($lines[$i]->duration);
|
$heure = intval($lines[$i]->duration);
|
||||||
$minutes = round((($lines[$i]->duration - $heure) * 60),0);
|
$minutes = round((($lines[$i]->duration - $heure) * 60),0);
|
||||||
$minutes = substr("00"."$minutes", -2);
|
$minutes = substr("00"."$minutes", -2);
|
||||||
print '<td align="right">'.$heure." h ".$minutes."</td>\n";
|
print '<td align="right">'.$heure." h ".$minutes."</td>\n";
|
||||||
|
|
||||||
if ($tasksrole[$lines[$i]->id] == 'TASKEXECUTIVE')
|
$disabled=1;
|
||||||
{
|
// If at least one role for project
|
||||||
|
if (! empty($tasksrole[$lines[$i]->id])
|
||||||
|
&& sizeof($tasksrole[$lines[$i]->id]) > 0) $disabled=0;
|
||||||
|
|
||||||
print '<td nowrap="nowrap">';
|
print '<td nowrap="nowrap">';
|
||||||
print $form->select_date('',$lines[$i]->id,'','','',"addtime");
|
print $form->select_date('',$lines[$i]->id,'','','',"addtime");
|
||||||
print ' <input size="4" type="text" class="flat" name="task'.$lines[$i]->id.'" value="">';
|
print ' <input size="4" type="text" class="flat"'.($disabled?' disabled="true"':'').' name="task'.$lines[$i]->id.'" value="">';
|
||||||
print ' <input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
print ' <input type="submit" class="button"'.($disabled?' disabled="true"':'').' value="'.$langs->trans("Add").'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "<td> ";
|
print "<td> ";
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<td colspan="2"> </td>';
|
|
||||||
}
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$inc++;
|
$inc++;
|
||||||
$level++;
|
$level++;
|
||||||
@ -350,6 +354,18 @@ function PLines(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole
|
|||||||
|
|
||||||
print "<tr ".$bc[$var].">\n";
|
print "<tr ".$bc[$var].">\n";
|
||||||
|
|
||||||
|
// Project
|
||||||
|
if ($showproject)
|
||||||
|
{
|
||||||
|
print "<td>";
|
||||||
|
if ($showlineingray) print '<i>';
|
||||||
|
$projectstatic->id=$lines[$i]->projectid;
|
||||||
|
$projectstatic->ref=$lines[$i]->projectref;
|
||||||
|
print $projectstatic->getNomUrl(1);
|
||||||
|
if ($showlineingray) print '</i>';
|
||||||
|
print "</td>";
|
||||||
|
}
|
||||||
|
|
||||||
// Ref of task
|
// Ref of task
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($showlineingray)
|
if ($showlineingray)
|
||||||
@ -377,18 +393,6 @@ function PLines(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole
|
|||||||
else print '</a>';
|
else print '</a>';
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
// Project
|
|
||||||
if ($showproject)
|
|
||||||
{
|
|
||||||
print "<td>";
|
|
||||||
if ($showlineingray) print '<i>';
|
|
||||||
$projectstatic->id=$lines[$i]->projectid;
|
|
||||||
$projectstatic->ref=$lines[$i]->projectref;
|
|
||||||
print $projectstatic->getNomUrl(1);
|
|
||||||
if ($showlineingray) print '</i>';
|
|
||||||
print "</td>";
|
|
||||||
}
|
|
||||||
|
|
||||||
$heure = intval($lines[$i]->duration);
|
$heure = intval($lines[$i]->duration);
|
||||||
$minutes = round((($lines[$i]->duration - $heure) * 60),0);
|
$minutes = round((($lines[$i]->duration - $heure) * 60),0);
|
||||||
$minutes = substr("00"."$minutes", -2);
|
$minutes = substr("00"."$minutes", -2);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -19,9 +19,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/projet/tasks/fiche.php
|
* \file htdocs/projet/activity/list.php
|
||||||
* \ingroup projet
|
* \ingroup projet
|
||||||
* \brief Fiche taches d'un projet
|
* \brief List activities of tasks
|
||||||
* \version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -122,9 +122,9 @@ print '<input type="hidden" name="action" value="addtime">';
|
|||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>'.$langs->trans("Project").'</td>';
|
||||||
print '<td>'.$langs->trans("RefTask").'</td>';
|
print '<td>'.$langs->trans("RefTask").'</td>';
|
||||||
print '<td>'.$langs->trans("LabelTask").'</td>';
|
print '<td>'.$langs->trans("LabelTask").'</td>';
|
||||||
print '<td>'.$langs->trans("Project").'</td>';
|
|
||||||
print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
|
print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
|
||||||
print '<td colspan="2">'.$langs->trans("AddDuration").'</td>';
|
print '<td colspan="2">'.$langs->trans("AddDuration").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|||||||
@ -149,6 +149,7 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer && (empty($proje
|
|||||||
print '<input type="text" size="25" name="label" class="flat" value="'.$_POST["label"].'">';
|
print '<input type="text" size="25" name="label" class="flat" value="'.$_POST["label"].'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// List of projects
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("ChildOfTask").'</td><td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("ChildOfTask").'</td><td>';
|
||||||
print $formother->selectProjectTasks('',$projectid, 'task_parent', 0, 0, 1, 1);
|
print $formother->selectProjectTasks('',$projectid, 'task_parent', 0, 0, 1, 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -244,9 +245,9 @@ else
|
|||||||
*/
|
*/
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
if ($user->rights->projet->creer)
|
if ($user->rights->projet->all->creer || $user->rights->projet->creer)
|
||||||
{
|
{
|
||||||
if ($userAccess)
|
if ($project->public || $userAccess)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$project->id.'&action=create'.$param.'">'.$langs->trans('AddTask').'</a>';
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$project->id.'&action=create'.$param.'">'.$langs->trans('AddTask').'</a>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2006-2010 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2006-2010 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -21,12 +21,14 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/projet/tasks/index.php
|
* \file htdocs/projet/tasks/index.php
|
||||||
* \ingroup project
|
* \ingroup project
|
||||||
* \brief Fiche taches d'un projet
|
* \brief List all task of a project
|
||||||
* \version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/projet/project.class.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/projet/tasks/task.class.php");
|
||||||
|
|
||||||
$langs->load('projects');
|
$langs->load('projects');
|
||||||
|
|
||||||
@ -68,15 +70,15 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorde
|
|||||||
// Get list of tasks in tasksarray and taskarrayfiltered
|
// Get list of tasks in tasksarray and taskarrayfiltered
|
||||||
// We need all tasks (even not limited to a user because a task to user
|
// We need all tasks (even not limited to a user because a task to user
|
||||||
// can have a parent that is not affected to him).
|
// can have a parent that is not affected to him).
|
||||||
$tasksarray=$taskstatic->getTasksArray(0, 0, $projectstatic->id, $socid);
|
$tasksarray=$taskstatic->getTasksArray(0, 0, $projectstatic->id, $socid, 0);
|
||||||
// We load also tasks limited to a particular user
|
// We load also tasks limited to a particular user
|
||||||
$tasksrole=($mine ? $taskstatic->getUserRolesForProjectsOrTasks(0,$user,$projectstatic->id,0) : '');
|
$tasksrole=($mine ? $taskstatic->getUserRolesForProjectsOrTasks(0,$user,$projectstatic->id,0) : '');
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>'.$langs->trans("Project").'</td>';
|
||||||
print '<td width="80">'.$langs->trans("RefTask").'</td>';
|
print '<td width="80">'.$langs->trans("RefTask").'</td>';
|
||||||
print '<td>'.$langs->trans("LabelTask").'</td>';
|
print '<td>'.$langs->trans("LabelTask").'</td>';
|
||||||
print '<td>'.$langs->trans("Project").'</td>';
|
|
||||||
print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
|
print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
// Show all lines in taskarray (recursive function to go down on tree)
|
// Show all lines in taskarray (recursive function to go down on tree)
|
||||||
|
|||||||
@ -495,6 +495,7 @@ class Task extends CommonObject
|
|||||||
$tasks[$i]->description = $obj->description;
|
$tasks[$i]->description = $obj->description;
|
||||||
$tasks[$i]->fk_parent = $obj->fk_task_parent;
|
$tasks[$i]->fk_parent = $obj->fk_task_parent;
|
||||||
$tasks[$i]->duration = $obj->duration_effective;
|
$tasks[$i]->duration = $obj->duration_effective;
|
||||||
|
$tasks[$i]->public = $obj->public;
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
@ -510,17 +511,19 @@ class Task extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return Array of role of user for each projects or each tasks
|
* Return list of roles for a user for each projects or each tasks (or a particular project or task)
|
||||||
* @param userp
|
* @param userp
|
||||||
* @param usert
|
* @param usert Deprecated. Permissions are on project.
|
||||||
* @param projectid
|
* @param projectid Project id to filter on a project
|
||||||
* @param taskid
|
* @param taskid Task id to filter on a task
|
||||||
* @return array Array of role of user for each projects or each tasks
|
* @return array Array (projectid => 'list of roles for project')
|
||||||
*/
|
*/
|
||||||
function getUserRolesForProjectsOrTasks($userp,$usert,$projectid=0,$taskid=0)
|
function getUserRolesForProjectsOrTasks($userp,$usert,$projectid=0,$taskid=0)
|
||||||
{
|
{
|
||||||
$tasksrole = array();
|
$tasksrole = array();
|
||||||
|
|
||||||
|
dol_syslog("Task::getUserRolesForProjectsOrTasks userp=".is_object($userp)." usert=".is_object($usert)." projectid=".$projectid." taskid=".$taskid);
|
||||||
|
|
||||||
// We want role of user for projet or role of user for task. Both are not possible.
|
// We want role of user for projet or role of user for task. Both are not possible.
|
||||||
if (empty($userp) && empty($usert))
|
if (empty($userp) && empty($usert))
|
||||||
{
|
{
|
||||||
@ -552,7 +555,8 @@ class Task extends CommonObject
|
|||||||
if ($usert) $sql.= " AND pt.rowid = ".$taskid;
|
if ($usert) $sql.= " AND pt.rowid = ".$taskid;
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog("Task::getTasksForProjectOwnedByAUser sql=".$sql);
|
//print $sql;
|
||||||
|
dol_syslog("Task::getUserRolesForProjectsOrTasks sql=".$sql);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -561,7 +565,8 @@ class Task extends CommonObject
|
|||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$row = $this->db->fetch_row($resql);
|
$row = $this->db->fetch_row($resql);
|
||||||
$tasksrole[$row[0]] = $row[1];
|
if (empty($tasksrole[$row[0]])) $tasksrole[$row[0]] = $row[1];
|
||||||
|
else $tasksrole[$row[0]].=','.$row[1];
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user