Fix: management of time spent in task card
Fix: user rights
This commit is contained in:
parent
f480baa65e
commit
1f52da3e99
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
@ -415,7 +415,8 @@ if ($socid > 0)
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
print "</table>";
|
||||
@ -463,7 +464,8 @@ if ($socid > 0)
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
print "</table>";
|
||||
@ -520,7 +522,8 @@ if ($socid > 0)
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
print "</table>";
|
||||
@ -544,7 +547,7 @@ if ($socid > 0)
|
||||
{
|
||||
$var=true;
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num >0 )
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/fichinter/index.php?socid='.$objsoc->id.'">'.$langs->trans("AllInterventions").' ('.$num.')</td></tr></table></td>';
|
||||
@ -556,15 +559,16 @@ if ($socid > 0)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td nowrap><a href="'.DOL_URL_ROOT."/fichinter/fiche.php?id=".$objp->id."\">".img_object($langs->trans("ShowPropal"),"propal")." ".$objp->ref."</a>\n";
|
||||
print "</td><td align=\"right\">".dol_print_date($objp->di,'day')."</td>\n";
|
||||
print '<td nowrap><a href="'.DOL_URL_ROOT.'/fichinter/fiche.php?id='.$objp->id.'">'.img_object($langs->trans("ShowPropal"),"propal").' '.$objp->ref.'</a>'."\n";
|
||||
print '</td><td align="right">'.dol_print_date($objp->di,"day").'</td>'."\n";
|
||||
print '</tr>';
|
||||
$var=!$var;
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
print "</table>";
|
||||
@ -573,33 +577,56 @@ if ($socid > 0)
|
||||
/*
|
||||
* Last linked projects
|
||||
*/
|
||||
// TODO remplacer par une fonction
|
||||
if ($conf->projet->enabled && $user->rights->projet->lire)
|
||||
{
|
||||
print '<table class="noborder" width=100%>';
|
||||
|
||||
$sql = "SELECT p.rowid,p.title,p.ref,".$db->pdate("p.dateo")." as do";
|
||||
$sql = "SELECT p.rowid,p.title,p.ref,p.public,".$db->pdate("p.dateo")." as do";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||
$sql .= " WHERE p.fk_soc = $objsoc->id";
|
||||
$sql .= " ORDER BY p.dateo DESC";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$var=true;
|
||||
$i = 0 ;
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
if ($num > 0) {
|
||||
if ($num > 0)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/projet/project.class.php");
|
||||
|
||||
$projectstatic = new Project($db);
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastProjects",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/projet/liste.php?socid='.$objsoc->id.'">'.$langs->trans("AllProjects").' ('.$num.')</td></tr></table></td>';
|
||||
print '<td colspan="3"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastProjects",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/projet/liste.php?socid='.$objsoc->id.'">'.$langs->trans("AllProjects").' ('.$num.')</td></tr></table></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
while ($i < $num && $i < $MAXLIST) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$var = !$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td><a href="../projet/fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowProject"),"project")." ".$obj->title.'</a></td>';
|
||||
|
||||
print "<td align=\"right\">".$obj->ref ."</td></tr>";
|
||||
$i++;
|
||||
|
||||
$var=true;
|
||||
$i = 0 ;
|
||||
while ($i < $num && $i < $MAXLIST)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$projectstatic->fetch($obj->rowid);
|
||||
|
||||
// To verify role of users
|
||||
$userAccess = $projectstatic->restrictedProjectArea($user,1);
|
||||
|
||||
if ($user->rights->projet->lire && $userAccess > 0)
|
||||
{
|
||||
$var = !$var;
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
// Ref
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/projet/fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowProject"),($obj->public?'projectpub':'project'))." ".$obj->ref.'</a></td>';
|
||||
// Label
|
||||
print '<td>'.$obj->title.'</td>';
|
||||
// Date
|
||||
print '<td align="right">'.dol_print_date($obj->do,"day").'</td>';
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$db->free($result);
|
||||
}
|
||||
@ -613,6 +640,7 @@ if ($socid > 0)
|
||||
/*
|
||||
* Last linked chronodocs
|
||||
*/
|
||||
// TODO add function to add an external module
|
||||
if(!empty($conf->global->MAIN_MODULE_CHRONODOCS) && $user->rights->chronodocs->entries->read)
|
||||
{
|
||||
print '<table class="noborder" width=100%>';
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -387,40 +388,60 @@ if ($socid > 0)
|
||||
}
|
||||
|
||||
/*
|
||||
* Last project
|
||||
* Last linked projects
|
||||
*/
|
||||
// TODO remplacer par une fonction
|
||||
if ($conf->projet->enabled && $user->rights->projet->lire)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table class="noborder" width=100%>';
|
||||
|
||||
$sql = "SELECT p.rowid,p.title,p.ref,".$db->pdate("p.dateo")." as do";
|
||||
$sql = "SELECT p.rowid,p.title,p.ref,p.public,".$db->pdate("p.dateo")." as do";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||
$sql .= " WHERE p.fk_soc = $societe->id";
|
||||
$sql .= " ORDER by p.dateo";
|
||||
$sql .= " ORDER BY p.dateo DESC";
|
||||
|
||||
if ( $db->query($sql) )
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$var=true;
|
||||
$i = 0 ;
|
||||
$num = $db->num_rows();
|
||||
$num = $db->num_rows($result);
|
||||
if ($num > 0)
|
||||
{
|
||||
$tableaushown=1;
|
||||
require_once(DOL_DOCUMENT_ROOT."/projet/project.class.php");
|
||||
|
||||
$projectstatic = new Project($db);
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastProjects",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/projet/index.php?socid='.$societe->id.'">'.$langs->trans("AllProjects").' ('.$num.')</td></tr></table></td>';
|
||||
print '<td colspan="3"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastProjects",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/projet/liste.php?socid='.$objsoc->id.'">'.$langs->trans("AllProjects").' ('.$num.')</td></tr></table></td>';
|
||||
print '</tr>';
|
||||
|
||||
$var=true;
|
||||
$i = 0 ;
|
||||
while ($i < $num && $i < $MAXLIST)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$projectstatic->fetch($obj->rowid);
|
||||
|
||||
// To verify role of users
|
||||
$userAccess = $projectstatic->restrictedProjectArea($user,1);
|
||||
|
||||
if ($user->rights->projet->lire && $userAccess > 0)
|
||||
{
|
||||
$var = !$var;
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
// Ref
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/projet/fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowProject"),($obj->public?'projectpub':'project'))." ".$obj->ref.'</a></td>';
|
||||
// Label
|
||||
print '<td>'.$obj->title.'</td>';
|
||||
// Date
|
||||
print '<td align="right">'.dol_print_date($obj->do,"day").'</td>';
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
while ($i < $num && $i < $MAXLIST)
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
$var = !$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td><a href="../projet/fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowProject"),"project")." ".$obj->title.'</a></td>';
|
||||
|
||||
print "<td align=\"right\">".dol_print_date($obj->do,"day") ."</td></tr>";
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -647,6 +647,10 @@ class Project extends CommonObject
|
||||
{
|
||||
$userAccess = 1;
|
||||
}
|
||||
else if ($this->public && $user->rights->projet->lire)
|
||||
{
|
||||
$userAccess = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach(array('internal','external') as $source)
|
||||
|
||||
@ -141,47 +141,50 @@ if ($_GET["id"] > 0)
|
||||
/*
|
||||
* Add time spent
|
||||
*/
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$task->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="addtimespent">';
|
||||
print '<input type="hidden" name="id" value="'.$task->id.'">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="50%">'.$langs->trans("Note").'</td>';
|
||||
print '<td>'.$langs->trans("By").'</td>';
|
||||
print '<td>'.$langs->trans("Date").'</td>';
|
||||
print '<td colspan="2">'.$langs->trans("Duration").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr>';
|
||||
|
||||
// Note
|
||||
print '<td nowrap="nowrap" width="50%">';
|
||||
print '<textarea name="timespent_note" cols="80" rows="4"></textarea>';
|
||||
print '</td>';
|
||||
|
||||
// Contributor
|
||||
print '<td nowrap="nowrap">';
|
||||
print ' '; // TODO ajout liste deroulante des participants
|
||||
print '</td>';
|
||||
|
||||
// Date
|
||||
print '<td nowrap="nowrap">';
|
||||
print $html->select_date('','time','','','',"timespent_date");
|
||||
print '</td>';
|
||||
|
||||
// Duration
|
||||
print '<td nowrap="nowrap">';
|
||||
print '<input size="4" type="text" class="flat" name="timespent_duration" value="">';
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table></form>';
|
||||
if ($user->rights->projet->creer && $userAccess)
|
||||
{
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$task->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="addtimespent">';
|
||||
print '<input type="hidden" name="id" value="'.$task->id.'">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="50%">'.$langs->trans("Note").'</td>';
|
||||
print '<td>'.$langs->trans("By").'</td>';
|
||||
print '<td>'.$langs->trans("Date").'</td>';
|
||||
print '<td colspan="2">'.$langs->trans("Duration").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr>';
|
||||
|
||||
// Note
|
||||
print '<td nowrap="nowrap" width="50%">';
|
||||
print '<textarea name="timespent_note" cols="80" rows="4"></textarea>';
|
||||
print '</td>';
|
||||
|
||||
// Contributor
|
||||
print '<td nowrap="nowrap">';
|
||||
print ' '; // TODO ajout liste deroulante des participants
|
||||
print '</td>';
|
||||
|
||||
// Date
|
||||
print '<td nowrap="nowrap">';
|
||||
print $html->select_date('','time','','','',"timespent_date");
|
||||
print '</td>';
|
||||
|
||||
// Duration
|
||||
print '<td nowrap="nowrap">';
|
||||
print '<input size="4" type="text" class="flat" name="timespent_duration" value="">';
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table></form>';
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
|
||||
@ -216,6 +219,11 @@ if ($_GET["id"] > 0)
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$task->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="updateline">';
|
||||
print '<input type="hidden" name="id" value="'.$task->id.'">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="50%">'.$langs->trans("Note").'</td>';
|
||||
@ -286,7 +294,7 @@ if ($_GET["id"] > 0)
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
print "</form>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user