diff --git a/htdocs/lib/project.lib.php b/htdocs/lib/project.lib.php index ea1775f833e..fe625511fe3 100644 --- a/htdocs/lib/project.lib.php +++ b/htdocs/lib/project.lib.php @@ -101,9 +101,9 @@ function task_prepare_head($object) $head[$h][2] = 'time'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/who.php?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/contact.php?id='.$object->id; $head[$h][1] = $langs->trans("Affectations"); - $head[$h][2] = 'who'; + $head[$h][2] = 'contact'; $h++; // Show more tabs from modules diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index fc7238d7f56..6374cdc0386 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -1,6 +1,7 @@ * Copyright (C) 2006-2009 Laurent Destailleur + * Copyright (C) 2010 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 @@ -66,15 +67,15 @@ print "\n"; $sql = "SELECT p.rowid, p.ref, p.title, count(t.rowid) as nb"; $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 ($mode == 'mine') $sql.= ", ".MAIN_DB_PREFIX."projet_task_actors as pta"; $sql.= ")"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as s on s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; $sql.= " WHERE t.fk_projet = p.rowid"; $sql.= " AND p.entity = ".$conf->entity; 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; +//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; diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 43e294370ba..768e89dd235 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -172,8 +172,6 @@ if ($id > 0 || ! empty($ref)) if ( $project->fetch($id,$ref) > 0) { if ($project->societe->id > 0) $result=$project->societe->fetch($project->societe->id); - if ($project->user_resp_id > 0) $result=$project->fetch_user($project->user_resp_id); - $head = project_prepare_head($project); dol_fiche_head($head, 'contact', $langs->trans("Project"), 0, 'project'); diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php index 6a8188b0b63..76887713031 100644 --- a/htdocs/projet/fiche.php +++ b/htdocs/projet/fiche.php @@ -239,7 +239,7 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) if ($mesg) print $mesg.'
'; - print '
'; + print ''; print ''; print ''; print ''; @@ -341,7 +341,7 @@ else if ($_GET["action"] == 'edit') { - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index c0cd6a57555..dbf95bebec8 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2005-2010 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 @@ -66,7 +66,7 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet"; $sql.= " WHERE p.entity = ".$conf->entity; -if ($_REQUEST["mode"]=='mine') $sql.=' AND p.fk_user_resp='.$user->id; +//if ($_REQUEST["mode"]=='mine') $sql.=' AND p.fk_user_resp='.$user->id; if ($socid) $sql.= " AND p.fk_soc = ".$socid; $sql.= " GROUP BY p.title, p.rowid"; @@ -113,7 +113,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; $sql.= " WHERE p.entity = ".$conf->entity; -if ($_REQUEST["mode"]=='mine') $sql.=' AND p.fk_user_resp='.$user->id; +//if ($_REQUEST["mode"]=='mine') $sql.=' AND p.fk_user_resp='.$user->id; if ($socid) $sql.= " AND s.rowid = ".$socid; $sql.= " GROUP BY s.nom, s.rowid"; //$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset); diff --git a/htdocs/projet/liste.php b/htdocs/projet/liste.php index b1f29f63ee6..dccf8b5ecde 100644 --- a/htdocs/projet/liste.php +++ b/htdocs/projet/liste.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2005 Rodolphe Quiedeville * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005 Marc Bariley / Ocebo - * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2005-2010 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 @@ -69,15 +69,14 @@ $projectstatic = new Project($db); $userstatic = new User($db); $staticsoc=new Societe($db); -$sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_statut, p.dateo as do, p.fk_user_resp,"; -$sql.= " u.login,"; +$sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_statut, p.dateo as do,"; $sql.= " s.nom, s.rowid as socid, s.client"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on p.fk_user_resp = u.rowid"; +//$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on p.fk_user_resp = u.rowid"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; $sql.= " WHERE p.entity = ".$conf->entity; -if ($_REQUEST["mode"]=='mine') $sql.=' AND p.fk_user_resp='.$user->id; +//if ($_REQUEST["mode"]=='mine') $sql.=' AND p.fk_user_resp='.$user->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND (p.fk_soc IS NULL or sc.fk_soc IS NOT NULL)"; if ($socid) $sql.= " AND s.rowid = ".$socid; diff --git a/htdocs/projet/project.class.php b/htdocs/projet/project.class.php index 053e2256c25..39d6bbd7e68 100644 --- a/htdocs/projet/project.class.php +++ b/htdocs/projet/project.class.php @@ -161,7 +161,7 @@ class Project extends CommonObject { if (empty($id) && empty($ref)) return -1; - $sql = "SELECT rowid, ref, title, datec, tms, dateo, datee, fk_soc, fk_user_creat, fk_user_resp, fk_statut, note"; + $sql = "SELECT rowid, ref, title, datec, tms, dateo, datee, fk_soc, fk_user_creat, fk_statut, note"; $sql.= " FROM ".MAIN_DB_PREFIX."projet"; if ($ref) $sql.= " WHERE ref='".$ref."'"; else $sql.= " WHERE rowid=".$id; @@ -188,7 +188,6 @@ class Project extends CommonObject $this->socid = $obj->fk_soc; $this->societe->id = $obj->fk_soc; // TODO For backward compatibility $this->user_author_id = $obj->fk_user_creat; - $this->user_resp_id = $obj->fk_user_resp; $this->statut = $obj->fk_statut; $this->db->free($resql); diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php new file mode 100644 index 00000000000..27f5e46f3bd --- /dev/null +++ b/htdocs/projet/tasks/contact.php @@ -0,0 +1,397 @@ + + * Copyright (C) 2006-2009 Laurent Destailleur + * Copyright (C) 2010 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/who.php + * \ingroup project + * \brief Fiche taches d'un projet + * \version $Id$ + */ + +require ("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php"); +require_once(DOL_DOCUMENT_ROOT.'/html.formcompany.class.php'); + +$langs->load("projects"); +$langs->load("companies"); + +$taskid = isset($_GET["id"])?$_GET["id"]:''; + +// Security check +if ($user->societe_id) $socid=$user->societe_id; +//$result = restrictedArea($user, 'projet', $taskid, 'projet_task'); +if (!$user->rights->projet->lire) accessforbidden(); + + +/* + * Actions + */ + +// Add new contact +if ($_POST["action"] == 'addcontact' && $user->rights->projet->creer) +{ + + $result = 0; + $task = new Task($db); + $result = $task->fetch($taskid); + + if ($result > 0 && $taskid > 0) + { + $result = $task->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]); + } + + if ($result >= 0) + { + Header("Location: contact.php?id=".$task->id); + exit; + } + else + { + if ($task->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') + { + $langs->load("errors"); + $mesg = '
'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
'; + } + else + { + $mesg = '
'.$task->error.'
'; + } + } +} +// modification d'un contact. On enregistre le type +if ($_POST["action"] == 'updateline' && $user->rights->projet->creer) +{ + $task = new Task($db); + if ($task->fetch($taskid)) + { + $contact = $task->detail_contact($_POST["elrowid"]); + $type = $_POST["type"]; + $statut = $contact->statut; + + $result = $task->update_contact($_POST["elrowid"], $statut, $type); + if ($result >= 0) + { + $db->commit(); + } else + { + dol_print_error($db, "result=$result"); + $db->rollback(); + } + } + else + { + dol_print_error($db); + } +} + +// bascule du statut d'un contact +if ($_GET["action"] == 'swapstatut' && $user->rights->projet->creer) +{ + $task = new Task($db); + if ($task->fetch($taskid)) + { + $contact = $task->detail_contact($_GET["ligne"]); + $id_type_contact = $contact->fk_c_type_contact; + $statut = ($contact->statut == 4) ? 5 : 4; + + $result = $task->update_contact($_GET["ligne"], $statut, $id_type_contact); + if ($result >= 0) + { + $db->commit(); + } else + { + dol_print_error($db, "result=$result"); + $db->rollback(); + } + } + else + { + dol_print_error($db); + } +} + +// Efface un contact +if ($_GET["action"] == 'deleteline' && $user->rights->projet->creer) +{ + $task = new Task($db); + $task->fetch($taskid); + $result = $task->delete_contact($_GET["lineid"]); + + if ($result >= 0) + { + Header("Location: contact.php?id=".$task->id); + exit; + } + else + { + dol_print_error($db); + } +} + + +/* + * View + */ + +llxHeader('', $langs->trans("Task")); + +$html = new Form($db); +$formcompany = new FormCompany($db); +$contactstatic = new Contact($db); +$projectstatic = new Project($db); + + +/* *************************************************************************** */ +/* */ +/* Mode vue et edition */ +/* */ +/* *************************************************************************** */ +if (isset($mesg)) print $mesg; + +$id = $_GET['id']; +$ref= $_GET['ref']; +if ($id > 0 || ! empty($ref)) +{ + $task = new Task($db); + + if ( $task->fetch($id,$ref) > 0) + { + $result=$projectstatic->fetch($task->fk_project); + if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid); + + $head = task_prepare_head($task); + dol_fiche_head($head, 'contact', $langs->trans("Task"), 0, 'projecttask'); + + + /* + * Projet synthese pour rappel + */ + print '
'; + + //$linkback="".$langs->trans("BackToList").""; + + // Ref + print ''; + + // Label + print ''; + + // Customer + print ""; + print ''; + + print "
'.$langs->trans('Ref').''; + print $html->showrefnav($task,'ref',$linkback,1,'ref','ref',''); + print '
'.$langs->trans("Label").''.$task->label.'
".$langs->trans("Company")."'; + if ($projectstatic->societe->id > 0) print $projectstatic->societe->getNomUrl(1); + else print ' '; + print '
"; + + print ''; + + /* + * Lignes de contacts + */ + print '
'; + + /* + * Ajouter une ligne de contact + * Non affiche en mode modification de ligne + */ + if ($_GET["action"] != 'editline' && $user->rights->projet->creer) + { + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + + $var = false; + + print ''; + print ''; + print ''; + print ''; + print ''; + + // Ligne ajout pour contact interne + print ""; + + print ''; + + print ''; + + print ''; + print ''; + print ''; + print ''; + + print ''; + + print ''; + print ''; + print ''; + print ''; + print ''; + + // Ligne ajout pour contact externe + $var=!$var; + print ""; + + print ''; + + print ''; + + print ''; + print ''; + print ''; + print ''; + + print ""; + + print ''; + } + + // Liste des contacts lies + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + + $societe = new Societe($db); + $var = true; + + foreach(array('internal','external') as $source) + { + $tab = $task->liste_contact(-1,$source); + $num=sizeof($tab); + + $i = 0; + while ($i < $num) + { + $var = !$var; + + print ''; + + // Source + print ''; + + // Societe + print ''; + + // Contact + print ''; + + // Type de contact + print ''; + + // Statut + print ''; + + // Icon update et delete + print ''; + + print "\n"; + + $i ++; + } + } + print "
'.$langs->trans("Source").''.$langs->trans("Company").''.$langs->trans("Contacts").''.$langs->trans("ContactType").' 
'; + print img_object('','user').' '.$langs->trans("Users"); + print ''; + print $conf->global->MAIN_INFO_SOCIETE_NOM; + print ''; + // On recupere les id des users deja selectionnes + $html->select_users($user->id,'contactid',0); + print ''; + $formcompany->selectTypeContact($task, '', 'type','internal','rowid'); + print '
'; + print img_object('','contact').' '.$langs->trans("ThirdPartyContacts"); + print ''; + $selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$projectstatic->societe->id; + $selectedCompany = $formcompany->selectCompaniesForNewContact($task, 'id', $selectedCompany, 'newcompany'); + print ''; + $nbofcontacts=$html->select_contacts($selectedCompany,'','contactid',0); + if ($nbofcontacts == 0) print $langs->trans("NoContactDefined"); + print ''; + $formcompany->selectTypeContact($task, '', 'type','external','rowid'); + print '
 
'.$langs->trans("Source").''.$langs->trans("Company").''.$langs->trans("Contacts").''.$langs->trans("ContactType").''.$langs->trans("Status").' 
'; + if ($tab[$i]['source']=='internal') print $langs->trans("User"); + if ($tab[$i]['source']=='external') print $langs->trans("ThirdPartyContact"); + print ''; + if ($tab[$i]['socid'] > 0) + { + print ''; + print img_object($langs->trans("ShowCompany"),"company").' '.$societe->get_nom($tab[$i]['socid']); + print ''; + } + if ($tab[$i]['socid'] < 0) + { + print $conf->global->MAIN_INFO_SOCIETE_NOM; + } + if (! $tab[$i]['socid']) + { + print ' '; + } + print ''; + if ($tab[$i]['source']=='internal') + { + print ''; + print img_object($langs->trans("ShowUser"),"user").' '.$tab[$i]['nom'].''; + } + if ($tab[$i]['source']=='external') + { + print ''; + print img_object($langs->trans("ShowContact"),"contact").' '.$tab[$i]['nom'].''; + } + print ''.$tab[$i]['libelle'].''; + // Activation desativation du contact + if ($task->statut >= 0) print ''; + print $contactstatic->LibStatut($tab[$i]['status'],3); + if ($task->statut >= 0) print ''; + print ''; + if ($user->rights->projet->creer) + { + print ' '; + print ''; + print img_delete(); + print ''; + } + print '
"; + } + else + { + print "ErrorRecordNotFound"; + } +} + +$db->close(); + +llxFooter('$Date$ - $Revision$'); +?> diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php index 6cc6302e6a3..86963f358ad 100644 --- a/htdocs/projet/tasks/index.php +++ b/htdocs/projet/tasks/index.php @@ -67,6 +67,7 @@ $task = new Task($db); // can have a parent that is not affected to him). $tasksarray=$task->getTasksArray(0, 0, 0, $socid); // We load also tasks limited to a particular user +$tasksrole = $task->getTasksRoleForUser($user); var_dump($tasksrole); $tasksrole=($_REQUEST["mode"]=='mine' ? $task->getTasksRoleForUser($user) : ''); print ''; diff --git a/htdocs/projet/tasks/task.class.php b/htdocs/projet/tasks/task.class.php index 29a0589a351..3c9c9eecff2 100644 --- a/htdocs/projet/tasks/task.class.php +++ b/htdocs/projet/tasks/task.class.php @@ -426,50 +426,17 @@ class Task extends CommonObject //print $usert.'-'.$userp.'
'; // List of tasks - $sql = "SELECT p.rowid as projectid, p.ref, p.title as plabel,"; - $sql.= " t.rowid, t.label, t.description, t.fk_task_parent, t.duration_effective,"; - $sql.= " up.name, up.firstname"; - if ($mode == 0) - { - $sql.= " FROM (".MAIN_DB_PREFIX."projet as p, ".MAIN_DB_PREFIX."projet_task as t"; - if (is_object($usert)) // Limit to task affected to a user - { - $sql.= ", ".MAIN_DB_PREFIX."projet_task_actors as ta"; - } - $sql.= ")"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as up on p.fk_user_resp = up.rowid"; - $sql.= " WHERE t.fk_projet = p.rowid"; - $sql.= " AND p.entity = ".$conf->entity; - if ($socid) $sql.= " AND p.fk_soc = ".$socid; - if ($this->id) $sql .= " AND t.fk_projet =".$this->id; - if (is_object($usert)) $sql .= " AND ta.fk_projet_task = t.rowid AND ta.fk_user = ".$usert->id; - if (is_object($userp)) $sql .= " AND (p.fk_user_resp = ".$userp->id." OR p.fk_user_resp IS NULL OR p.fk_user_resp = -1)"; - } - if ($mode == 1) - { - $sql.= " FROM (".MAIN_DB_PREFIX."projet as p"; - if (is_object($usert)) // Limit to task affected to a user - { - $sql.= ", ".MAIN_DB_PREFIX."projet_task as t"; - $sql.= ", ".MAIN_DB_PREFIX."projet_task_actors as ta)"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; - } - else - { - $sql.= ")"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid"; - } - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as up on p.fk_user_resp = up.rowid"; - $sql.= " WHERE p.entity = ".$conf->entity; - if ($socid) $sql.= " AND p.fk_soc = ".$socid; - if ($this->id) $sql .= " AND t.fk_projet =".$this->id; - if (is_object($usert)) $sql .= " AND t.fk_projet = p.rowid AND ta.fk_projet_task = t.rowid AND ta.fk_user = ".$usert->id; - if (is_object($userp)) $sql .= " AND (p.fk_user_resp = ".$userp->id." OR p.fk_user_resp IS NULL OR p.fk_user_resp = -1)"; - } + $sql = "SELECT p.rowid as projectid, p.ref, p.title as plabel"; + $sql.= ", t.rowid, t.label, t.description, t.fk_task_parent, t.duration_effective"; + $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as t"; + $sql.= ", ".MAIN_DB_PREFIX."projet as p"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; + $sql.= " WHERE t.fk_projet = p.rowid"; + $sql.= " AND p.entity = ".$conf->entity; + if ($socid) $sql.= " AND p.fk_soc = ".$socid; + if ($this->id) $sql.= " AND t.fk_projet =".$this->id; $sql.= " ORDER BY p.ref, t.label"; -print $sql; + dol_syslog("Project::getTasksArray sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -512,11 +479,14 @@ print $sql; $tasksrole = array(); /* Liste des taches et role sur la tache du user courant dans $tasksrole */ - $sql = "SELECT a.fk_projet_task, a.role"; + $sql = "SELECT ec.element_id, ctc.code"; $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt"; - $sql.= ", ".MAIN_DB_PREFIX."projet_task_actors as a"; - $sql.= " WHERE pt.rowid = a.fk_projet_task"; - $sql.= " AND a.fk_user = ".$user->id; + $sql.= ", ".MAIN_DB_PREFIX."element_contact as ec"; + $sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc"; + $sql.= " WHERE pt.rowid = ec.element_id"; + $sql.= " AND ctc.element = '".$this->element."'"; + $sql.= " AND ctc.rowid = ec.fk_c_type_contact"; + $sql.= " AND ec.fk_socpeople = ".$user->id; if ($this->id) $sql.= " AND pt.fk_projet =".$this->id; $resql = $this->db->query($sql); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index e62e824f784..fa5607989fe 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -58,9 +58,8 @@ if ($_GET["id"] > 0) $task = new Task($db); if ($task->fetch($_GET["id"]) >= 0 ) { - $projet = new Project($db); - $result=$projet->fetch($task->fk_projet); - if (! empty($projet->socid)) $projet->societe->fetch($projet->socid); + $result=$projectstatic->fetch($task->fk_project); + if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid); $head=task_prepare_head($task); @@ -68,7 +67,7 @@ if ($_GET["id"] > 0) if ($mesg) print $mesg.'
'; - print ''; + print ''; print ''; print ''; print '
'; @@ -84,11 +83,11 @@ if ($_GET["id"] > 0) print ''; print ''; print ''; diff --git a/htdocs/projet/tasks/who.php b/htdocs/projet/tasks/who.php deleted file mode 100644 index 51489ff55c8..00000000000 --- a/htdocs/projet/tasks/who.php +++ /dev/null @@ -1,170 +0,0 @@ - - * Copyright (C) 2006-2009 Laurent Destailleur - * Copyright (C) 2010 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/who.php - * \ingroup project - * \brief Fiche taches d'un projet - * \version $Id$ - */ - -require("./pre.inc.php"); -require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php"); - -if (!$user->rights->projet->lire) accessforbidden(); - -/* - * Actions - */ - - - - -/* - * View - */ - -llxHeader("",$langs->trans("Task")); - -$html = new Form($db); - -$projectstatic = new Project($db); -$userstatic = new User($db); - - -if ($_GET["id"] > 0) -{ - /* - * Fiche projet en mode visu - * - */ - $task = new Task($db); - if ($task->fetch($_GET["id"]) >= 0 ) - { - $projet = new Project($db); - $result=$projet->fetch($task->fk_projet); - if (! empty($projet->socid)) $projet->societe->fetch($projet->socid); - - $head=task_prepare_head($task); - - dol_fiche_head($head, 'who', $langs->trans("Task"),0,'projecttask'); - - if ($mesg) print $mesg.'
'; - - print ''; - print ''; - print ''; - print '
'.$langs->trans("Label").''.$task->label.'
'.$langs->trans("Project").''; - print $projet->getNomUrl(1); + print $projectstatic->getNomUrl(1); print '
'.$langs->trans("Company").''; - if ($projet->societe->id) print $projet->societe->getNomUrl(1); + if ($projectstatic->societe->id) print $projectstatic->societe->getNomUrl(1); else print ' '; print '
'; - - // Ref - print ''; - - // Label - print ''; - - print ''; - - print ''; - - - /* Liste des affectations */ - - $sql = "SELECT t.label, t.duration_effective, t.fk_task_parent, t.fk_statut,"; - $sql.= " u.login, u.rowid"; - $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as t,"; - $sql.= " ".MAIN_DB_PREFIX."projet_task_actors as ta,"; - $sql.= " ".MAIN_DB_PREFIX."user as u"; - $sql.= " WHERE t.rowid =".$task->id; - $sql.= " AND t.rowid = ta.fk_projet_task"; - $sql.= " AND ta.fk_user = u.rowid"; - - $lines=array(); - $var=true; - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - $tasks = array(); - while ($i < $num) - { - $row = $db->fetch_object($resql); - $lines[$i] = $row; - $i++; - } - $db->free($resql); - } - else - { - dol_print_error($db); - } - - print '
'.$langs->trans("Ref"); - print ''; - print $html->showrefnav($task,'id','',1,'rowid','ref','',''); - print '
'.$langs->trans("Label").''.$task->label.'
'.$langs->trans("Project").''; - print $projet->getNomUrl(1); - print '
'.$langs->trans("Company").''; - if ($projet->societe->id) print $projet->societe->getNomUrl(1); - else print ' '; - print '
'; - print ''; - - - /* - * Actions - */ - print '
'; - - /*if ($user->rights->projet->creer) - { - print ''.$langs->trans('Delete').''; - }*/ - - print '
'; - - - print '
'; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - foreach ($lines as $xxx) - { - $var=!$var; - print ""; - $userstatic->id=$xxx->rowid; - $userstatic->nom=$xxx->login; - print ''; - - print "\n"; - } - - print "
'.$langs->trans("User").'
'.$userstatic->getNomUrl(1).'
"; - - } -} - -$db->close(); - -llxFooter('$Date$ - $Revision$'); -?>