New: Some enhancements in project module
This commit is contained in:
parent
e58a61d588
commit
90a73faaad
@ -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='')
|
||||
{
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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<EFBFBD>e une tache dans le projet
|
||||
* \param user Id utilisateur qui cr<EFBFBD>e
|
||||
* \param title titre de la t<EFBFBD>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<EFBFBD>e
|
||||
* \param title titre de la t<EFBFBD>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 = '<a href="'.DOL_URL_ROOT.'/projet/fiche.php?id='.$this->id.'">';
|
||||
$lienfin='</a>';
|
||||
|
||||
$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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2006 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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 '<table border="0" width="100%" class="notopnoleftnoright">';
|
||||
print '<tr><td width="30%" valign="top" class="notopnoleft">';
|
||||
@ -61,12 +68,18 @@ print "</tr>\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 "</table>";
|
||||
|
||||
print '</td><td width="70%" valign="top" class="notopnoleft">';
|
||||
|
||||
$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().'<br>';
|
||||
//print dolibarr_print_date(mktime(0,0,0,1,1,1970),'dayhour')." - ".dolibarr_print_date(gmmktime(0,0,0,1,1,1970),'dayhour').'<br>';
|
||||
//print dolibarr_print_date($datestartw,'dayhour')." - ".dolibarr_print_date($now,'dayhour')." - ".dolibarr_print_date($dateendw,'dayhour').'<br>';
|
||||
//print dolibarr_print_date($datestartm,'dayhour')." - ".dolibarr_print_date($now,'dayhour')." - ".dolibarr_print_date($dateendm,'dayhour').'<br>';
|
||||
//print dolibarr_print_date($datestarty,'dayhour')." - ".dolibarr_print_date($now,'dayhour')." - ".dolibarr_print_date($dateendy,'dayhour').'<br>';
|
||||
//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 '<table class="noborder" width="100%">';
|
||||
/* Affichage de la liste des projets d'aujourd'hui */
|
||||
print '<br /><table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td >'.$langs->trans("ActivityOnProjectThisWeek").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Time").'</td>';
|
||||
print '<td width="50%">'.$langs->trans('Today').'</td>';
|
||||
print '<td width="50%" align="right">'.$langs->trans("Time").'</td>';
|
||||
print "</tr>\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 "<tr $bc[$var]>";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$obj->rowid.'">'.$obj->title.'</a></td>';
|
||||
print '<td align="right">'.$obj->total.'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
|
||||
print '<td align="right">'.$row[2].'</td>';
|
||||
print "</tr>\n";
|
||||
$total += $row[2];
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
@ -164,6 +147,99 @@ else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print '<tr class="liste_total">';
|
||||
print '<td>'.$langs->trans('Total').'</td>';
|
||||
print '<td align="right">'.$total.'</td>';
|
||||
print "</tr>\n";
|
||||
print "</table>";
|
||||
|
||||
/* Affichage de la liste des projets d'hier */
|
||||
print '<br /><table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans('Yesterday').'</td>';
|
||||
print '<td align="right">'.$langs->trans("Time").'</td>';
|
||||
print "</tr>\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 "<tr $bc[$var]>";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
|
||||
print '<td align="right">'.$row[2].'</td>';
|
||||
print "</tr>\n";
|
||||
$total += $row[2];
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print '<tr class="liste_total">';
|
||||
print '<td>'.$langs->trans('Total').'</td>';
|
||||
print '<td align="right">'.$total.'</td>';
|
||||
print "</tr>\n";
|
||||
print "</table>";
|
||||
|
||||
print '</td><td width="70%" valign="top" class="notopnoleft">';
|
||||
|
||||
/* Affichage de la liste des projets de la semaine */
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("ActivityOnProjectThisWeek").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Time").'</td>';
|
||||
print "</tr>\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 "<tr ".$bc[$var].">";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
|
||||
print '<td align="right">'.$row[2].'</td>';
|
||||
print "</tr>\n";
|
||||
$total += $row[2];
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print '<tr class="liste_total">';
|
||||
print '<td>'.$langs->trans('Total').'</td>';
|
||||
print '<td align="right">'.$total.'</td>';
|
||||
print "</tr>\n";
|
||||
print "</table><br />";
|
||||
|
||||
/* Affichage de la liste des projets du mois */
|
||||
@ -173,36 +249,28 @@ print '<td>'.$langs->trans("ActivityOnProjectThisMonth").': '.strftime("%B %Y",
|
||||
print '<td align="right">'.$langs->trans("Time").'</td>';
|
||||
print "</tr>\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 "<tr $bc[$var]>";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$obj->rowid.'">'.$obj->title.'</a></td>';
|
||||
print '<td align="right">'.$obj->total.'</td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
|
||||
print '<td align="right">'.$row[2].'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
@ -211,43 +279,35 @@ else
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
/* Affichage de la liste des projets du mois */
|
||||
/* Affichage de la liste des projets de l'année */
|
||||
print '<br /><table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("ActivityOnProjectThisYear").': '.strftime("%Y", $now).'</td>';
|
||||
print '<td align="right">'.$langs->trans("Time").'</td>';
|
||||
print "</tr>\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 "<tr $bc[$var]>";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$obj->rowid.'">'.$obj->title.'</a></td>';
|
||||
print '<td align="right">'.$obj->total.'</td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
|
||||
print '<td align="right">'.$row[2].'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
|
||||
215
htdocs/projet/activity/list.php
Normal file
215
htdocs/projet/activity/list.php
Normal file
@ -0,0 +1,215 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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='<div class="error">'.$langs->trans("ErrorBadValue").'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 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 '<form name="addtime" method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$projet->id.'">';
|
||||
print '<input type="hidden" name="action" value="addtime">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Project").'</td>';
|
||||
print '<td>'.$langs->trans("RefTask").'</td>';
|
||||
print '<td>'.$langs->trans("LabelTask").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
|
||||
print '<td colspan="2">'.$langs->trans("AddDuration").'</td>';
|
||||
print "</tr>\n";
|
||||
PLines($j, 0, $tasksarray, $level, $tasksrole);
|
||||
print '</form>';
|
||||
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
$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 "<tr $bc[$var]>\n";
|
||||
|
||||
print "<td>";
|
||||
$projectstatic->id=$lines[$i]->projectid;
|
||||
$projectstatic->ref=$lines[$i]->projectref;
|
||||
print $projectstatic->getNomUrl(1);
|
||||
print "</td>";
|
||||
|
||||
print "<td>".$lines[$i]->id."</td>";
|
||||
|
||||
print "<td>";
|
||||
|
||||
for ($k = 0 ; $k < $level ; $k++)
|
||||
{
|
||||
print " ";
|
||||
}
|
||||
|
||||
print '<a href="'.DOL_URL_ROOT.'/projet/tasks/task.php?id='.$lines[$i]->id.'">'.$lines[$i]->title."</a></td>\n";
|
||||
|
||||
$heure = intval($lines[$i]->duration);
|
||||
$minutes = round((($lines[$i]->duration - $heure) * 60),0);
|
||||
$minutes = substr("00"."$minutes", -2);
|
||||
|
||||
print '<td align="right">'.$heure." h ".$minutes."</td>\n";
|
||||
|
||||
if ($tasksrole[$lines[$i]->id] == 'admin')
|
||||
{
|
||||
print '<td>';
|
||||
print '<input size="4" type="text" class="flat" name="task'.$lines[$i]->id.'" value="">';
|
||||
print ' <input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||
print '</td>';
|
||||
print "<td>";
|
||||
print $form->select_date('',$lines[$i]->id,'','','',"addtime");
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td colspan="2"> </td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
$inc++;
|
||||
$level++;
|
||||
if ($lines[$i]->id) PLines($inc, $lines[$i]->id, $lines, $level, $tasksrole);
|
||||
$level--;
|
||||
}
|
||||
else
|
||||
{
|
||||
//$level--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,314 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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 '<table border="0" width="100%" class="notopnoleftnoright">';
|
||||
print '<tr><td width="30%" valign="top" class="notopnoleft">';
|
||||
|
||||
/*
|
||||
*
|
||||
* Affichage de la liste des projets
|
||||
*
|
||||
*/
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Project"),$_SERVER["PHP_SELF"],"s.nom","","","",$sortfield,$sortorder);
|
||||
print '<td align="right">'.$langs->trans("NbOpenTasks").'</td>';
|
||||
print "</tr>\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 "<tr $bc[$var]>";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
|
||||
print '<td align="right">'.$row[2].'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
/* Affichage de la liste des projets d'aujourd'hui */
|
||||
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>';
|
||||
print "</tr>\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 "<tr $bc[$var]>";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
|
||||
print '<td align="right">'.$row[2].'</td>';
|
||||
print "</tr>\n";
|
||||
$total += $row[2];
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print '<tr class="liste_total">';
|
||||
print '<td>'.$langs->trans('Total').'</td>';
|
||||
print '<td align="right">'.$total.'</td>';
|
||||
print "</tr>\n";
|
||||
print "</table>";
|
||||
|
||||
/* Affichage de la liste des projets d'hier */
|
||||
print '<br /><table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="50%">'.$langs->trans('Yesterday').'</td>';
|
||||
print '<td width="50%" align="center">'.$langs->trans("Time").'</td>';
|
||||
print "</tr>\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 "<tr $bc[$var]>";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
|
||||
print '<td align="right">'.$row[2].'</td>';
|
||||
print "</tr>\n";
|
||||
$total += $row[2];
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print '<tr class="liste_total">';
|
||||
print '<td>'.$langs->trans('Total').'</td>';
|
||||
print '<td align="right">'.$total.'</td>';
|
||||
print "</tr>\n";
|
||||
print "</table>";
|
||||
|
||||
print '</td><td width="70%" valign="top" class="notopnoleft">';
|
||||
|
||||
/* Affichage de la liste des projets de la semaine */
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("ActivityOnProjectThisWeek").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Time").'</td>';
|
||||
print "</tr>\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 "<tr ".$bc[$var].">";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
|
||||
print '<td align="right">'.$row[2].'</td>';
|
||||
print "</tr>\n";
|
||||
$total += $row[2];
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print '<tr class="liste_total">';
|
||||
print '<td>'.$langs->trans('Total').'</td>';
|
||||
print '<td align="right">'.$total.'</td>';
|
||||
print "</tr>\n";
|
||||
print "</table><br />";
|
||||
|
||||
/* Affichage de la liste des projets du mois */
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("ActivityOnProjectThisMonth").': '.strftime("%B %Y", $now).'</td>';
|
||||
print '<td align="right">'.$langs->trans("Time").'</td>';
|
||||
print "</tr>\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 "<tr $bc[$var]>";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
|
||||
print '<td align="right">'.$row[2].'</td>';
|
||||
print "</tr>\n";
|
||||
$var=!$var;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
/* Affichage de la liste des projets de l'année */
|
||||
print '<br /><table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("ActivityOnProjectThisYear").': '.strftime("%Y", $now).'</td>';
|
||||
print '<td align="right">'.$langs->trans("Time").'</td>';
|
||||
print "</tr>\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 "<tr $bc[$var]>";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
|
||||
print '<td align="right">'.$row[2].'</td>';
|
||||
print "</tr>\n";
|
||||
$var=!$var;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
print '</td></tr></table>';
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -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 '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Ref").'</td><td>'.$projet->ref.'</td></tr>';
|
||||
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td>'.$projet->ref.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projet->title.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td>'.$projet->societe->getNomUrl(1,'compta').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td>';
|
||||
if (! empty($projet->societe->id)) print $projet->societe->getNomUrl(1);
|
||||
else print ' ';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
@ -142,7 +142,8 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
|
||||
print_titre($langs->trans("NewProject"));
|
||||
|
||||
if ($mesg) print $mesg;
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
//if ($_REQUEST["socid"]) print '<input type="hidden" name="socid" value="'.$_REQUEST["socid"].'">';
|
||||
print '<table class="border" width="100%">';
|
||||
@ -160,9 +161,6 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
|
||||
print $html->select_societes($_REQUEST["socid"],'socid','',1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Auteur du projet
|
||||
print '<tr><td>'.$langs->trans("Author").'</td><td>'.$user->fullname.'</td></tr>';
|
||||
|
||||
// Responsable du projet
|
||||
print '<tr><td>'.$langs->trans("OfficerProject").'</td><td>';
|
||||
$html->select_users($projet->user_resp_id,'officer_project',1);
|
||||
@ -203,7 +201,7 @@ else
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td><input size="8" name="ref" value="'.$projet->ref.'"></td></tr>';
|
||||
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td><input size="8" name="ref" value="'.$projet->ref.'"></td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td><input size="30" name="title" value="'.$projet->title.'"></td></tr>';
|
||||
@ -229,7 +227,7 @@ else
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td>'.$projet->ref.'</td></tr>';
|
||||
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td>'.$projet->ref.'</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projet->title.'</td></tr>';
|
||||
|
||||
@ -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 '</td><td width="70%" valign="top" class="notopnoleft">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","","",$sortfield,$sortorder);
|
||||
print '<td align="right">'.$langs->trans("Nb").'</td>';
|
||||
print '<td align="right">'.$langs->trans("NbOfProjects").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid as socid, count(p.rowid)";
|
||||
|
||||
@ -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 '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
@ -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);
|
||||
}
|
||||
?>
|
||||
|
||||
@ -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 '<br>';
|
||||
|
||||
$tasksarray=$projet->getTasksArray();
|
||||
|
||||
if ($mesg) print $mesg;
|
||||
|
||||
print '<form action="fiche.php" method="post">';
|
||||
print '<input type="hidden" name="action" value="createtask">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td>'.$langs->trans("NewTask").'</td><td colspan="3">';
|
||||
print '<input type="text" size="25" name="task_name" class="flat"> ';
|
||||
if ($tasksarray)
|
||||
{
|
||||
print ' '.$langs->trans("ChildOfTaks").' ';
|
||||
|
||||
print '<select class="flat" name="task_parent">';
|
||||
print '<option value="0" selected="true"> </option>';
|
||||
PLineSelect($j, 0, $tasksarray, $level);
|
||||
print '</select>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td colspan="4" align="center">';
|
||||
print '<input type="submit" class="button" name="add" value="'.$langs->trans("Add").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Fiche projet en mode visu
|
||||
*
|
||||
*/
|
||||
|
||||
$head=project_prepare_head($projet);
|
||||
dolibarr_fiche_head($head, 'tasks', $langs->trans("Project"));
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td>'.$projet->ref.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projet->title.'</td></tr>';
|
||||
|
||||
print '<td>'.$langs->trans("Company").'</td><td>';
|
||||
if (! empty($projet->societe->id)) print $projet->societe->getNomUrl(1);
|
||||
else print ' ';
|
||||
print '</td></tr>';
|
||||
|
||||
$tasksrole=$projet->getTasksRoleForUser($user);
|
||||
|
||||
$tasksarray=$projet->getTasksArray();
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
print '<form name="addtime" method="POST" action="fiche.php?id='.$projet->id.'">';
|
||||
print '<input type="hidden" name="action" value="addtime">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Project").'</td>';
|
||||
print '<td>'.$langs->trans("RefTask").'</td>';
|
||||
print '<td>'.$langs->trans("LabelTask").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
|
||||
print "</tr>\n";
|
||||
PLines($j, 0, $tasksarray, $level, $tasksrole);
|
||||
print '</form>';
|
||||
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$projet->id.'&action=create">'.$langs->trans('AddTask').'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
$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 "<tr $bc[$var]>\n";
|
||||
|
||||
print "<td>".$lines[$i]->id."</td>";
|
||||
|
||||
print "<td>";
|
||||
|
||||
$projectstatic->id=$lines[$i]->projectid;
|
||||
$projectstatic->ref=$lines[$i]->projectref;
|
||||
print $projectstatic->getNomUrl(1);
|
||||
print "</td>";
|
||||
|
||||
print "<td>".$lines[$i]->id."</td>";
|
||||
|
||||
print "<td>";
|
||||
for ($k = 0 ; $k < $level ; $k++)
|
||||
{
|
||||
print " ";
|
||||
@ -71,24 +245,10 @@ Function PLines(&$inc, $parent, $lines, &$level, $tasksrole)
|
||||
|
||||
print '<td align="right">'.$heure." h ".$minutes."</td>\n";
|
||||
|
||||
if ($tasksrole[$lines[$i]->id] == 'admin')
|
||||
{
|
||||
print '<td>';
|
||||
print '<input size="4" type="text" class="flat" name="task'.$lines[$i]->id.'" value="">';
|
||||
print ' <input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||
print '</td>';
|
||||
print "<td>";
|
||||
print $form->select_date('',$lines[$i]->id,'','','',"addtime");
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td colspan="2"> </td>';
|
||||
}
|
||||
print "</tr>\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 '<option value="'.$lines[$i]->id.'">';
|
||||
|
||||
print '<option value="'.$lines[$i]->projectid.'_'.$lines[$i]->id.'">';
|
||||
print $langs->trans("Project").' '.$lines[$i]->projectref;
|
||||
if ($lines[$i]->id) print ' > ';
|
||||
for ($k = 0 ; $k < $level ; $k++)
|
||||
{
|
||||
print " ";
|
||||
@ -119,150 +282,9 @@ Function PLineSelect(&$inc, $parent, $lines, &$level)
|
||||
|
||||
$inc++;
|
||||
$level++;
|
||||
PLineSelect($inc, $lines[$i]->id, $lines, $level);
|
||||
if ($lines[$i]->id) PLineSelect($inc, $lines[$i]->id, $lines, $level);
|
||||
$level--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
llxHeader("",$langs->trans("Tasks"),"Tasks");
|
||||
|
||||
$projet = new Project($db);
|
||||
$projet->fetch($_GET["id"]);
|
||||
$projet->societe->fetch($projet->societe->id);
|
||||
|
||||
|
||||
if ($_GET["action"] == 'create' && $user->rights->projet->creer)
|
||||
{
|
||||
print_titre($langs->trans("NewTask"));
|
||||
print '<br>';
|
||||
|
||||
$tasksarray=$projet->getTasksArray();
|
||||
|
||||
if ($mesg) print $mesg;
|
||||
|
||||
print '<form action="fiche.php?id='.$_GET["id"].'" method="post">';
|
||||
print '<input type="hidden" name="action" value="createtask">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td>'.$langs->trans("NewTask").'</td><td colspan="3">';
|
||||
print '<input type="text" size="25" name="task_name" class="flat"> ';
|
||||
if ($tasksarray)
|
||||
{
|
||||
print ' '.$langs->trans("ChildOfTaks").' ';
|
||||
|
||||
print '<select class="flat" name="task_parent">';
|
||||
print '<option value="0" selected="true"> </option>';
|
||||
PLineSelect($j, 0, $tasksarray, $level);
|
||||
print '</select>';
|
||||
}
|
||||
print ' <input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
|
||||
} else {
|
||||
|
||||
/*
|
||||
* Fiche projet en mode visu
|
||||
*
|
||||
*/
|
||||
|
||||
$head=project_prepare_head($projet);
|
||||
dolibarr_fiche_head($head, 'tasks', $langs->trans("Project"));
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Ref").'</td><td>'.$projet->ref.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projet->title.'</td></tr>';
|
||||
|
||||
print '<td>'.$langs->trans("Company").'</td><td>'.$projet->societe->getNomUrl(1).'</td></tr>';
|
||||
|
||||
$tasksrole=$projet->getTasksRoleForUser($user);
|
||||
|
||||
$tasksarray=$projet->getTasksArray();
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
print '<form name="addtime" method="POST" action="fiche.php?id='.$projet->id.'">';
|
||||
print '<input type="hidden" name="action" value="addtime">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("ID").'</td>';
|
||||
print '<td>'.$langs->trans("Task").'</td>';
|
||||
print '<td align="right">'.$langs->trans("DurationEffective").'</td>';
|
||||
print '<td colspan="2">'.$langs->trans("AddDuration").'</td>';
|
||||
print "</tr>\n";
|
||||
PLines($j, 0, $tasksarray, $level, $tasksrole);
|
||||
print '</form>';
|
||||
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$projet->id.'&action=create">'.$langs->trans('AddTask').'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
*
|
||||
* 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 "<tr $bc[$var]>\n<td>";
|
||||
print '<a href="fiche.php?id='.$lines[$i][5].'">'.$lines[$i][4]."</a></td><td>\n";
|
||||
|
||||
for ($k = 0 ; $k < $level ; $k++)
|
||||
{
|
||||
print " ";
|
||||
}
|
||||
|
||||
print '<a href="task.php?id='.$lines[$i][2].'">'.$lines[$i][0]."</a></td>\n";
|
||||
|
||||
$heure = intval($lines[$i][3]);
|
||||
$minutes = (($lines[$i][3] - $heure) * 60);
|
||||
$minutes = substr("00"."$minutes", -2);
|
||||
|
||||
print '<td align="right">'.$heure." h ".$minutes."</td>\n";
|
||||
print "</tr>\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 '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Project").'</td>';
|
||||
print '<td>'.$langs->trans("Task").'</td>';
|
||||
print '<td align="right">'.$langs->trans("DurationEffective").'</td>';
|
||||
print "</tr>\n";
|
||||
print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
|
||||
PLines($j, 0, $tasks, $level, $var);
|
||||
|
||||
print "</table>";
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?action=create">'.$langs->trans('AddTask').'</a>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
|
||||
$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 "<tr ".$bc[$var].">\n<td>";
|
||||
$projectstatic->id=$lines[$i][5];
|
||||
$projectstatic->ref=$lines[$i][4];
|
||||
print $projectstatic->getNomUrl(1);
|
||||
print "</td><td>\n";
|
||||
|
||||
for ($k = 0 ; $k < $level ; $k++)
|
||||
{
|
||||
print " ";
|
||||
}
|
||||
|
||||
print '<a href="task.php?id='.$lines[$i][2].'">'.$lines[$i][0]."</a></td>\n";
|
||||
|
||||
$heure = intval($lines[$i][3]);
|
||||
$minutes = (($lines[$i][3] - $heure) * 60);
|
||||
$minutes = substr("00"."$minutes", -2);
|
||||
|
||||
print '<td align="right">'.$heure." h ".$minutes."</td>\n";
|
||||
print "</tr>\n";
|
||||
$inc++;
|
||||
$level++;
|
||||
PLines($inc, $lines[$i][2], $lines, $level, $var);
|
||||
$level--;
|
||||
}
|
||||
else
|
||||
{
|
||||
//$level--;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -1,141 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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 "<tr $bc[$var]>\n<td>";
|
||||
print '<a href="fiche.php?id='.$lines[$i][5].'">'.$lines[$i][4]."</a></td><td>\n";
|
||||
|
||||
for ($k = 0 ; $k < $level ; $k++)
|
||||
{
|
||||
print " ";
|
||||
}
|
||||
|
||||
print '<a href="task.php?id='.$lines[$i][2].'">'.$lines[$i][0]."</a></td>\n";
|
||||
|
||||
$heure = intval($lines[$i][3]);
|
||||
$minutes = (($lines[$i][3] - $heure) * 60);
|
||||
$minutes = substr("00"."$minutes", -2);
|
||||
|
||||
print '<td align="right">'.$heure." h ".$minutes."</td>\n";
|
||||
print "</tr>\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 '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Project").'</td>';
|
||||
print '<td>'.$langs->trans("Task").'</td>';
|
||||
print '<td align="right">'.$langs->trans("DurationEffective").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
|
||||
PLines($j, 0, $tasks, $level, $var);
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
*
|
||||
* 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 '<input type="hidden" name="action" value="createtask">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Ref").'</td><td>'.$projet->ref.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projet->title.'</td></tr>';
|
||||
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">'.$task->id.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$task->title.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
||||
print $projet->getNomUrl(1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<td>'.$langs->trans("Company").'</td><td>'.$projet->societe->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Task").'</td><td colspan="3">'.$task->title.'</td></tr>';
|
||||
|
||||
/* 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 '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Date").'</td>';
|
||||
print '<td>'.$langs->trans("DurationEffective").'</td>';
|
||||
print '<td>'.$langs->trans("TimeSpent").'</td>';
|
||||
print '<td colspan="2">'.$langs->trans("User").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
foreach ($tasks as $task_time)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>'.dolibarr_print_date($task_time[0]).'</td>';
|
||||
print '<td>'.$task_time[1].'</td>';
|
||||
print '<td>'.$task_time[3].'</td>';
|
||||
print "</tr>\n";
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>'.dolibarr_print_date($task_time[0],'day').'</td>';
|
||||
print '<td>'.$task_time[1].'</td>';
|
||||
print '<td>'.$task_time[3].'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user