Works on enhancement of project tasks
Fix: data migration field fk_user_resp of llx_projet to llx_element_contact
This commit is contained in:
parent
69f38173a7
commit
bb8f7045d8
@ -101,9 +101,9 @@ function task_prepare_head($object)
|
|||||||
$head[$h][2] = 'time';
|
$head[$h][2] = 'time';
|
||||||
$h++;
|
$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][1] = $langs->trans("Affectations");
|
||||||
$head[$h][2] = 'who';
|
$head[$h][2] = 'contact';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
// Show more tabs from modules
|
// Show more tabs from modules
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -66,15 +67,15 @@ print "</tr>\n";
|
|||||||
$sql = "SELECT p.rowid, p.ref, p.title, count(t.rowid) as nb";
|
$sql = "SELECT p.rowid, p.ref, p.title, count(t.rowid) as nb";
|
||||||
$sql.= " FROM (".MAIN_DB_PREFIX."projet as p";
|
$sql.= " FROM (".MAIN_DB_PREFIX."projet as p";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."projet_task as t";
|
$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.= ")";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
|
$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;
|
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.= " WHERE t.fk_projet = p.rowid";
|
||||||
$sql.= " AND p.entity = ".$conf->entity;
|
$sql.= " AND p.entity = ".$conf->entity;
|
||||||
if ($socid) $sql.= " AND p.fk_soc = ".$socid;
|
if ($socid) $sql.= " AND p.fk_soc = ".$socid;
|
||||||
if ($mode == 'mine') $sql.=" AND t.rowid = pta.fk_projet_task";
|
//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 pta.fk_user = ".$user->id;
|
||||||
$sql.= " GROUP BY p.rowid";
|
$sql.= " GROUP BY p.rowid";
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|||||||
@ -172,8 +172,6 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if ( $project->fetch($id,$ref) > 0)
|
if ( $project->fetch($id,$ref) > 0)
|
||||||
{
|
{
|
||||||
if ($project->societe->id > 0) $result=$project->societe->fetch($project->societe->id);
|
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);
|
$head = project_prepare_head($project);
|
||||||
dol_fiche_head($head, 'contact', $langs->trans("Project"), 0, 'project');
|
dol_fiche_head($head, 'contact', $langs->trans("Project"), 0, 'project');
|
||||||
|
|||||||
@ -239,7 +239,7 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
|
|||||||
|
|
||||||
if ($mesg) print $mesg.'<br>';
|
if ($mesg) print $mesg.'<br>';
|
||||||
|
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
@ -341,7 +341,7 @@ else
|
|||||||
|
|
||||||
if ($_GET["action"] == 'edit')
|
if ($_GET["action"] == 'edit')
|
||||||
{
|
{
|
||||||
print '<form method="post" action="fiche.php">';
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
print '<input type="hidden" name="id" value="'.$project->id.'">';
|
print '<input type="hidden" name="id" value="'.$project->id.'">';
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* 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;
|
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.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet";
|
||||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
$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;
|
if ($socid) $sql.= " AND p.fk_soc = ".$socid;
|
||||||
$sql.= " GROUP BY p.title, p.rowid";
|
$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";
|
$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;
|
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;
|
$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;
|
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||||
$sql.= " GROUP BY s.nom, s.rowid";
|
$sql.= " GROUP BY s.nom, s.rowid";
|
||||||
//$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset);
|
//$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Marc Bariley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Bariley / Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* 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);
|
$userstatic = new User($db);
|
||||||
$staticsoc=new Societe($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 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_statut, p.dateo as do,";
|
||||||
$sql.= " u.login,";
|
|
||||||
$sql.= " s.nom, s.rowid as socid, s.client";
|
$sql.= " s.nom, s.rowid as socid, s.client";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
$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."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;
|
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;
|
$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 (!$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;
|
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||||
|
|
||||||
|
|||||||
@ -161,7 +161,7 @@ class Project extends CommonObject
|
|||||||
{
|
{
|
||||||
if (empty($id) && empty($ref)) return -1;
|
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";
|
$sql.= " FROM ".MAIN_DB_PREFIX."projet";
|
||||||
if ($ref) $sql.= " WHERE ref='".$ref."'";
|
if ($ref) $sql.= " WHERE ref='".$ref."'";
|
||||||
else $sql.= " WHERE rowid=".$id;
|
else $sql.= " WHERE rowid=".$id;
|
||||||
@ -188,7 +188,6 @@ class Project extends CommonObject
|
|||||||
$this->socid = $obj->fk_soc;
|
$this->socid = $obj->fk_soc;
|
||||||
$this->societe->id = $obj->fk_soc; // TODO For backward compatibility
|
$this->societe->id = $obj->fk_soc; // TODO For backward compatibility
|
||||||
$this->user_author_id = $obj->fk_user_creat;
|
$this->user_author_id = $obj->fk_user_creat;
|
||||||
$this->user_resp_id = $obj->fk_user_resp;
|
|
||||||
$this->statut = $obj->fk_statut;
|
$this->statut = $obj->fk_statut;
|
||||||
|
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|||||||
397
htdocs/projet/tasks/contact.php
Normal file
397
htdocs/projet/tasks/contact.php
Normal file
@ -0,0 +1,397 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* 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 = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mesg = '<div class="error">'.$task->error.'</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 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 '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
//$linkback="<a href=\"".$_SERVER["PHP_SELF"]."?page=$page&socid=$socid&viewstatut=$viewstatut&sortfield=$sortfield&$sortorder\">".$langs->trans("BackToList")."</a>";
|
||||||
|
|
||||||
|
// Ref
|
||||||
|
print '<tr><td width="30%">'.$langs->trans('Ref').'</td><td colspan="3">';
|
||||||
|
print $html->showrefnav($task,'ref',$linkback,1,'ref','ref','');
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Label
|
||||||
|
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$task->label.'</td></tr>';
|
||||||
|
|
||||||
|
// Customer
|
||||||
|
print "<tr><td>".$langs->trans("Company")."</td>";
|
||||||
|
print '<td colspan="3">';
|
||||||
|
if ($projectstatic->societe->id > 0) print $projectstatic->societe->getNomUrl(1);
|
||||||
|
else print ' ';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Lignes de contacts
|
||||||
|
*/
|
||||||
|
print '<br><table class="noborder" width="100%">';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ajouter une ligne de contact
|
||||||
|
* Non affiche en mode modification de ligne
|
||||||
|
*/
|
||||||
|
if ($_GET["action"] != 'editline' && $user->rights->projet->creer)
|
||||||
|
{
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>'.$langs->trans("Source").'</td>';
|
||||||
|
print '<td>'.$langs->trans("Company").'</td>';
|
||||||
|
print '<td>'.$langs->trans("Contacts").'</td>';
|
||||||
|
print '<td>'.$langs->trans("ContactType").'</td>';
|
||||||
|
print '<td colspan="3"> </td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$var = false;
|
||||||
|
|
||||||
|
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="POST">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="action" value="addcontact">';
|
||||||
|
print '<input type="hidden" name="source" value="internal">';
|
||||||
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||||
|
|
||||||
|
// Ligne ajout pour contact interne
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
|
||||||
|
print '<td nowrap="nowrap">';
|
||||||
|
print img_object('','user').' '.$langs->trans("Users");
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td colspan="1">';
|
||||||
|
print $conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td colspan="1">';
|
||||||
|
// On recupere les id des users deja selectionnes
|
||||||
|
$html->select_users($user->id,'contactid',0);
|
||||||
|
print '</td>';
|
||||||
|
print '<td>';
|
||||||
|
$formcompany->selectTypeContact($task, '', 'type','internal','rowid');
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print '</form>';
|
||||||
|
|
||||||
|
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="POST">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="action" value="addcontact">';
|
||||||
|
print '<input type="hidden" name="source" value="external">';
|
||||||
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||||
|
|
||||||
|
// Ligne ajout pour contact externe
|
||||||
|
$var=!$var;
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
|
||||||
|
print '<td nowrap="nowrap">';
|
||||||
|
print img_object('','contact').' '.$langs->trans("ThirdPartyContacts");
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td colspan="1">';
|
||||||
|
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$projectstatic->societe->id;
|
||||||
|
$selectedCompany = $formcompany->selectCompaniesForNewContact($task, 'id', $selectedCompany, 'newcompany');
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td colspan="1">';
|
||||||
|
$nbofcontacts=$html->select_contacts($selectedCompany,'','contactid',0);
|
||||||
|
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
|
||||||
|
print '</td>';
|
||||||
|
print '<td>';
|
||||||
|
$formcompany->selectTypeContact($task, '', 'type','external','rowid');
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
|
||||||
|
if (! $nbofcontacts) print ' disabled="true"';
|
||||||
|
print '></td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print "</form>";
|
||||||
|
|
||||||
|
print '<tr><td colspan="6"> </td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Liste des contacts lies
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>'.$langs->trans("Source").'</td>';
|
||||||
|
print '<td>'.$langs->trans("Company").'</td>';
|
||||||
|
print '<td>'.$langs->trans("Contacts").'</td>';
|
||||||
|
print '<td>'.$langs->trans("ContactType").'</td>';
|
||||||
|
print '<td align="center">'.$langs->trans("Status").'</td>';
|
||||||
|
print '<td colspan="2"> </td>';
|
||||||
|
print "</tr>\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 '<tr '.$bc[$var].' valign="top">';
|
||||||
|
|
||||||
|
// Source
|
||||||
|
print '<td align="left">';
|
||||||
|
if ($tab[$i]['source']=='internal') print $langs->trans("User");
|
||||||
|
if ($tab[$i]['source']=='external') print $langs->trans("ThirdPartyContact");
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Societe
|
||||||
|
print '<td align="left">';
|
||||||
|
if ($tab[$i]['socid'] > 0)
|
||||||
|
{
|
||||||
|
print '<a href="'.DOL_URL_ROOT.'/soc.php?socid='.$tab[$i]['socid'].'">';
|
||||||
|
print img_object($langs->trans("ShowCompany"),"company").' '.$societe->get_nom($tab[$i]['socid']);
|
||||||
|
print '</a>';
|
||||||
|
}
|
||||||
|
if ($tab[$i]['socid'] < 0)
|
||||||
|
{
|
||||||
|
print $conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||||
|
}
|
||||||
|
if (! $tab[$i]['socid'])
|
||||||
|
{
|
||||||
|
print ' ';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Contact
|
||||||
|
print '<td>';
|
||||||
|
if ($tab[$i]['source']=='internal')
|
||||||
|
{
|
||||||
|
print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$tab[$i]['id'].'">';
|
||||||
|
print img_object($langs->trans("ShowUser"),"user").' '.$tab[$i]['nom'].'</a>';
|
||||||
|
}
|
||||||
|
if ($tab[$i]['source']=='external')
|
||||||
|
{
|
||||||
|
print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$tab[$i]['id'].'">';
|
||||||
|
print img_object($langs->trans("ShowContact"),"contact").' '.$tab[$i]['nom'].'</a>';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Type de contact
|
||||||
|
print '<td>'.$tab[$i]['libelle'].'</td>';
|
||||||
|
|
||||||
|
// Statut
|
||||||
|
print '<td align="center">';
|
||||||
|
// Activation desativation du contact
|
||||||
|
if ($task->statut >= 0) print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$task->id.'&action=swapstatut&ligne='.$tab[$i]['rowid'].'">';
|
||||||
|
print $contactstatic->LibStatut($tab[$i]['status'],3);
|
||||||
|
if ($task->statut >= 0) print '</a>';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Icon update et delete
|
||||||
|
print '<td align="center" nowrap>';
|
||||||
|
if ($user->rights->projet->creer)
|
||||||
|
{
|
||||||
|
print ' ';
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$task->id.'&action=deleteline&lineid='.$tab[$i]['rowid'].'">';
|
||||||
|
print img_delete();
|
||||||
|
print '</a>';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$i ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print "</table>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "ErrorRecordNotFound";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->close();
|
||||||
|
|
||||||
|
llxFooter('$Date$ - $Revision$');
|
||||||
|
?>
|
||||||
@ -67,6 +67,7 @@ $task = new Task($db);
|
|||||||
// can have a parent that is not affected to him).
|
// can have a parent that is not affected to him).
|
||||||
$tasksarray=$task->getTasksArray(0, 0, 0, $socid);
|
$tasksarray=$task->getTasksArray(0, 0, 0, $socid);
|
||||||
// We load also tasks limited to a particular user
|
// We load also tasks limited to a particular user
|
||||||
|
$tasksrole = $task->getTasksRoleForUser($user); var_dump($tasksrole);
|
||||||
$tasksrole=($_REQUEST["mode"]=='mine' ? $task->getTasksRoleForUser($user) : '');
|
$tasksrole=($_REQUEST["mode"]=='mine' ? $task->getTasksRoleForUser($user) : '');
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|||||||
@ -426,50 +426,17 @@ class Task extends CommonObject
|
|||||||
//print $usert.'-'.$userp.'<br>';
|
//print $usert.'-'.$userp.'<br>';
|
||||||
|
|
||||||
// List of tasks
|
// List of tasks
|
||||||
$sql = "SELECT p.rowid as projectid, p.ref, p.title as plabel,";
|
$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.= ", t.rowid, t.label, t.description, t.fk_task_parent, t.duration_effective";
|
||||||
$sql.= " up.name, up.firstname";
|
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task as t";
|
||||||
if ($mode == 0)
|
$sql.= ", ".MAIN_DB_PREFIX."projet as p";
|
||||||
{
|
|
||||||
$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."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.= " WHERE t.fk_projet = p.rowid";
|
||||||
$sql.= " AND p.entity = ".$conf->entity;
|
$sql.= " AND p.entity = ".$conf->entity;
|
||||||
if ($socid) $sql.= " AND p.fk_soc = ".$socid;
|
if ($socid) $sql.= " AND p.fk_soc = ".$socid;
|
||||||
if ($this->id) $sql.= " AND t.fk_projet =".$this->id;
|
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.= " ORDER BY p.ref, t.label";
|
$sql.= " ORDER BY p.ref, t.label";
|
||||||
print $sql;
|
|
||||||
dol_syslog("Project::getTasksArray sql=".$sql, LOG_DEBUG);
|
dol_syslog("Project::getTasksArray sql=".$sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -512,11 +479,14 @@ print $sql;
|
|||||||
$tasksrole = array();
|
$tasksrole = array();
|
||||||
|
|
||||||
/* Liste des taches et role sur la tache du user courant dans $tasksrole */
|
/* 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.= " FROM ".MAIN_DB_PREFIX."projet_task as pt";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."projet_task_actors as a";
|
$sql.= ", ".MAIN_DB_PREFIX."element_contact as ec";
|
||||||
$sql.= " WHERE pt.rowid = a.fk_projet_task";
|
$sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc";
|
||||||
$sql.= " AND a.fk_user = ".$user->id;
|
$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;
|
if ($this->id) $sql.= " AND pt.fk_projet =".$this->id;
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
@ -58,9 +58,8 @@ if ($_GET["id"] > 0)
|
|||||||
$task = new Task($db);
|
$task = new Task($db);
|
||||||
if ($task->fetch($_GET["id"]) >= 0 )
|
if ($task->fetch($_GET["id"]) >= 0 )
|
||||||
{
|
{
|
||||||
$projet = new Project($db);
|
$result=$projectstatic->fetch($task->fk_project);
|
||||||
$result=$projet->fetch($task->fk_projet);
|
if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid);
|
||||||
if (! empty($projet->socid)) $projet->societe->fetch($projet->socid);
|
|
||||||
|
|
||||||
$head=task_prepare_head($task);
|
$head=task_prepare_head($task);
|
||||||
|
|
||||||
@ -68,7 +67,7 @@ if ($_GET["id"] > 0)
|
|||||||
|
|
||||||
if ($mesg) print $mesg.'<br>';
|
if ($mesg) print $mesg.'<br>';
|
||||||
|
|
||||||
print '<form method="POST" action="fiche.php?id='.$projet->id.'">';
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$task->id.'">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="createtask">';
|
print '<input type="hidden" name="action" value="createtask">';
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
@ -84,11 +83,11 @@ if ($_GET["id"] > 0)
|
|||||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$task->label.'</td></tr>';
|
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$task->label.'</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
||||||
print $projet->getNomUrl(1);
|
print $projectstatic->getNomUrl(1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<td>'.$langs->trans("Company").'</td><td>';
|
print '<td>'.$langs->trans("Company").'</td><td>';
|
||||||
if ($projet->societe->id) print $projet->societe->getNomUrl(1);
|
if ($projectstatic->societe->id) print $projectstatic->societe->getNomUrl(1);
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|||||||
@ -1,170 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
||||||
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
||||||
* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* 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.'<br>';
|
|
||||||
|
|
||||||
print '<form method="POST" action="fiche.php?id='.$projet->id.'">';
|
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
||||||
print '<input type="hidden" name="action" value="createtask">';
|
|
||||||
print '<table class="border" width="100%">';
|
|
||||||
|
|
||||||
// Ref
|
|
||||||
print '<tr><td width="30%">'.$langs->trans("Ref");
|
|
||||||
print '</td><td colspan="3">';
|
|
||||||
print $html->showrefnav($task,'id','',1,'rowid','ref','','');
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Label
|
|
||||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$task->label.'</td></tr>';
|
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
|
||||||
print $projet->getNomUrl(1);
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
print '<td>'.$langs->trans("Company").'</td><td>';
|
|
||||||
if ($projet->societe->id) print $projet->societe->getNomUrl(1);
|
|
||||||
else print ' ';
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
|
|
||||||
/* 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 '</table></form>';
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Actions
|
|
||||||
*/
|
|
||||||
print '<div class="tabsAction">';
|
|
||||||
|
|
||||||
/*if ($user->rights->projet->creer)
|
|
||||||
{
|
|
||||||
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$task->id.'&action=delete">'.$langs->trans('Delete').'</a>';
|
|
||||||
}*/
|
|
||||||
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
print '<input type="hidden" name="action" value="addtime">';
|
|
||||||
print '<table class="noborder" width="100%">';
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<td align="left">'.$langs->trans("User").'</td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
foreach ($lines as $xxx)
|
|
||||||
{
|
|
||||||
$var=!$var;
|
|
||||||
print "<tr ".$bc[$var].">";
|
|
||||||
$userstatic->id=$xxx->rowid;
|
|
||||||
$userstatic->nom=$xxx->login;
|
|
||||||
print '<td align="left">'.$userstatic->getNomUrl(1).'</td>';
|
|
||||||
|
|
||||||
print "</tr>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</table>";
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter('$Date$ - $Revision$');
|
|
||||||
?>
|
|
||||||
Loading…
Reference in New Issue
Block a user