diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index a80f0185062..10ee5503995 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -24,10 +24,10 @@ */ /** - \file htdocs/facture.class.php - \ingroup facture - \brief Fichier de la classe des factures clients - \version $Id$ + * \file htdocs/facture.class.php + * \ingroup facture + * \brief Fichier de la classe des factures clients + * \version $Id$ */ require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php"); @@ -386,10 +386,10 @@ class Facture extends CommonObject /** - \brief Renvoie nom clicable (avec eventuellement le picto) - \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul - \param option Sur quoi pointe le lien - \return string Chaine avec URL + * \brief Renvoie nom clicable (avec eventuellement le picto) + * \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul + * \param option Sur quoi pointe le lien + * \return string Chaine avec URL */ function getNomUrl($withpicto=0,$option='') { diff --git a/htdocs/includes/menus/barre_left/eldy_backoffice.php b/htdocs/includes/menus/barre_left/eldy_backoffice.php index 60e530deb8c..748e3225c03 100644 --- a/htdocs/includes/menus/barre_left/eldy_backoffice.php +++ b/htdocs/includes/menus/barre_left/eldy_backoffice.php @@ -758,11 +758,13 @@ class MenuLeft { $newmenu->add_submenu(DOL_URL_ROOT."/projet/fiche.php?leftmenu=projects&action=create", $langs->trans("NewProject"), 1, $user->rights->projet->creer); $newmenu->add_submenu(DOL_URL_ROOT."/projet/liste.php?leftmenu=projects", $langs->trans("List"), 1, $user->rights->projet->lire); - $newmenu->add(DOL_URL_ROOT."/projet/tasks/", $langs->trans("Tasks"), 0, $user->rights->projet->lire); - $newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/mytasks.php", $langs->trans("Mytasks"), 1, $user->rights->projet->lire); - - $newmenu->add(DOL_URL_ROOT."/projet/activity/", $langs->trans("Activity"), 0, $user->rights->projet->lire); - $newmenu->add_submenu(DOL_URL_ROOT."/projet/activity/myactivity.php", $langs->trans("MyActivity"), 1, $user->rights->projet->lire); + $newmenu->add(DOL_URL_ROOT."/projet/tasks/index.php", $langs->trans("Tasks"), 0, $user->rights->projet->lire); + $newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/fiche.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer); + $newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php?mode=mine", $langs->trans("Mytasks"), 1, $user->rights->projet->lire); + + $newmenu->add(DOL_URL_ROOT."/projet/activity/index.php", $langs->trans("TimeSpent"), 0, $user->rights->projet->lire); + $newmenu->add_submenu(DOL_URL_ROOT."/projet/activity/list.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer); + $newmenu->add_submenu(DOL_URL_ROOT."/projet/activity/index.php?mode=mine", $langs->trans("MyTimeSpent"), 1, $user->rights->projet->lire); } } diff --git a/htdocs/includes/menus/barre_left/eldy_frontoffice.php b/htdocs/includes/menus/barre_left/eldy_frontoffice.php index 429fd24e28f..48364378ac0 100644 --- a/htdocs/includes/menus/barre_left/eldy_frontoffice.php +++ b/htdocs/includes/menus/barre_left/eldy_frontoffice.php @@ -722,17 +722,18 @@ class MenuLeft { { if ($conf->projet->enabled) { - $langs->load("admin"); $langs->load("projects"); $newmenu->add(DOL_URL_ROOT."/projet/index.php?leftmenu=projects", $langs->trans("Projects"), 0, $user->rights->projet->lire); $newmenu->add_submenu(DOL_URL_ROOT."/projet/fiche.php?leftmenu=projects&action=create", $langs->trans("NewProject"), 1, $user->rights->projet->creer); $newmenu->add_submenu(DOL_URL_ROOT."/projet/liste.php?leftmenu=projects", $langs->trans("List"), 1, $user->rights->projet->lire); - $newmenu->add(DOL_URL_ROOT."/projet/tasks/", $langs->trans("Tasks"), 0, $user->rights->projet->lire); - $newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/mytasks.php", $langs->trans("Mytasks"), 1, $user->rights->projet->lire); - - $newmenu->add(DOL_URL_ROOT."/projet/activity/", $langs->trans("Activity"), 0, $user->rights->projet->lire); - $newmenu->add_submenu(DOL_URL_ROOT."/projet/activity/myactivity.php", $langs->trans("MyActivity"), 1, $user->rights->projet->lire); + $newmenu->add(DOL_URL_ROOT."/projet/tasks/index.php", $langs->trans("Tasks"), 0, $user->rights->projet->lire); + $newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/fiche.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer); + $newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php?mode=mine", $langs->trans("Mytasks"), 1, $user->rights->projet->lire); + + $newmenu->add(DOL_URL_ROOT."/projet/activity/index.php", $langs->trans("TimeSpent"), 0, $user->rights->projet->lire); + $newmenu->add_submenu(DOL_URL_ROOT."/projet/activity/list.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer); + $newmenu->add_submenu(DOL_URL_ROOT."/projet/activity/index.php?mode=mine", $langs->trans("MyTimeSpent"), 1, $user->rights->projet->lire); } } diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 03a03a26179..0cdb429e280 100755 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -10,10 +10,17 @@ OfficerProject=Officer project ConfirmDeleteAProject=Are you sure you want to delete this project ? LastProjects=Last %s projects AllProjects=All projects +ProjectsList=List of projects ShowProject=Show project SetProject=Set project NoProject=No project defined NbOpenTasks=Nb of opened tasks +NbOfProjects=Nb of projects +TimeSpent=Time spent +RefTask=Ref. task +LabelTask=Label task +NewTimeSpent=New time spent +MyTimeSpent=My time spent Mytasks=My tasks Tasks=Tasks Task=Task diff --git a/htdocs/langs/fr_FR/projects.lang b/htdocs/langs/fr_FR/projects.lang index 6e9fa0c8019..2d90f90f54b 100755 --- a/htdocs/langs/fr_FR/projects.lang +++ b/htdocs/langs/fr_FR/projects.lang @@ -10,10 +10,17 @@ OfficerProject=Responsable du projet ConfirmDeleteAProject=Êtes-vous sûr de vouloir supprimer ce projet ? LastProjects=Les %s derniers projets AllProjects=Tous les projets +ProjectsList=Liste des projets ShowProject=Afficher projet SetProject=Définir projet NoProject=Aucun projet défini NbOpenTasks=Nb Tâches Ouvertes +NbOfProjects=Nombre de projets +TimeSpent=Temps consommé +RefTask=Ref. tâche +LabelTask=Libellé tâche +NewTimeSpent=Nouveau consommé +MyTimeSpent=Mon consommé Mytasks=Mes tâches Tasks=Tâches Task=Tâche diff --git a/htdocs/project.class.php b/htdocs/project.class.php index 3f5143792c9..4417a71bde4 100644 --- a/htdocs/project.class.php +++ b/htdocs/project.class.php @@ -166,32 +166,32 @@ class Project extends CommonObject } } - /* - * - * - * + /** + * \brief Return list of projects + * \param id_societe To filter on a particular third party + * \return array Liste of projects */ function liste_array($id_societe='') { $projets = array(); $sql = "SELECT rowid, title FROM ".MAIN_DB_PREFIX."projet"; - - if (isset($id_societe)) + if (! empty($id_societe)) { - $sql .= " WHERE fk_soc = $id_societe"; + $sql .= " WHERE fk_soc = ".$id_societe; } - if ($this->db->query($sql) ) + $resql=$this->db->query($sql); + if ($resql) { - $nump = $this->db->num_rows(); + $nump = $this->db->num_rows($resql); if ($nump) { $i = 0; while ($i < $nump) { - $obj = $this->db->fetch_object(); + $obj = $this->db->fetch_object($resql); $projets[$obj->rowid] = $obj->title; $i++; @@ -273,10 +273,10 @@ class Project extends CommonObject } /** - * \brief Cr�e une tache dans le projet - * \param user Id utilisateur qui cr�e - * \param title titre de la t�che - * \param parent tache parente + * \brief Create a task into project + * \param user Id user that create + * \param title Title of task + * \param parent Id task parent */ function CreateTask($user, $title, $parent = 0) { @@ -330,18 +330,19 @@ class Project extends CommonObject /** - * \brief Cree une tache dans le projet - * \param user Id utilisateur qui cr�e - * \param title titre de la t�che - * \param parent tache parente + * \brief Cree une tache dans le projet + * \param user Id utilisateur qui cree + * \param title titre de la tache + * \param parent tache parente */ function TaskAddTime($user, $task, $time, $date) { $result = 0; $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task_time (fk_task, task_date, task_duration, fk_user)"; - $sql .= " VALUES (".$task.",'".$this->db->idate($date)."',".$time.", ".$user->id.") ;"; + $sql .= " VALUES (".$task.",'".$this->db->idate($date)."',".$time.", ".$user->id.")"; + dolibarr_syslog("Project::TaskAddTime sql=".$sql, LOG_DEBUG); if ($this->db->query($sql) ) { $task_id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task"); @@ -354,12 +355,13 @@ class Project extends CommonObject $result = -2; } - if ($result ==0) + if ($result == 0) { $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task"; - $sql .= " SET duration_effective = duration_effective + '".ereg_replace(",",".",$time)."'"; + $sql .= " SET duration_effective = duration_effective + '".price2num($time)."'"; $sql .= " WHERE rowid = '".$task."';"; + dolibarr_syslog("Project::TaskAddTime sql=".$sql, LOG_DEBUG); if ($this->db->query($sql) ) { $result = 0; @@ -375,7 +377,12 @@ class Project extends CommonObject return $result; } - + /** + * Enter description here... + * + * @param unknown_type $user + * @return unknown + */ function getTasksRoleForUser($user) { $tasksrole = array(); @@ -406,19 +413,25 @@ class Project extends CommonObject return $tasksrole; } - + /** + * Return list of project - tasks + * + * @return unknown + */ function getTasksArray() { $tasks = array(); - /* Liste des taches dans $tasks */ + /* List of tasks */ - $sql = "SELECT t.rowid, t.title, t.fk_task_parent, t.duration_effective"; - $sql .= " FROM ".MAIN_DB_PREFIX."projet_task as t"; - $sql .= " WHERE t.fk_projet =".$this->id; - $sql .= " ORDER BY t.fk_task_parent"; + $sql = "SELECT p.rowid as projectid, p.ref, p.title,"; + $sql.= " t.rowid, t.title, t.fk_task_parent, t.duration_effective"; + $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid"; + if ($this->id) $sql .= " WHERE t.fk_projet =".$this->id; + $sql.= " ORDER BY p.ref, t.fk_task_parent"; - $var=true; + dolibarr_syslog("Project::getTasksArray sql=".$sql); $resql = $this->db->query($sql); if ($resql) { @@ -427,10 +440,13 @@ class Project extends CommonObject while ($i < $num) { $obj = $this->db->fetch_object($resql); - $tasks[$i]->id = $obj->rowid; - $tasks[$i]->title = $obj->title; - $tasks[$i]->fk_parent = $obj->fk_task_parent; - $tasks[$i]->duration = $obj->duration_effective; + $tasks[$i]->projectid = $obj->projectid; + $tasks[$i]->projectref = $obj->ref; + $tasks[$i]->projectlabel = $obj->title; + $tasks[$i]->id = $obj->rowid; + $tasks[$i]->title = $obj->title; + $tasks[$i]->fk_parent = $obj->fk_task_parent; + $tasks[$i]->duration = $obj->duration_effective; $i++; } $this->db->free(); @@ -443,5 +459,29 @@ class Project extends CommonObject return $tasks; } + /** + * \brief Renvoie nom clicable (avec eventuellement le picto) + * \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul + * \param option Sur quoi pointe le lien + * \return string Chaine avec URL + */ + function getNomUrl($withpicto=0,$option='') + { + global $langs; + + $result=''; + + $lien = ''; + $lienfin=''; + + $picto='project'; + + $label=$langs->trans("ShowProject").': '.$this->ref; + + if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); + if ($withpicto && $withpicto != 2) $result.=' '; + if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin; + return $result; + } } ?> diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index ab659ded27f..bfd3d35e3e6 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -1,6 +1,5 @@ - * Copyright (C) 2005-2006 Regis Houssin * Copyright (C) 2006-2008 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify @@ -19,31 +18,39 @@ */ /** - \file htdocs/projet/activity/index.php + \file htdocs/projet/activity/myactivity.php \ingroup projet - \brief Page activite du module projet + \brief Page activite perso du module projet \version $Id$ */ require("./pre.inc.php"); -if (!$user->rights->projet->lire) accessforbidden(); +$mode=$_REQUEST["mode"]; -/* - * Sécurité accés client - */ + +// Security check +if (!$user->rights->projet->lire) accessforbidden(); if ($user->societe_id > 0) { - $action = ''; $socid = $user->societe_id; } -llxHeader("",$langs->trans("Activity")); +$langs->load("projects"); + + +/* + * View + */ $now = time(); -print_fiche_titre($langs->trans("Activity")); +if ($mode == 'mine') $title=$langs->trans("MyActivity"); +else $title=$langs->trans("Activity"); +llxHeader("",$title); + +print_fiche_titre($title); print ''; print '\n"; $sql = "SELECT p.title, p.rowid, count(t.rowid)"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; -$sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; -$sql .= " , ".MAIN_DB_PREFIX."projet_task as t"; +$sql .= " FROM ".MAIN_DB_PREFIX."projet as p,"; +$sql .= " ".MAIN_DB_PREFIX."projet_task as t"; +if ($mode == 'mine') $sql.= ", ".MAIN_DB_PREFIX."projet_task_actors as pta"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE t.fk_projet = p.rowid"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; - +if ($socid) +{ + $sql .= " AND p.fk_soc = ".$socid; +} +if ($mode == 'mine') $sql.=" AND t.rowid = pta.fk_projet_task"; +if ($mode == 'mine') $sql.=" AND pta.fk_user = ".$user->id; $sql .= " GROUP BY p.rowid"; $var=true; @@ -96,66 +109,36 @@ else } print "
'; @@ -61,12 +68,18 @@ print "
"; -print ''; - -$var=true; - -// Defini les bornes date debut et fin de semaines, mois et annee pour le jour courant -$now=mktime(); -$info=dolibarr_getdate($now); -$daystartw=$now-(($info['wday'] - 1)*24*3600); -$dayendw =$now+((7 - $info['wday'])*24*3600); -$infostartw=dolibarr_getdate($daystartw); -$infoendw =dolibarr_getdate($dayendw); -$datestartw=dolibarr_mktime(0,0,0,$infostartw["mon"],$infostartw["mday"],$infostartw["year"]); -$dateendw=dolibarr_mktime(23,59,59,$infoendw["mon"],$infoendw["mday"],$infoendw["year"]); -$datestartm=dolibarr_mktime(0,0,0,$info["mon"],1,$info["year"]); -$dateendm=dolibarr_mktime(23,59,59,$info["mon"],30,$info["year"]); -$datestarty=dolibarr_mktime(0,0,0,1,1,$info["year"]); -$dateendy=dolibarr_mktime(23,59,59,12,31,$info["year"]); -//print mktime()." - ".gmmktime().'
'; -//print dolibarr_print_date(mktime(0,0,0,1,1,1970),'dayhour')." - ".dolibarr_print_date(gmmktime(0,0,0,1,1,1970),'dayhour').'
'; -//print dolibarr_print_date($datestartw,'dayhour')." - ".dolibarr_print_date($now,'dayhour')." - ".dolibarr_print_date($dateendw,'dayhour').'
'; -//print dolibarr_print_date($datestartm,'dayhour')." - ".dolibarr_print_date($now,'dayhour')." - ".dolibarr_print_date($dateendm,'dayhour').'
'; -//print dolibarr_print_date($datestarty,'dayhour')." - ".dolibarr_print_date($now,'dayhour')." - ".dolibarr_print_date($dateendy,'dayhour').'
'; -//print 'xx '.dolibarr_date('Y-m-d H:i:s',$dateendy); -//print ' zz '.dolibarr_print_date($dateendy,'dayhour'); - -/* Affichage de la liste des projets du mois */ -print ''; +/* Affichage de la liste des projets d'aujourd'hui */ +print '
'; print ''; -print ''; -print ''; +print ''; +print ''; print "\n"; -$sql = "SELECT p.title, p.rowid, sum(tt.task_duration) as total"; -if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; +$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql .= " , ".MAIN_DB_PREFIX."projet_task as t"; $sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt"; -if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE t.fk_projet = p.rowid"; -if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; $sql .= " AND tt.fk_task = t.rowid"; -$sql .= " AND task_date >= '".$db->idate($datestartw)."' AND task_date <= '".$db->idate($dateendw)."'"; +$sql .= " AND tt.fk_user = ".$user->id; +$sql .= " AND date_format(task_date,'%d%m%y') = ".strftime("%d%m%y",time()); $sql .= " GROUP BY p.rowid"; -dolibarr_syslog("Index: sql=".$sql); +$var=true; +$total=0; $resql = $db->query($sql); if ( $resql ) { - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) + while ($row = $db->fetch_row($resql)) { - $obj = $db->fetch_object( $resql); $var=!$var; print ""; - print ''; - print ''; - print "\n"; - $i++; + print ''; + print ''; + print "\n"; + $total += $row[2]; } $db->free($resql); @@ -164,6 +147,99 @@ else { dolibarr_print_error($db); } +print ''; +print ''; +print ''; +print "\n"; +print "
'.$langs->trans("ActivityOnProjectThisWeek").''.$langs->trans("Time").''.$langs->trans('Today').''.$langs->trans("Time").'
'.$obj->title.''.$obj->total.'
'.$row[0].''.$row[2].'
'.$langs->trans('Total').''.$total.'
"; + +/* Affichage de la liste des projets d'hier */ +print '
'; +print ''; +print ''; +print ''; +print "\n"; + +$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)"; +$sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; +$sql .= " , ".MAIN_DB_PREFIX."projet_task as t"; +$sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt"; +$sql .= " WHERE t.fk_projet = p.rowid"; +$sql .= " AND tt.fk_task = t.rowid"; +$sql .= " AND tt.fk_user = ".$user->id; +$sql .= " AND date_format(date_add(task_date, INTERVAL 1 DAY),'%d%m%y') = ".strftime("%d%m%y",time()); +$sql .= " GROUP BY p.rowid"; + +$var=true; +$total=0; +$resql = $db->query($sql); +if ( $resql ) +{ + while ($row = $db->fetch_row($resql)) + { + $var=!$var; + print ""; + print ''; + print ''; + print "\n"; + $total += $row[2]; + } + + $db->free($resql); +} +else +{ + dolibarr_print_error($db); +} +print ''; +print ''; +print ''; +print "\n"; +print "
'.$langs->trans('Yesterday').''.$langs->trans("Time").'
'.$row[0].''.$row[2].'
'.$langs->trans('Total').''.$total.'
"; + +print ''; + +/* Affichage de la liste des projets de la semaine */ +print ''; +print ''; +print ''; +print ''; +print "\n"; + +$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)"; +$sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; +$sql .= " , ".MAIN_DB_PREFIX."projet_task as t"; +$sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt"; +$sql .= " WHERE t.fk_projet = p.rowid"; +$sql .= " AND tt.fk_task = t.rowid"; +$sql .= " AND tt.fk_user = ".$user->id; +$sql .= " AND week(task_date) = ".strftime("%W",time()); +$sql .= " GROUP BY p.rowid"; +$total = 0; +$var=true; +$resql = $db->query($sql); +if ( $resql ) +{ + while ($row = $db->fetch_row( $resql)) + { + $var=!$var; + print ""; + print ''; + print ''; + print "\n"; + $total += $row[2]; + } + + $db->free($resql); +} +else +{ + dolibarr_print_error($db); +} +print ''; +print ''; +print ''; +print "\n"; print "
'.$langs->trans("ActivityOnProjectThisWeek").''.$langs->trans("Time").'
'.$row[0].''.$row[2].'
'.$langs->trans('Total').''.$total.'

"; /* Affichage de la liste des projets du mois */ @@ -173,36 +249,28 @@ print ''.$langs->trans("ActivityOnProjectThisMonth").': '.strftime("%B %Y", print ''.$langs->trans("Time").''; print "\n"; -$sql = "SELECT p.title, p.rowid, sum(tt.task_duration) as total"; -if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; +$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql .= " , ".MAIN_DB_PREFIX."projet_task as t"; $sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt"; -if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE t.fk_projet = p.rowid"; -if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; $sql .= " AND tt.fk_task = t.rowid"; -$sql .= " AND task_date >= '".$db->idate($datestartm)."' AND task_date <= '".$db->idate($dateendm)."'"; +$sql .= " AND tt.fk_user = ".$user->id; +$sql .= " AND month(task_date) = ".strftime("%m",$now); $sql .= " GROUP BY p.rowid"; -$var=true; +$var=false; $resql = $db->query($sql); if ( $resql ) { - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) + while ($row = $db->fetch_row($resql)) { - $obj = $db->fetch_object($resql); - $var=!$var; print ""; - print ''.$obj->title.''; - print ''.$obj->total.''; + print ''.$row[0].''; + print ''.$row[2].''; print "\n"; - $i++; - } - + $var=!$var; + } $db->free($resql); } else @@ -211,43 +279,35 @@ else } print ""; -/* Affichage de la liste des projets du mois */ +/* Affichage de la liste des projets de l'année */ print '
'; print ''; print ''; print ''; print "\n"; -$sql = "SELECT p.title, p.rowid, sum(tt.task_duration) as total"; -if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; +$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql .= " , ".MAIN_DB_PREFIX."projet_task as t"; $sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt"; -if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE t.fk_projet = p.rowid"; -if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; $sql .= " AND tt.fk_task = t.rowid"; -$sql .= " AND task_date >= '".$db->idate($datestarty)."' AND task_date <= '".$db->idate($dateendy)."'"; +$sql .= " AND tt.fk_user = ".$user->id; +$sql .= " AND YEAR(task_date) = ".strftime("%Y",$now); $sql .= " GROUP BY p.rowid"; -$var=true; +$var=false; $resql = $db->query($sql); if ( $resql ) { - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) + while ($row = $db->fetch_row($resql)) { - $obj = $db->fetch_object($resql); - $var=!$var; print ""; - print ''; - print ''; + print ''; + print ''; print "\n"; - $i++; - } - + $var=!$var; + } $db->free($resql); } else diff --git a/htdocs/projet/activity/list.php b/htdocs/projet/activity/list.php new file mode 100644 index 00000000000..637f5b63a57 --- /dev/null +++ b/htdocs/projet/activity/list.php @@ -0,0 +1,215 @@ + + * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2005-2007 Regis Houssin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/** + * \file htdocs/projet/tasks/fiche.php + * \ingroup projet + * \brief Fiche taches d'un projet + * \version $Id$ + */ + +require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php"); + +$mode=$_REQUEST["mode"]; + +$projetid=''; +$projetid=isset($_GET["id"])?$_GET["id"]:$_POST["projetid"]; + +// Security check +if ($user->societe_id) $socid=$user->societe_id; +$result = restrictedArea($user, 'projet', $projetid); + +/* + * Actions + */ + +if ($_POST["action"] == 'createtask' && $user->rights->projet->creer) +{ + $project = new Project($db); + + $result = $project->fetch($_GET["id"]); + + if ($result == 0) + { + $task_parent = $_POST["task_parent"]?$_POST["task_parent"]:0; + $project->CreateTask($user, $_POST["task_name"], $task_parent); + + Header("Location:fiche.php?id=".$project->id); + exit; + } +} + +if ($_POST["action"] == 'addtime' && $user->rights->projet->creer) +{ + foreach ($_POST as $key => $post) + { + //$pro->CreateTask($user, $_POST["task_name"]); + if (substr($key,0,4) == 'task') + { + if ($post > 0) + { + $post=intval($post)+(($post-intval($post))*(1+2/3)); + $post=price2num($post); + + $id = ereg_replace("task","",$key); + + $task=new Task($db); + $task->fetch($id); + + $project = new Project($db); + $result = $project->fetch($task->fk_projet); + + $date = dolibarr_mktime(12,0,0,$_POST["$id"."month"],$_POST["$id"."day"],$_POST["$id"."year"]); + $project->TaskAddTime($user, $id , $post, $date); + } + else + { + if ($post != '') $mesg='
'.$langs->trans("ErrorBadValue").'
'; + } + } + } +} + + +/* + * View + */ + +$form=new Form($db); + +$title=$langs->trans("TimeSpent"); +if ($mode == 'mine') $title=$langs->trans("MyTimeSpent"); + +llxHeader("",$title,""); + +$projet = new Project($db); +if ($_GET["id"]) +{ + $projet->fetch($_GET["id"]); + $projet->societe->fetch($projet->societe->id); +} + + +/* + * Fiche projet en mode visu + * + */ + +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num); + +if ($mesg) print $mesg; + +$tasksrole=$projet->getTasksRoleForUser($user); +$tasksarray=$projet->getTasksArray(); + +print '
'; +print ''; + +print '
'.$langs->trans("ActivityOnProjectThisYear").': '.strftime("%Y", $now).''.$langs->trans("Time").'
'.$obj->title.''.$obj->total.''.$row[0].''.$row[2].'
'; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print "\n"; +PLines($j, 0, $tasksarray, $level, $tasksrole); +print ''; + + +print "
'.$langs->trans("Project").''.$langs->trans("RefTask").''.$langs->trans("LabelTask").''.$langs->trans("TimeSpent").''.$langs->trans("AddDuration").'
"; +print ''; + +$db->close(); + +llxFooter('$Date$ - $Revision$'); + + +function PLines(&$inc, $parent, $lines, &$level, $tasksrole) +{ + global $user, $bc, $langs; + global $form; + + $projectstatic = new Project($db); + + $var=true; + + for ($i = 0 ; $i < sizeof($lines) ; $i++) + { + if ($parent == 0) + $level = 0; + + if ($lines[$i]->fk_parent == $parent) + { + $var = !$var; + print "\n"; + + print ""; + $projectstatic->id=$lines[$i]->projectid; + $projectstatic->ref=$lines[$i]->projectref; + print $projectstatic->getNomUrl(1); + print ""; + + print "".$lines[$i]->id.""; + + print ""; + + for ($k = 0 ; $k < $level ; $k++) + { + print "   "; + } + + print ''.$lines[$i]->title."\n"; + + $heure = intval($lines[$i]->duration); + $minutes = round((($lines[$i]->duration - $heure) * 60),0); + $minutes = substr("00"."$minutes", -2); + + print ''.$heure." h ".$minutes."\n"; + + if ($tasksrole[$lines[$i]->id] == 'admin') + { + print ''; + print ''; + print ' '; + print ''; + print ""; + print $form->select_date('',$lines[$i]->id,'','','',"addtime"); + print ''; + } + else + { + print ' '; + } + print "\n"; + $inc++; + $level++; + if ($lines[$i]->id) PLines($inc, $lines[$i]->id, $lines, $level, $tasksrole); + $level--; + } + else + { + //$level--; + } + } +} + +?> diff --git a/htdocs/projet/activity/myactivity.php b/htdocs/projet/activity/myactivity.php deleted file mode 100644 index 01313518105..00000000000 --- a/htdocs/projet/activity/myactivity.php +++ /dev/null @@ -1,314 +0,0 @@ - - * Copyright (C) 2006-2008 Laurent Destailleur - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/** - \file htdocs/projet/activity/myactivity.php - \ingroup projet - \brief Page activite perso du module projet - \version $Id$ -*/ - -require("./pre.inc.php"); - -if (!$user->rights->projet->lire) accessforbidden(); - -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $socid = $user->societe_id; -} - -$langs->load("projects"); - -llxHeader("",$langs->trans("MyActivity")); - -$now = time(); - -print_fiche_titre($langs->trans("MyActivity")); - -print ''; -print '
'; - -/* - * - * Affichage de la liste des projets - * - */ -print ''; -print ''; -print_liste_field_titre($langs->trans("Project"),$_SERVER["PHP_SELF"],"s.nom","","","",$sortfield,$sortorder); -print ''; -print "\n"; - -$sql = "SELECT p.title, p.rowid, count(t.rowid)"; -if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; -$sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; -$sql .= " , ".MAIN_DB_PREFIX."projet_task as t"; -if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -$sql .= " WHERE t.fk_projet = p.rowid"; -if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($socid) -{ - $sql .= " AND p.fk_soc = ".$socid; -} - -$sql .= " GROUP BY p.rowid"; - -$var=true; -$resql = $db->query($sql); -if ( $resql ) -{ - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $row = $db->fetch_row( $resql); - $var=!$var; - print ""; - print ''; - print ''; - print "\n"; - - $i++; - } - - $db->free($resql); -} -else -{ - dolibarr_print_error($db); -} -print "
'.$langs->trans("NbOpenTasks").'
'.$row[0].''.$row[2].'
"; - -/* Affichage de la liste des projets d'aujourd'hui */ -print '
'; -print ''; -print ''; -print ''; -print "\n"; - -$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)"; -$sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; -$sql .= " , ".MAIN_DB_PREFIX."projet_task as t"; -$sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt"; -$sql .= " WHERE t.fk_projet = p.rowid"; -$sql .= " AND tt.fk_task = t.rowid"; -$sql .= " AND tt.fk_user = ".$user->id; -$sql .= " AND date_format(task_date,'%d%m%y') = ".strftime("%d%m%y",time()); -$sql .= " GROUP BY p.rowid"; - -$var=true; -$total=0; -$resql = $db->query($sql); -if ( $resql ) -{ - while ($row = $db->fetch_row($resql)) - { - $var=!$var; - print ""; - print ''; - print ''; - print "\n"; - $total += $row[2]; - } - - $db->free($resql); -} -else -{ - dolibarr_print_error($db); -} -print ''; -print ''; -print ''; -print "\n"; -print "
'.$langs->trans('Today').''.$langs->trans("Time").'
'.$row[0].''.$row[2].'
'.$langs->trans('Total').''.$total.'
"; - -/* Affichage de la liste des projets d'hier */ -print '
'; -print ''; -print ''; -print ''; -print "\n"; - -$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)"; -$sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; -$sql .= " , ".MAIN_DB_PREFIX."projet_task as t"; -$sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt"; -$sql .= " WHERE t.fk_projet = p.rowid"; -$sql .= " AND tt.fk_task = t.rowid"; -$sql .= " AND tt.fk_user = ".$user->id; -$sql .= " AND date_format(date_add(task_date, INTERVAL 1 DAY),'%d%m%y') = ".strftime("%d%m%y",time()); -$sql .= " GROUP BY p.rowid"; - -$var=true; -$total=0; -$resql = $db->query($sql); -if ( $resql ) -{ - while ($row = $db->fetch_row($resql)) - { - $var=!$var; - print ""; - print ''; - print ''; - print "\n"; - $total += $row[2]; - } - - $db->free($resql); -} -else -{ - dolibarr_print_error($db); -} -print ''; -print ''; -print ''; -print "\n"; -print "
'.$langs->trans('Yesterday').''.$langs->trans("Time").'
'.$row[0].''.$row[2].'
'.$langs->trans('Total').''.$total.'
"; - -print '
'; - -/* Affichage de la liste des projets de la semaine */ -print ''; -print ''; -print ''; -print ''; -print "\n"; - -$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)"; -$sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; -$sql .= " , ".MAIN_DB_PREFIX."projet_task as t"; -$sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt"; -$sql .= " WHERE t.fk_projet = p.rowid"; -$sql .= " AND tt.fk_task = t.rowid"; -$sql .= " AND tt.fk_user = ".$user->id; -$sql .= " AND week(task_date) = ".strftime("%W",time()); -$sql .= " GROUP BY p.rowid"; -$total = 0; -$var=true; -$resql = $db->query($sql); -if ( $resql ) -{ - while ($row = $db->fetch_row( $resql)) - { - $var=!$var; - print ""; - print ''; - print ''; - print "\n"; - $total += $row[2]; - } - - $db->free($resql); -} -else -{ - dolibarr_print_error($db); -} -print ''; -print ''; -print ''; -print "\n"; -print "
'.$langs->trans("ActivityOnProjectThisWeek").''.$langs->trans("Time").'
'.$row[0].''.$row[2].'
'.$langs->trans('Total').''.$total.'

"; - -/* Affichage de la liste des projets du mois */ -print ''; -print ''; -print ''; -print ''; -print "\n"; - -$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)"; -$sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; -$sql .= " , ".MAIN_DB_PREFIX."projet_task as t"; -$sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt"; -$sql .= " WHERE t.fk_projet = p.rowid"; -$sql .= " AND tt.fk_task = t.rowid"; -$sql .= " AND tt.fk_user = ".$user->id; -$sql .= " AND month(task_date) = ".strftime("%m",$now); -$sql .= " GROUP BY p.rowid"; - -$var=false; -$resql = $db->query($sql); -if ( $resql ) -{ - while ($row = $db->fetch_row($resql)) - { - print ""; - print ''; - print ''; - print "\n"; - $var=!$var; - } - $db->free($resql); -} -else -{ - dolibarr_print_error($db); -} -print "
'.$langs->trans("ActivityOnProjectThisMonth").': '.strftime("%B %Y", $now).''.$langs->trans("Time").'
'.$row[0].''.$row[2].'
"; - -/* Affichage de la liste des projets de l'année */ -print '
'; -print ''; -print ''; -print ''; -print "\n"; - -$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)"; -$sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; -$sql .= " , ".MAIN_DB_PREFIX."projet_task as t"; -$sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt"; -$sql .= " WHERE t.fk_projet = p.rowid"; -$sql .= " AND tt.fk_task = t.rowid"; -$sql .= " AND tt.fk_user = ".$user->id; -$sql .= " AND YEAR(task_date) = ".strftime("%Y",$now); -$sql .= " GROUP BY p.rowid"; - -$var=false; -$resql = $db->query($sql); -if ( $resql ) -{ - while ($row = $db->fetch_row($resql)) - { - print ""; - print ''; - print ''; - print "\n"; - $var=!$var; - } - $db->free($resql); -} -else -{ - dolibarr_print_error($db); -} -print "
'.$langs->trans("ActivityOnProjectThisYear").': '.strftime("%Y", $now).''.$langs->trans("Time").'
'.$row[0].''.$row[2].'
"; - -print '
'; - -$db->close(); - -llxFooter('$Date$ - $Revision$'); -?> diff --git a/htdocs/projet/activity/pre.inc.php b/htdocs/projet/activity/pre.inc.php index 436a251011c..ac6f3fe96ef 100644 --- a/htdocs/projet/activity/pre.inc.php +++ b/htdocs/projet/activity/pre.inc.php @@ -14,17 +14,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * */ -/*! - \file htdocs/projet/pre.inc.php - \ingroup projet - \brief Fichier de gestion du menu gauche du module projet - \version $Revision$ +/** + \file htdocs/projet/activity/pre.inc.php + \ingroup projet + \brief Fichier de gestion du menu gauche du module projet + \version $Id$ */ require ("../../main.inc.php"); @@ -34,25 +30,33 @@ require_once(DOL_DOCUMENT_ROOT."/task.class.php"); $langs->load("projects"); $langs->load("companies"); +/** + * Enter description here... + * + * @param unknown_type $head + * @param unknown_type $title + * @param unknown_type $help_url + */ function llxHeader($head = "", $title="", $help_url='') { - global $langs; + global $langs, $user; top_menu($head, $title); $menu = new Menu(); - $menu->add(DOL_URL_ROOT."/comm/clients.php", $langs->trans("Customers")); - - $menu->add(DOL_URL_ROOT."/projet/", $langs->trans("Projects")); - $menu->add_submenu(DOL_URL_ROOT."/projet/liste.php", $langs->trans("List")); - - $menu->add(DOL_URL_ROOT."/projet/tasks/", $langs->trans("Tasks")); - $menu->add_submenu(DOL_URL_ROOT."/projet/tasks/mytasks.php", $langs->trans("Mytasks")); - - $menu->add(DOL_URL_ROOT."/projet/activity/", $langs->trans("Activity")); - $menu->add_submenu(DOL_URL_ROOT."/projet/activity/myactivity.php", $langs->trans("MyActivity")); + $menu->add(DOL_URL_ROOT."/projet/index.php?leftmenu=projects", $langs->trans("Projects"), 0, $user->rights->projet->lire); + $menu->add_submenu(DOL_URL_ROOT."/projet/fiche.php?leftmenu=projects&action=create", $langs->trans("NewProject"), 1, $user->rights->projet->creer); + $menu->add_submenu(DOL_URL_ROOT."/projet/liste.php?leftmenu=projects", $langs->trans("List"), 1, $user->rights->projet->lire); + $menu->add(DOL_URL_ROOT."/projet/tasks/index.php", $langs->trans("Tasks"), 0, $user->rights->projet->lire); + $menu->add_submenu(DOL_URL_ROOT."/projet/tasks/fiche.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer); + $menu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php?mode=mine", $langs->trans("Mytasks"), 1, $user->rights->projet->lire); + + $menu->add(DOL_URL_ROOT."/projet/activity/index.php", $langs->trans("TimeSpent"), 0, $user->rights->projet->lire); + $menu->add_submenu(DOL_URL_ROOT."/projet/activity/list.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer); + $menu->add_submenu(DOL_URL_ROOT."/projet/activity/index.php?mode=mine", $langs->trans("MyTimeSpent"), 1, $user->rights->projet->lire); + left_menu($menu->liste, $help_url); } diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 4095f999dd0..eeaf9c1a10b 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -19,11 +19,11 @@ */ /** - \file htdocs/projet/element.php - \ingroup projet facture - \brief Page des elements par projet - \version $Id$ -*/ + * \file htdocs/projet/element.php + * \ingroup projet facture + * \brief Page des elements par projet + * \version $Id$ + */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); @@ -67,10 +67,14 @@ dolibarr_fiche_head($head, 'element', $langs->trans("Project")); print ''; -print ''; +print ''; + print ''; -print ''; +print ''; print '
'.$langs->trans("Ref").''.$projet->ref.'
'.$langs->trans("Ref").''.$projet->ref.'
'.$langs->trans("Label").''.$projet->title.'
'.$langs->trans("Company").''.$projet->societe->getNomUrl(1,'compta').'
'.$langs->trans("Company").''; +if (! empty($projet->societe->id)) print $projet->societe->getNomUrl(1); +else print ' '; +print '
'; diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php index c90e7c93dbc..346e75dc339 100644 --- a/htdocs/projet/fiche.php +++ b/htdocs/projet/fiche.php @@ -142,7 +142,8 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) print_titre($langs->trans("NewProject")); if ($mesg) print $mesg; - + print '
'; + print '
'; //if ($_REQUEST["socid"]) print ''; print ''; @@ -160,9 +161,6 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) print $html->select_societes($_REQUEST["socid"],'socid','',1); print ''; - // Auteur du projet - print ''; - // Responsable du projet print '\n\n"; - - $heure = intval($lines[$i][3]); - $minutes = (($lines[$i][3] - $heure) * 60); - $minutes = substr("00"."$minutes", -2); - - print '\n"; - print "\n"; - $inc++; - $level++; - PLines($inc, $lines[$i][2], $lines, $level, $var); - $level--; - } - else - { - //$level--; - } - } -} - -llxHeader("",$langs->trans("Mytasks"),"Projet"); /* - * Fiche projet en mode visu - * + * Actions + */ + +if ($_POST["action"] == 'createtask' && $user->rights->projet->creer) +{ + $project = new Project($db); + + $result = $project->fetch($_GET["id"]); + + if ($result == 0) + { + $task_parent = $_POST["task_parent"]?$_POST["task_parent"]:0; + $project->CreateTask($user, $_POST["task_name"], $task_parent); + + Header("Location:fiche.php?id=".$project->id); + } +} + +/* + * View + */ +$form=new Form($db); + +$title=$langs->trans("Tasks"); +if ($mode == 'mine') $title=$langs->trans("Mytasks"); + +llxHeader("",$title,"Projet"); + +/* + * Card */ $h=0; $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/index.php'; -$head[$h][1] = $langs->trans("Tasks"); +$head[$h][1] = $title; +$head[$h][2] = 'tasks'; $h++; -dolibarr_fiche_head($head, $hselected, $langs->trans("Tasks")); +dolibarr_fiche_head($head, 'tasks', $title); /* Liste des tâches */ @@ -95,46 +86,107 @@ $sql .= " , ".MAIN_DB_PREFIX."projet_task_actors as a"; $sql .= " , ".MAIN_DB_PREFIX."projet as p"; $sql .= " WHERE p.rowid = t.fk_projet"; $sql .= " AND a.fk_projet_task = t.rowid"; +if ($mode == 'mine') $sql.= " AND a.fk_user = ".$user->id; $sql .= " ORDER BY p.rowid, t.fk_task_parent"; $resql = $db->query($sql); if ($resql) { - $num = $db->num_rows($resql); - $i = 0; - $tasks = array(); - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $tasks[$i][0] = $obj->title; - $tasks[$i][1] = $obj->fk_task_parent; - $tasks[$i][2] = $obj->rowid; - $tasks[$i][3] = $obj->duration_effective; - $tasks[$i][4] = $obj->ptitle; - $tasks[$i][5] = $obj->prowid; - $i++; - } - $db->free(); + $num = $db->num_rows($resql); + $i = 0; + $tasks = array(); + while ($i < $num) + { + $obj = $db->fetch_object($resql); + $tasks[$i][0] = $obj->title; + $tasks[$i][1] = $obj->fk_task_parent; + $tasks[$i][2] = $obj->rowid; + $tasks[$i][3] = $obj->duration_effective; + $tasks[$i][4] = $obj->ptitle; + $tasks[$i][5] = $obj->prowid; + $i++; + } + $db->free(); } else { - dolibarr_print_error($db); + dolibarr_print_error($db); } print '
'.$langs->trans("Author").''.$user->fullname.'
'.$langs->trans("OfficerProject").''; $html->select_users($projet->user_resp_id,'officer_project',1); @@ -203,7 +201,7 @@ else print ''; // Ref - print ''; + print ''; // Label print ''; @@ -229,7 +227,7 @@ else print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'
'.$langs->trans("Label").'
'; // Ref - print ''; + print ''; // Label print ''; diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index f0b15ea83eb..dc2e2f2f02e 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -16,29 +16,31 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ */ /** - \file htdocs/projet/index.php - \ingroup projet - \brief Page d'accueil du module projet - \version $Revision$ -*/ + * \file htdocs/projet/index.php + * \ingroup projet + * \brief Page d'accueil du module projet + * \version $Id$ + */ require("./pre.inc.php"); $langs->load("projects"); if (!$user->rights->projet->lire) accessforbidden(); -// Sécurité accés client +// Security check if ($user->societe_id > 0) { - $socid = $user->societe_id; + $socid = $user->societe_id; } + +/* + * View + */ + llxHeader("",$langs->trans("Projects"),"Projet"); print_fiche_titre($langs->trans("ProjectsArea")); @@ -109,7 +111,7 @@ print '\n"; - print ""; - print ""; + + print ""; + + print "\n"; - if ($tasksrole[$lines[$i]->id] == 'admin') - { - print ''; - print "'; - } - else - { - print ''; - } print "\n"; $inc++; $level++; - PLines($inc, $lines[$i]->id, $lines, $level, $tasksrole); + if ($lines[$i]->id) PLines($inc, $lines[$i]->id, $lines, $level, $tasksrole); $level--; } else @@ -98,18 +258,21 @@ Function PLines(&$inc, $parent, $lines, &$level, $tasksrole) } } -Function PLineSelect(&$inc, $parent, $lines, &$level) + +function PLineSelect(&$inc, $parent, $lines, &$level) { + global $langs; + for ($i = 0 ; $i < sizeof($lines) ; $i++) { - if ($parent == 0) - $level = 0; + if ($parent == 0) $level = 0; if ($lines[$i]->fk_parent == $parent) { $var = !$var; - print '
'.$langs->trans("Ref").''.$projet->ref.'
'.$langs->trans("Ref").''.$projet->ref.'
'.$langs->trans("Label").''.$projet->title.'
'; print ''; print ''; print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","","",$sortfield,$sortorder); -print ''; +print ''; print "\n"; $sql = "SELECT s.nom, s.rowid as socid, count(p.rowid)"; diff --git a/htdocs/projet/liste.php b/htdocs/projet/liste.php index b7531dfcf32..841f0ca5a4c 100644 --- a/htdocs/projet/liste.php +++ b/htdocs/projet/liste.php @@ -34,7 +34,7 @@ $socid = ( is_numeric($_GET["socid"]) ? $_GET["socid"] : 0 ); $title = $langs->trans("Projects"); -// Sécurité accés client +// Security check if ($user->societe_id > 0) $socid = $user->societe_id; if ($socid > 0) @@ -101,7 +101,7 @@ if ($resql) $num = $db->num_rows($resql); $i = 0; - print_barre_liste($langs->trans("Projects"), $page, "liste.php", "", $sortfield, $sortorder, "", $num); + print_barre_liste($langs->trans("ProjectsList"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num); print '
'.$langs->trans("Nb").''.$langs->trans("NbOfProjects").'
'; print ''; diff --git a/htdocs/projet/pre.inc.php b/htdocs/projet/pre.inc.php index 35f2fb97739..0867eb2351f 100644 --- a/htdocs/projet/pre.inc.php +++ b/htdocs/projet/pre.inc.php @@ -33,26 +33,33 @@ $langs->load("bills"); $langs->load("orders"); $langs->load("commercial"); - +/** + * Enter description here... + * + * @param unknown_type $head + * @param unknown_type $title + * @param unknown_type $help_url + */ function llxHeader($head = "", $title="", $help_url='') { - global $langs; + global $langs, $user; top_menu($head, $title); $menu = new Menu(); - $menu->add(DOL_URL_ROOT."/projet/fiche.php?leftmenu=projects&action=create", $langs->trans("Customers")); - - $menu->add(DOL_URL_ROOT."/projet/", $langs->trans("Projects")); - $menu->add_submenu(DOL_URL_ROOT."/projet/liste.php", $langs->trans("List")); - - $menu->add(DOL_URL_ROOT."/projet/tasks/", $langs->trans("Tasks")); - $menu->add_submenu(DOL_URL_ROOT."/projet/tasks/mytasks.php", $langs->trans("Mytasks")); - - $menu->add(DOL_URL_ROOT."/projet/activity/", $langs->trans("Activity")); - $menu->add_submenu(DOL_URL_ROOT."/projet/activity/myactivity.php", $langs->trans("MyActivity")); + $menu->add(DOL_URL_ROOT."/projet/index.php?leftmenu=projects", $langs->trans("Projects"), 0, $user->rights->projet->lire); + $menu->add_submenu(DOL_URL_ROOT."/projet/fiche.php?leftmenu=projects&action=create", $langs->trans("NewProject"), 1, $user->rights->projet->creer); + $menu->add_submenu(DOL_URL_ROOT."/projet/liste.php?leftmenu=projects", $langs->trans("List"), 1, $user->rights->projet->lire); + $menu->add(DOL_URL_ROOT."/projet/tasks/index.php", $langs->trans("Tasks"), 0, $user->rights->projet->lire); + $menu->add_submenu(DOL_URL_ROOT."/projet/tasks/fiche.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer); + $menu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php?mode=mine", $langs->trans("Mytasks"), 1, $user->rights->projet->lire); + + $menu->add(DOL_URL_ROOT."/projet/activity/index.php", $langs->trans("TimeSpent"), 0, $user->rights->projet->lire); + $menu->add_submenu(DOL_URL_ROOT."/projet/activity/list.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer); + $menu->add_submenu(DOL_URL_ROOT."/projet/activity/index.php?mode=mine", $langs->trans("MyTimeSpent"), 1, $user->rights->projet->lire); + left_menu($menu->liste, $help_url); } ?> diff --git a/htdocs/projet/tasks/fiche.php b/htdocs/projet/tasks/fiche.php index a2155c6064d..fff1ae38539 100644 --- a/htdocs/projet/tasks/fiche.php +++ b/htdocs/projet/tasks/fiche.php @@ -30,20 +30,189 @@ require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php"); $projetid=''; $projetid=isset($_GET["id"])?$_GET["id"]:$_POST["projetid"]; -if ($projetid == '') accessforbidden(); // Security check if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'projet', $projetid); +/* + * Actions + */ -Function PLines(&$inc, $parent, $lines, &$level, $tasksrole) +if ($_POST["action"] == 'createtask' && $user->rights->projet->creer) +{ + $error=0; + + if (empty($_POST["cancel"])) + { + $tmparray=split('_',$_POST['task_parent']); + $projectid=$tmparray[0]; + $task_parent=$tmparray[1]; + if (empty($task_parent)) $task_parent=0; // If task_parent is '' + + //print $_POST['task_parent'].'-'.$projectid.'-'.$task_parent;exit; + $project = new Project($db); + $result = $project->fetch($projectid); + + $result=$project->CreateTask($user, $_POST["task_name"], $task_parent); + } + + if (! $error) + { + Header("Location: ".DOL_URL_ROOT.'/projet/tasks/index.php'); + exit; + } +} + +if ($_POST["action"] == 'addtime' && $user->rights->projet->creer) +{ + $project = new Project($db); + $result = $project->fetch($_GET["id"]); + + if ($result == 0) + { + foreach ($_POST as $key => $post) + { + //$pro->CreateTask($user, $_POST["task_name"]); + if (substr($key,0,4) == 'task') + { + if ($post > 0) + { + $post=intval($post)+(($post-intval($post))*(1+2/3)); + $post=price2num($post); + + $id = ereg_replace("task","",$key); + + $date = dolibarr_mktime(12,0,0,$_POST["$id"."month"],$_POST["$id"."day"],$_POST["$id"."year"]); + $project->TaskAddTime($user, $id , $post, $date); + } + } + } + + Header("Location:fiche.php?id=".$project->id); + exit; + } +} + + +/* + * View + */ +$form=new Form($db); + +llxHeader("",$langs->trans("Tasks"),"Tasks"); + +$projet = new Project($db); +if ($_GET["id"]) +{ + $projet->fetch($_GET["id"]); + $projet->societe->fetch($projet->societe->id); +} + +if ($_GET["action"] == 'create' && $user->rights->projet->creer) +{ + print_titre($langs->trans("NewTask")); + print '
'; + + $tasksarray=$projet->getTasksArray(); + + if ($mesg) print $mesg; + + print ''; + print ''; + + print '
'; + + print ''; + + print ''; + + print '
'.$langs->trans("NewTask").''; + print ' '; + if ($tasksarray) + { + print '   '.$langs->trans("ChildOfTaks").'   '; + + print ''; + } + print '
'; + print ''; + print '     '; + print ''; + print '
'; + print ''; + +} +else +{ + /* + * Fiche projet en mode visu + * + */ + + $head=project_prepare_head($projet); + dolibarr_fiche_head($head, 'tasks', $langs->trans("Project")); + + + print ''; + + print ''; + print ''; + + print ''; + + $tasksrole=$projet->getTasksRoleForUser($user); + + $tasksarray=$projet->getTasksArray(); + + print '
'.$langs->trans("Ref").''.$projet->ref.'
'.$langs->trans("Label").''.$projet->title.'
'.$langs->trans("Company").''; + if (! empty($projet->societe->id)) print $projet->societe->getNomUrl(1); + else print ' '; + print '
'; + print '
'; + + print '
'; + print ''; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + PLines($j, 0, $tasksarray, $level, $tasksrole); + print ''; + + + print "
'.$langs->trans("Project").''.$langs->trans("RefTask").''.$langs->trans("LabelTask").''.$langs->trans("TimeSpent").'
"; + print ''; + + + /* + * Actions + */ + print '
'; + print ''.$langs->trans('AddTask').''; + print '
'; +} + +$db->close(); + +llxFooter('$Date$ - $Revision$'); + + +function PLines(&$inc, $parent, $lines, &$level, $tasksrole) { - $form = new Form($db); // $db est null ici mais inutile pour la fonction select_date() global $user, $bc, $langs; - $var=true; + $projectstatic = new Project($db); + $var=true; + for ($i = 0 ; $i < sizeof($lines) ; $i++) { if ($parent == 0) @@ -54,10 +223,15 @@ Function PLines(&$inc, $parent, $lines, &$level, $tasksrole) $var = !$var; print "
".$lines[$i]->id.""; - + $projectstatic->id=$lines[$i]->projectid; + $projectstatic->ref=$lines[$i]->projectref; + print $projectstatic->getNomUrl(1); + print "".$lines[$i]->id.""; for ($k = 0 ; $k < $level ; $k++) { print "   "; @@ -71,24 +245,10 @@ Function PLines(&$inc, $parent, $lines, &$level, $tasksrole) print ''.$heure." h ".$minutes."'; - print ''; - print ' '; - print '"; - print $form->select_date('',$lines[$i]->id,'','','',"addtime"); - print ' 
'; - - print ''; - - print '
'.$langs->trans("NewTask").''; - print ' '; - if ($tasksarray) - { - print '   '.$langs->trans("ChildOfTaks").'   '; - - print ''; - } - print '   '; - print '
'; - print ''; - -} else { - - /* - * Fiche projet en mode visu - * - */ - - $head=project_prepare_head($projet); - dolibarr_fiche_head($head, 'tasks', $langs->trans("Project")); - - - print ''; - - print ''; - print ''; - - print ''; - - $tasksrole=$projet->getTasksRoleForUser($user); - - $tasksarray=$projet->getTasksArray(); - - print '
'.$langs->trans("Ref").''.$projet->ref.'
'.$langs->trans("Label").''.$projet->title.'
'.$langs->trans("Company").''.$projet->societe->getNomUrl(1).'
'; - print '
'; - - print '
'; - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - PLines($j, 0, $tasksarray, $level, $tasksrole); - print ''; - - - print "
'.$langs->trans("ID").''.$langs->trans("Task").''.$langs->trans("DurationEffective").''.$langs->trans("AddDuration").'
"; - print ''; - - - /* - * Actions - */ - print '
'; - print ''.$langs->trans('AddTask').''; - print '
'; -} - -$db->close(); - -llxFooter('$Date$ - $Revision$'); ?> diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php index 93492e9b7ee..753123f29b5 100644 --- a/htdocs/projet/tasks/index.php +++ b/htdocs/projet/tasks/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2006-2008 Laurent Destailleur - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -18,73 +18,64 @@ */ /** - \file htdocs/projet/tasks/mytasks.php - \ingroup projet - \brief Fiche tâches d'un projet - \version $Id$ -*/ + \file htdocs/projet/tasks/index.php + \ingroup project + \brief Fiche tâches d'un projet + \version $Id$ + */ require("./pre.inc.php"); -if (!$user->rights->projet->lire) accessforbidden(); +$mode=$_REQUEST["mode"]; $langs->load('projects'); -Function PLines(&$inc, $parent, $lines, &$level, &$var) -{ - $form = new Form($db); // $db est null ici mais inutile pour la fonction select_date() - global $bc, $langs; - for ($i = 0 ; $i < sizeof($lines) ; $i++) - { - if ($parent == 0) - { - $level = 0; - $var = !$var; - } +// Security check +if (!$user->rights->projet->lire) accessforbidden(); +$socid=0; +if ($user->societe_id > 0) $socid = $user->societe_id; - if ($lines[$i][1] == $parent) - { - print "
"; - print ''.$lines[$i][4]."\n"; - - for ($k = 0 ; $k < $level ; $k++) - { - print "   "; - } - - print ''.$lines[$i][0]."'.$heure." h ".$minutes."
'; print ''; print ''; print ''; -print ''; -print "\n"; +print ''; +print "\n"; $var=true; PLines($j, 0, $tasks, $level, $var); -print "
'.$langs->trans("Project").''.$langs->trans("Task").''.$langs->trans("DurationEffective").'
'.$langs->trans("TimeSpent").'
"; +print ""; print ''; + +/* + * Actions + */ +print '
'; +print ''.$langs->trans('AddTask').''; +print '
'; + + + $db->close(); llxFooter('$Date$ - $Revision$'); + + + +Function PLines(&$inc, $parent, $lines, &$level, &$var) +{ + global $db; + global $bc, $langs; + + $projectstatic=new Project($db); + + for ($i = 0 ; $i < sizeof($lines) ; $i++) + { + if ($parent == 0) + { + $level = 0; + $var = !$var; + } + + if ($lines[$i][1] == $parent) + { + print "\n"; + $projectstatic->id=$lines[$i][5]; + $projectstatic->ref=$lines[$i][4]; + print $projectstatic->getNomUrl(1); + print "\n"; + + for ($k = 0 ; $k < $level ; $k++) + { + print "   "; + } + + print ''.$lines[$i][0]."\n"; + + $heure = intval($lines[$i][3]); + $minutes = (($lines[$i][3] - $heure) * 60); + $minutes = substr("00"."$minutes", -2); + + print ''.$heure." h ".$minutes."\n"; + print "\n"; + $inc++; + $level++; + PLines($inc, $lines[$i][2], $lines, $level, $var); + $level--; + } + else + { + //$level--; + } + } +} ?> diff --git a/htdocs/projet/tasks/mytasks.php b/htdocs/projet/tasks/mytasks.php deleted file mode 100644 index 3e491cc2f40..00000000000 --- a/htdocs/projet/tasks/mytasks.php +++ /dev/null @@ -1,141 +0,0 @@ - - * Copyright (C) 2006-2008 Laurent Destailleur - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/** - \file htdocs/projet/tasks/mytasks.php - \ingroup projet - \brief Fiche tâches d'un projet - \version $Id$ -*/ - -require("./pre.inc.php"); - -if (!$user->rights->projet->lire) accessforbidden(); - -$langs->load('projects'); - -Function PLines(&$inc, $parent, $lines, &$level, &$var) -{ - $form = new Form($db); // $db est null ici mais inutile pour la fonction select_date() - global $bc, $langs; - for ($i = 0 ; $i < sizeof($lines) ; $i++) - { - if ($parent == 0) - { - $level = 0; - $var = !$var; - } - - if ($lines[$i][1] == $parent) - { - print "\n"; - print ''.$lines[$i][4]."\n"; - - for ($k = 0 ; $k < $level ; $k++) - { - print "   "; - } - - print ''.$lines[$i][0]."\n"; - - $heure = intval($lines[$i][3]); - $minutes = (($lines[$i][3] - $heure) * 60); - $minutes = substr("00"."$minutes", -2); - - print ''.$heure." h ".$minutes."\n"; - print "\n"; - $inc++; - $level++; - PLines($inc, $lines[$i][2], $lines, $level, $var); - $level--; - } - else - { - //$level--; - } - } -} - -llxHeader("",$langs->trans("Mytasks"),"Projet"); - -/* - * Fiche projet en mode visu - * - */ - -$h=0; -$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/mytasks.php'; -$head[$h][1] = $langs->trans("Mytasks"); -$h++; - -dolibarr_fiche_head($head, $hselected, $langs->trans("Mytasks")); - -/* Liste des tâches */ - -$sql = "SELECT t.rowid, t.title, t.fk_task_parent, t.duration_effective"; -$sql .= " , p.rowid as prowid, p.title as ptitle"; -$sql .= " FROM ".MAIN_DB_PREFIX."projet_task as t"; -$sql .= " , ".MAIN_DB_PREFIX."projet_task_actors as a"; -$sql .= " , ".MAIN_DB_PREFIX."projet as p"; -$sql .= " WHERE p.rowid = t.fk_projet"; -$sql .= " AND a.fk_projet_task = t.rowid"; -$sql .= " AND a.fk_user = ".$user->id; -$sql .= " ORDER BY p.rowid, t.fk_task_parent"; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - $tasks = array(); - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $tasks[$i][0] = $obj->title; - $tasks[$i][1] = $obj->fk_task_parent; - $tasks[$i][2] = $obj->rowid; - $tasks[$i][3] = $obj->duration_effective; - $tasks[$i][4] = $obj->ptitle; - $tasks[$i][5] = $obj->prowid; - $i++; - } - $db->free(); -} -else -{ - dolibarr_print_error($db); -} - -print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; -$var=true; - -PLines($j, 0, $tasks, $level, $var); - -print "
'.$langs->trans("Project").''.$langs->trans("Task").''.$langs->trans("DurationEffective").'
"; -print ''; - -$db->close(); - -llxFooter('$Date$ - $Revision$'); -?> diff --git a/htdocs/projet/tasks/pre.inc.php b/htdocs/projet/tasks/pre.inc.php index ec43611942d..6f5156f94f7 100644 --- a/htdocs/projet/tasks/pre.inc.php +++ b/htdocs/projet/tasks/pre.inc.php @@ -14,15 +14,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ */ /** \file htdocs/projet/tasks/pre.inc.php \ingroup projet \brief Fichier de gestion du menu gauche du module projet - \version $Revision$ + \version $Id$ */ require ("../../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/project.class.php"); @@ -31,25 +29,33 @@ require_once(DOL_DOCUMENT_ROOT."/task.class.php"); $langs->load("projects"); $langs->load("companies"); +/** + * Enter description here... + * + * @param unknown_type $head + * @param unknown_type $title + * @param unknown_type $help_url + */ function llxHeader($head = "", $title="", $help_url='') { - global $langs; + global $langs, $user; top_menu($head, $title); $menu = new Menu(); - $menu->add(DOL_URL_ROOT."/comm/clients.php", $langs->trans("Customers")); - - $menu->add(DOL_URL_ROOT."/projet/", $langs->trans("Projects")); - $menu->add_submenu(DOL_URL_ROOT."/projet/liste.php", $langs->trans("List")); - - $menu->add(DOL_URL_ROOT."/projet/tasks/", $langs->trans("Tasks")); - $menu->add_submenu(DOL_URL_ROOT."/projet/tasks/mytasks.php", $langs->trans("Mytasks")); - - $menu->add(DOL_URL_ROOT."/projet/activity/", $langs->trans("Activity")); - $menu->add_submenu(DOL_URL_ROOT."/projet/activity/myactivity.php", $langs->trans("MyActivity")); + $menu->add(DOL_URL_ROOT."/projet/index.php?leftmenu=projects", $langs->trans("Projects"), 0, $user->rights->projet->lire); + $menu->add_submenu(DOL_URL_ROOT."/projet/fiche.php?leftmenu=projects&action=create", $langs->trans("NewProject"), 1, $user->rights->projet->creer); + $menu->add_submenu(DOL_URL_ROOT."/projet/liste.php?leftmenu=projects", $langs->trans("List"), 1, $user->rights->projet->lire); + $menu->add(DOL_URL_ROOT."/projet/tasks/index.php", $langs->trans("Tasks"), 0, $user->rights->projet->lire); + $menu->add_submenu(DOL_URL_ROOT."/projet/tasks/fiche.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer); + $menu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php?mode=mine", $langs->trans("Mytasks"), 1, $user->rights->projet->lire); + + $menu->add(DOL_URL_ROOT."/projet/activity/index.php", $langs->trans("TimeSpent"), 0, $user->rights->projet->lire); + $menu->add_submenu(DOL_URL_ROOT."/projet/activity/list.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer); + $menu->add_submenu(DOL_URL_ROOT."/projet/activity/index.php?mode=mine", $langs->trans("MyTimeSpent"), 1, $user->rights->projet->lire); + left_menu($menu->liste, $help_url); } diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 28656b32afb..69740a6d1f8 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -1,7 +1,7 @@ * Copyright (C) 2006-2008 Laurent Destailleur - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -18,10 +18,10 @@ */ /** - \file htdocs/projet/tasks/task.php - \ingroup projet - \brief Fiche tâches d'un projet - \version $Id$ + * \file htdocs/projet/tasks/task.php + * \ingroup projet + * \brief Fiche tâches d'un projet + * \version $Id$ */ require("./pre.inc.php"); @@ -29,12 +29,16 @@ require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php"); if (!$user->rights->projet->lire) accessforbidden(); + /* * View */ llxHeader("",$langs->trans("Task")); +$projectstatic = new Project($db); + + if ($_GET["id"] > 0) { /* @@ -63,11 +67,14 @@ if ($_GET["id"] > 0) print ''; print ''; - print ''; - print ''; + print ''; + print ''; + + print ''; print ''; - print ''; /* Liste des tâches */ @@ -87,15 +94,15 @@ if ($_GET["id"] > 0) $tasks = array(); while ($i < $num) { - $row = $db->fetch_row($resql); - $tasks[$i] = $row; - $i++; - } - $db->free(); + $row = $db->fetch_row($resql); + $tasks[$i] = $row; + $i++; + } + $db->free(); } else { - dolibarr_print_error($db); + dolibarr_print_error($db); } @@ -106,18 +113,18 @@ if ($_GET["id"] > 0) print '
'.$langs->trans("Ref").''.$projet->ref.'
'.$langs->trans("Label").''.$projet->title.'
'.$langs->trans("Ref").''.$task->id.'
'.$langs->trans("Label").''.$task->title.'
'.$langs->trans("Project").''; + print $projet->getNomUrl(1); + print '
'.$langs->trans("Company").''.$projet->societe->getNomUrl(1).'
'.$langs->trans("Task").''.$task->title.'
'; print ''; print ''; - print ''; + print ''; print ''; print "\n"; foreach ($tasks as $task_time) { $var=!$var; - print ""; - print ''; - print ''; - print ''; - print "\n"; + print ""; + print ''; + print ''; + print ''; + print "\n"; } print "
'.$langs->trans("Date").''.$langs->trans("DurationEffective").''.$langs->trans("TimeSpent").''.$langs->trans("User").'
'.dolibarr_print_date($task_time[0]).''.$task_time[1].''.$task_time[3].'
'.dolibarr_print_date($task_time[0],'day').''.$task_time[1].''.$task_time[3].'
";