';
- if ($_GET["action"] != "edit")
+ if ($_GET["action"] != "edit" )
{
// Validate
if ($project->statut == 0 && $user->rights->projet->creer)
{
- print '
'.$langs->trans("Valid").'';
+ if ($userAccess)
+ {
+ print '
'.$langs->trans("Valid").'';
+ }
+ else
+ {
+ print '
'.$langs->trans('Valid').'';
+ }
}
// Modify
if ($project->statut != 2 && $user->rights->projet->creer)
{
- print '
'.$langs->trans("Modify").'';
+ if ($userAccess)
+ {
+ print '
'.$langs->trans("Modify").'';
+ }
+ else
+ {
+ print '
'.$langs->trans('Modify').'';
+ }
}
// Close
if ($project->statut != 2 && $user->rights->projet->creer)
{
- print '
'.$langs->trans("Close").'';
+ if ($userAccess)
+ {
+ print '
'.$langs->trans("Close").'';
+ }
+ else
+ {
+ print '
'.$langs->trans('Close').'';
+ }
}
// Reopen
if ($project->statut == 2 && $user->rights->projet->creer)
{
- print '
'.$langs->trans("ReOpen").'';
+ if ($userAccess)
+ {
+ print '
'.$langs->trans("ReOpen").'';
+ }
+ else
+ {
+ print '
'.$langs->trans('ReOpen').'';
+ }
}
// Delete
if ($user->rights->projet->supprimer)
{
- print '
'.$langs->trans("Delete").'';
+ if ($userAccess)
+ {
+ print '
'.$langs->trans("Delete").'';
+ }
+ else
+ {
+ print '
'.$langs->trans('Delete').'';
+ }
}
}
@@ -543,8 +595,8 @@ else
$filename=dol_sanitizeFileName($project->ref);
$filedir=$conf->projet->dir_output . "/" . dol_sanitizeFileName($project->ref);
$urlsource=$_SERVER["PHP_SELF"]."?id=".$project->id;
- $genallowed=$user->rights->projet->creer;
- $delallowed=$user->rights->projet->supprimer;
+ $genallowed=($user->rights->projet->creer && $userAccess);
+ $delallowed=($user->rights->projet->supprimer && $userAccess);
$var=true;
diff --git a/htdocs/projet/tasks/fiche.php b/htdocs/projet/tasks/fiche.php
index ec9d2c14547..28ed64ac767 100644
--- a/htdocs/projet/tasks/fiche.php
+++ b/htdocs/projet/tasks/fiche.php
@@ -117,6 +117,24 @@ if ($id > 0 || ! empty($ref))
$project = new Project($db);
$project->fetch($_REQUEST["id"],$_GET["ref"]);
if ($project->societe->id > 0) $result=$project->societe->fetch($project->societe->id);
+
+ // To verify role of users
+ $userAccess = 0;
+ foreach(array('internal','external') as $source)
+ {
+ $userRole = $project->liste_contact(4,$source);
+ $num=sizeof($userRole);
+
+ $i = 0;
+ while ($i < $num)
+ {
+ if ($userRole[$i]['code'] == 'PROJECTLEADER' && $user->id == $userRole[$i]['id'])
+ {
+ $userAccess++;
+ }
+ $i++;
+ }
+ }
}
if ($_GET["action"] == 'create' && $user->rights->projet->creer)
@@ -196,24 +214,6 @@ else
dol_fiche_head($head, $tab, $langs->trans("Project"),0,'project');
$param=($_REQUEST["mode"]=='mine'?'&mode=mine':'');
-
- // To verify role of users
- $userAccess = 0;
- foreach(array('internal','external') as $source)
- {
- $userRole = $project->liste_contact(4,$source);
- $num=sizeof($userRole);
-
- $i = 0;
- while ($i < $num)
- {
- if ($userRole[$i]['code'] == 'PROJECTLEADER' && $user->id == $userRole[$i]['id'])
- {
- $userAccess++;
- }
- $i++;
- }
- }
print '