diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index bf0150c32e3..7b5d23d45b3 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2010 Juanjo Menent * @@ -415,7 +415,8 @@ if ($socid > 0) } $db->free($resql); } - else { + else + { dol_print_error($db); } print ""; @@ -463,7 +464,8 @@ if ($socid > 0) } $db->free($resql); } - else { + else + { dol_print_error($db); } print ""; @@ -520,7 +522,8 @@ if ($socid > 0) } $db->free($resql); } - else { + else + { dol_print_error($db); } print ""; @@ -544,7 +547,7 @@ if ($socid > 0) { $var=true; $num = $db->num_rows($resql); - if ($num >0 ) + if ($num > 0) { print ''; print '
'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllInterventions").' ('.$num.')
'; @@ -556,15 +559,16 @@ if ($socid > 0) { $objp = $db->fetch_object($resql); print ""; - print '".img_object($langs->trans("ShowPropal"),"propal")." ".$objp->ref."\n"; - print "".dol_print_date($objp->di,'day')."\n"; + print ''.img_object($langs->trans("ShowPropal"),"propal").' '.$objp->ref.''."\n"; + print ''.dol_print_date($objp->di,"day").''."\n"; print ''; $var=!$var; $i++; } $db->free($resql); } - else { + else + { dol_print_error($db); } print ""; @@ -573,33 +577,56 @@ if ($socid > 0) /* * Last linked projects */ + // TODO remplacer par une fonction if ($conf->projet->enabled && $user->rights->projet->lire) { print ''; - $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 ''; - print ''; + print ''; print ''; - } - while ($i < $num && $i < $MAXLIST) { - $obj = $db->fetch_object($result); - $var = !$var; - print ""; - print ''; - - print ""; - $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 ""; + + // Ref + print ''; + // Label + print ''; + // Date + print ''; + + print ''; + } + $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 '
'.$langs->trans("LastProjects",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllProjects").' ('.$num.')
'.$langs->trans("LastProjects",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllProjects").' ('.$num.')
'.img_object($langs->trans("ShowProject"),"project")." ".$obj->title.'".$obj->ref ."
'.img_object($langs->trans("ShowProject"),($obj->public?'projectpub':'project'))." ".$obj->ref.''.$obj->title.''.dol_print_date($obj->do,"day").'
'; diff --git a/htdocs/compta/fiche.php b/htdocs/compta/fiche.php index fcfa221b113..d55a4e3c0e8 100644 --- a/htdocs/compta/fiche.php +++ b/htdocs/compta/fiche.php @@ -1,6 +1,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur + * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2010 Juanjo Menent * * 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 '
'; + print '
'; - $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 ''; - print ''; + print ''; print ''; + + $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 ""; + + // Ref + print ''; + // Label + print ''; + // Date + print ''; + + print ''; + } + $i++; + } } - while ($i < $num && $i < $MAXLIST) - { - $obj = $db->fetch_object(); - $var = !$var; - print ""; - print ''; - - print ""; - $i++; - } - $db->free(); + $db->free($result); } else { diff --git a/htdocs/projet/project.class.php b/htdocs/projet/project.class.php index e248a8377d1..43293733c3c 100644 --- a/htdocs/projet/project.class.php +++ b/htdocs/projet/project.class.php @@ -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) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 8dde28bbb71..bb8eb9c3505 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -141,47 +141,50 @@ if ($_GET["id"] > 0) /* * Add time spent */ - print ''; - print ''; - print ''; - print ''; - - print '
'.$langs->trans("LastProjects",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllProjects").' ('.$num.')
'.$langs->trans("LastProjects",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllProjects").' ('.$num.')
'.img_object($langs->trans("ShowProject"),($obj->public?'projectpub':'project'))." ".$obj->ref.''.$obj->title.''.dol_print_date($obj->do,"day").'
'.img_object($langs->trans("ShowProject"),"project")." ".$obj->title.'".dol_print_date($obj->do,"day") ."
'; - - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - print ''; - - // Note - print ''; - - // Contributor - print ''; - - // Date - print ''; - - // Duration - print ''; - - print ''; - - print '
'.$langs->trans("Note").''.$langs->trans("By").''.$langs->trans("Date").''.$langs->trans("Duration").'
'; - print ''; - print ''; - print ' '; // TODO ajout liste deroulante des participants - print ''; - print $html->select_date('','time','','','',"timespent_date"); - print ''; - print ''; - print ''; - print ''; - print '
'; + if ($user->rights->projet->creer && $userAccess) + { + print '
'; + print ''; + print ''; + print ''; + + print ''; + + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + + print ''; + + // Note + print ''; + + // Contributor + print ''; + + // Date + print ''; + + // Duration + print ''; + + print ''; + + print '
'.$langs->trans("Note").''.$langs->trans("By").''.$langs->trans("Date").''.$langs->trans("Duration").'
'; + print ''; + print ''; + print ' '; // TODO ajout liste deroulante des participants + print ''; + print $html->select_date('','time','','','',"timespent_date"); + print ''; + print ''; + print ''; + print ''; + print '
'; + } print '
'; @@ -216,6 +219,11 @@ if ($_GET["id"] > 0) dol_print_error($db); } + print '
'; + print ''; + print ''; + print ''; + print ''; print ''; print ''; @@ -286,7 +294,7 @@ if ($_GET["id"] > 0) } print "
'.$langs->trans("Note").'
"; - + print "
"; } }