Skip to content
Snippets Groups Projects
Commit 2fd6e376 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Add more clear information for project view

parent df312b36
No related branches found
No related tags found
No related merge requests found
Showing
with 136 additions and 89 deletions
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -366,7 +366,7 @@ function PLineSelect(&$inc, $parent, $lines, $level=0, $selected=0)
print $langs->trans("Project").' '.$lines[$i]->projectref;
if (empty($lines[$i]->public))
{
print ' ('.$langs->trans("Private").')';
print ' ('.$langs->trans("PrivateProject").')';
}
else
{
......@@ -389,7 +389,7 @@ function PLineSelect(&$inc, $parent, $lines, $level=0, $selected=0)
print $langs->trans("Project").' '.$lines[$i]->projectref;
if (empty($lines[$i]->public))
{
print ' ('.$langs->trans("Private").')';
print ' ('.$langs->trans("PrivateProject").')';
}
else
{
......
......@@ -98,21 +98,21 @@ class modProjet extends DolibarrModules
$r++;
$this->rights[$r][0] = 41; // id de la permission
$this->rights[$r][1] = "Lire les projets et taches (publiques ou m'appartenant)"; // libelle de la permission
$this->rights[$r][1] = "Lire les projets et taches (partagés ou dont je suis contact)"; // libelle de la permission
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'lire';
$r++;
$this->rights[$r][0] = 42; // id de la permission
$this->rights[$r][1] = "Creer/modifier les projets et taches (publiques ou m'appartenant)"; // libelle de la permission
$this->rights[$r][1] = "Creer/modifier les projets et taches (partagés ou dont je suis contact)"; // libelle de la permission
$this->rights[$r][2] = 'w'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'creer';
$r++;
$this->rights[$r][0] = 44; // id de la permission
$this->rights[$r][1] = "Supprimer les projets et taches (publiques ou m'appartenant)"; // libelle de la permission
$this->rights[$r][1] = "Supprimer les projets et taches (partagés ou dont je suis contact)"; // libelle de la permission
$this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'supprimer';
......
......@@ -395,9 +395,9 @@ Permission31=Read products
Permission32=Create/modify products
Permission34=Delete products
Permission38=Export products
Permission41=Read projects
Permission42=Create/modify projects
Permission44=Delete projects
Permission41=Read projects (shared project and projects i'm contact for)
Permission42=Create/modify projects (shared project and projects i'm contact for)
Permission44=Delete projects (shared project and projects i'm contact for)
Permission61=Read interventions
Permission62=Create/modify interventions
Permission64=Delete interventions
......
......@@ -2,7 +2,12 @@
CHARSET=UTF-8
Project=Project
Projects=Projects
SharedProject=Shared project
SharedProject=Everybody
PrivateProject=Contacts of project
MyProjectsDesc=Cette vue projet est restreinte aux projets pour lesquels vous êtes un contact affecté (quelqu'en soit le type).
ProjectsDesc=Cette vue présente tous les projets ayant pour visibilité "Tout le monde".
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).
TasksDesc=Cette vue présente tous les projets ayant pour visibilité "Tout le monde".
Myprojects=My projects
ProjectsArea=Projects area
NewProject=New project
......
......@@ -395,9 +395,9 @@ Permission31 = Consulter les produits
Permission32 = Créer/modifier les produits
Permission34 = Supprimer les produits
Permission38 = Exporter les produits
Permission41 = Consulter les projets et tâches (publiques ou m'appartenant)
Permission42 = Créer/modifier les projets et tâches (publiques ou m'appartenant)
Permission44 = Supprimer les projets et tâches (publiques ou m'appartenant)
Permission41 = Consulter les projets et tâches (partagés ou dont je suis contact)
Permission42 = Créer/modifier les projets et tâches (partagés ou dont je suis contact)
Permission44 = Supprimer les projets et tâches (partagés ou dont je suis contact)
Permission61 = Consulter les interventions
Permission62 = Créer/modifier les interventions
Permission64 = Supprimer les interventions
......@@ -439,9 +439,9 @@ Permission121 = Consulter les tiers (sociétés) liés à l'utilisateur
Permission122 = Créer/modifier les tiers (sociétés) liés à l'utilisateur
Permission125 = Supprimer les tiers (sociétés) liés à l'utilisateur
Permission126 = Exporter les tiers (sociétés)
Permission141 = Consulter tous les projets et tâches (y compris privés qui ne me sont pas affectés)
Permission142 = Créer/modifier tous les projets et tâches (y compris privés qui ne me sont pas affectés)
Permission144 = Supprimer tous les projets et tâches (y compris privés qui ne me sont pas affectés)
Permission141 = Consulter tous les projets et tâches (y compris privés dont je ne suis pas contact)
Permission142 = Créer/modifier tous les projets et tâches (y compris privés dont je ne suis pas contact)
Permission144 = Supprimer tous les projets et tâches (y compris privés dont je ne suis pas contact)
Permission146 = Consulter les fournisseurs
Permission147 = Consulter les stats
Permission151 = Consulter les prélèvements
......
......@@ -2,7 +2,14 @@
CHARSET=UTF-8
Project=Projet
Projects=Projets
SharedProject=Projet partagé
SharedProject=Tout le monde
PrivateProject=Contacts du projet
MyProjectsDesc=Cette vue projet est restreinte aux projets pour lesquels vous êtes un contact affecté (quelqu'en soit le type).
ProjectsPublicDesc=Cette vue présente tous les projets pour lesquels vous êtes habilités à avoir une visibilité.
ProjectsDesc=Cette vue présente tous les projets (vos habilitations vous offrant une vue exhaustive).
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).
TasksPublicDesc=Cette vue présente tous les projets et taches pour lesquels vous êtes habilités à avoir une visibilité.
TasksDesc=Cette vue présente tous les projets et taches (vos habilitations vous offrant une vue exhaustive).
Myprojects=Mes projets
ProjectsArea=Espace projet
NewProject=Nouveau projet
......
......@@ -147,10 +147,10 @@ function task_prepare_head($object)
*/
function select_projects($socid, $selected='', $htmlname='projectid')
{
global $db,$conf,$langs;
global $db,$user,$conf,$langs;
// On recherche les projets
$sql = 'SELECT p.rowid, p.ref, p.title, p.fk_soc';
$sql = 'SELECT p.rowid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public';
$sql.= ' FROM '.MAIN_DB_PREFIX .'projet as p';
$sql.= " WHERE (p.fk_soc='".$socid."' OR p.fk_soc IS NULL)";
$sql.= " AND p.entity = ".$conf->entity;
......@@ -170,14 +170,21 @@ function select_projects($socid, $selected='', $htmlname='projectid')
{
$obj = $db->fetch_object($resql);
$labeltoshow=dol_trunc($obj->ref,12).' - '.dol_trunc($obj->title,12);
if (empty($obj->fk_soc)) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
if (!empty($selected) && $selected == $obj->rowid)
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
//else $labeltoshow.=' ('.$langs->trans("Private").')';
if (!empty($selected) && $selected == $obj->rowid && $obj->fk_statut > 0)
{
print '<option value="'.$obj->rowid.'" selected="true">'.$labeltoshow.'</option>';
}
else
{
print '<option value="'.$obj->rowid.'">'.$labeltoshow.'</option>';
print '<option value="'.$obj->rowid.'"';
if (! $obj->fk_statut > 0)
{
print ' disabled="true"';
$labeltoshow.=' - '.$langs->trans("Draft");
}
print '>'.$labeltoshow.'</option>';
}
$i++;
}
......@@ -499,7 +506,84 @@ function clean_orphelins($db)
return -1;
}
}
}
/**
* Return HTML table with list of projects and number of opened tasks
*
* @param unknown_type $db
* @param unknown_type $mine
* @param unknown_type $socid
* @param unknown_type $projectsListId
*/
function print_projecttasks_array($db,$mine,$socid,$projectsListId)
{
global $langs,$conf,$user;
require_once(DOL_DOCUMENT_ROOT."/projet/project.class.php");
$projectstatic=new Project($db);
$sortfield='';
$sortorder='';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Project"),"index.php","","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("NbOpenTasks"),"","","","",'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),"","","","",'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut, count(t.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet";
$sql.= " WHERE p.entity = ".$conf->entity;
if ($mine) $sql.= " AND p.rowid IN (".$projectsListId.")";
if ($socid) $sql.= " AND p.fk_soc = ".$socid;
$sql.= " GROUP BY p.ref";
$var=true;
$resql = $db->query($sql);
if ( $resql )
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$objp = $db->fetch_object($resql);
$projectstatic->id = $objp->projectid;
$projectstatic->user_author_id = $objp->fk_user_creat;
$projectstatic->public = $objp->public;
$userAccess = $projectstatic->restrictedProjectArea($user,1);
if ($userAccess >= 0)
{
$var=!$var;
print "<tr $bc[$var]>";
print '<td nowrap="nowrap">';
$projectstatic->ref=$objp->ref;
print $projectstatic->getNomUrl(1);
print ' - '.$objp->title.'</td>';
print '<td align="right">'.$objp->nb.'</td>';
$projectstatic->statut = $objp->fk_statut;
print '<td align="right">'.$projectstatic->getLibStatut(3).'</td>';
print "</tr>\n";
}
$i++;
}
$db->free($resql);
}
else
{
dol_print_error($db);
}
print "</table>";
}
?>
\ No newline at end of file
<?php
/* Copyright (C) 2001-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) 2010 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -19,16 +19,16 @@
*/
/**
* \file htdocs/projet/activity/myactivity.php
* \file htdocs/projet/activity/index.php
* \ingroup projet
* \brief Page activite perso du module projet
* \version $Id$
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php");
$mode=$_REQUEST["mode"];
$mine = $_REQUEST['mode']=='mine' ? 1 : 0;
// Security check
if (!$user->rights->projet->lire) accessforbidden();
......@@ -48,7 +48,6 @@ $now = gmmktime();
$projectstatic=new Project($db);
$mine = $_REQUEST['mode']=='mine' ? 1 : 0;
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1);
$title=$langs->trans("Activities");
......@@ -58,70 +57,22 @@ llxHeader("",$title);
print_fiche_titre($title);
if ($mine) print $langs->trans("MyTasksDesc").'<br><br>';
else
{
if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("TasksDesc").'<br><br>';
else print $langs->trans("TasksPublicDesc").'<br><br>';
}
print '<table border="0" width="100%" class="notopnoleftnoright">';
print '<tr><td width="30%" valign="top" class="notopnoleft">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Project"),"index.php","","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("NbOpenTasks"),"","","","",'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),"","","","",'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut, count(t.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql.= ", ".MAIN_DB_PREFIX."projet_task as t";
$sql.= " WHERE t.fk_projet = p.rowid";
$sql.= " AND p.entity = ".$conf->entity;
if ($mine) $sql.= " AND p.rowid IN (".$projectsListId.")";
if ($socid) $sql.= " AND p.fk_soc = ".$socid;
$sql.= " GROUP BY p.ref";
$resql = $db->query($sql);
if ( $resql )
{
$var=true;
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$objp = $db->fetch_object($resql);
$projectstatic->id = $objp->projectid;
$projectstatic->user_author_id = $objp->fk_user_creat;
$projectstatic->public = $objp->public;
$userAccess = $projectstatic->restrictedProjectArea($user,1);
if ($userAccess >= 0)
{
$var=!$var;
print "<tr $bc[$var]>";
print '<td nowrap="nowrap">';
$projectstatic->ref=$objp->ref;
print $projectstatic->getNomUrl(1);
print ' - '.$objp->title.'</td>';
print '<td align="right">'.$objp->nb.'</td>';
$projectstatic->statut = $objp->fk_statut;
print '<td align="right">'.$projectstatic->getLibStatut(3).'</td>';
print "</tr>\n";
}
$i++;
}
print_projecttasks_array($db,$mine,$socid,$projectsListId);
$db->free($resql);
}
else
{
dol_print_error($db);
}
print "</table>";
/* Affichage de la liste des projets d'aujourd'hui */
print '<br /><table class="noborder" width="100%">';
print '<br><table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td width="50%">'.$langs->trans('Today').'</td>';
print '<td width="50%" align="right">'.$langs->trans("Time").'</td>';
......@@ -143,7 +94,7 @@ if ( $resql )
{
$var=true;
$total=0;
while ($row = $db->fetch_object($resql))
{
$var=!$var;
......@@ -193,7 +144,7 @@ if ( $resql )
{
$var=true;
$total=0;
while ($row = $db->fetch_object($resql))
{
$var=!$var;
......@@ -245,7 +196,7 @@ if ( $resql )
{
$total = 0;
$var=true;
while ($row = $db->fetch_object($resql))
{
$var=!$var;
......@@ -294,7 +245,7 @@ $resql = $db->query($sql);
if ( $resql )
{
$var=false;
while ($row = $db->fetch_object($resql))
{
print "<tr $bc[$var]>";
......
......@@ -207,7 +207,7 @@ if ($id > 0 || ! empty($ref))
// Visibility
print '<tr><td>'.$langs->trans("Visibility").'</td><td>';
if ($project->public) print $langs->trans('SharedProject');
else print $langs->trans('Private');
else print $langs->trans('PrivateProject');
print '</td></tr>';
// Statut
......
......@@ -92,7 +92,7 @@ print '</td></tr>';
// Visibility
print '<tr><td>'.$langs->trans("Visibility").'</td><td>';
if ($project->public) print $langs->trans('SharedProject');
else print $langs->trans('Private');
else print $langs->trans('PrivateProject');
print '</td></tr>';
// Statut
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment