New: Some enhancements in project module
This commit is contained in:
parent
6caef066c4
commit
b7c5268a18
@ -55,8 +55,8 @@ print '<tr><td width="30%" valign="top" class="notopnoleft">';
|
|||||||
*/
|
*/
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre($langs->trans("Project"),"index.php","s.nom","","","",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Project"),$_SERVER["PHP_SELF"],"s.nom","","","",$sortfield,$sortorder);
|
||||||
print '<td align="center">'.$langs->trans("NbOpenTasks").'</td>';
|
print '<td align="right">'.$langs->trans("NbOpenTasks").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$sql = "SELECT p.title, p.rowid, count(t.rowid)";
|
$sql = "SELECT p.title, p.rowid, count(t.rowid)";
|
||||||
@ -82,7 +82,7 @@ if ( $resql )
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr $bc[$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><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
|
||||||
print '<td align="center">'.$row[2].'</td>';
|
print '<td align="right">'.$row[2].'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
@ -124,8 +124,8 @@ $dateendy=dolibarr_mktime(23,59,59,12,31,$info["year"]);
|
|||||||
/* Affichage de la liste des projets du mois */
|
/* Affichage de la liste des projets du mois */
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td width="50%">Activité sur les projets cette semaine</td>';
|
print '<td >'.$langs->trans("ActivityOnProjectThisWeek").'</td>';
|
||||||
print '<td width="50%" align="right">'.$langs->trans("Hours").'</td>';
|
print '<td align="right">'.$langs->trans("Time").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$sql = "SELECT p.title, p.rowid, sum(tt.task_duration) as total";
|
$sql = "SELECT p.title, p.rowid, sum(tt.task_duration) as total";
|
||||||
@ -169,8 +169,8 @@ print "</table><br />";
|
|||||||
/* Affichage de la liste des projets du mois */
|
/* Affichage de la liste des projets du mois */
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td width="50%">'.$langs->trans("Project").' ce mois : '.strftime("%B %Y", $now).'</td>';
|
print '<td>'.$langs->trans("ActivityOnProjectThisMonth").': '.strftime("%B %Y", $now).'</td>';
|
||||||
print '<td width="50%" align="right">'.$langs->trans("Hours").'</td>';
|
print '<td align="right">'.$langs->trans("Time").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$sql = "SELECT p.title, p.rowid, sum(tt.task_duration) as total";
|
$sql = "SELECT p.title, p.rowid, sum(tt.task_duration) as total";
|
||||||
@ -214,8 +214,8 @@ print "</table>";
|
|||||||
/* Affichage de la liste des projets du mois */
|
/* Affichage de la liste des projets du mois */
|
||||||
print '<br /><table class="noborder" width="100%">';
|
print '<br /><table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td width="50%">'.$langs->trans("Project").' cette année : '.strftime("%Y", $now).'</td>';
|
print '<td>'.$langs->trans("ActivityOnProjectThisYear").': '.strftime("%Y", $now).'</td>';
|
||||||
print '<td width="50%" align="right">'.$langs->trans("Hours").'</td>';
|
print '<td align="right">'.$langs->trans("Time").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$sql = "SELECT p.title, p.rowid, sum(tt.task_duration) as total";
|
$sql = "SELECT p.title, p.rowid, sum(tt.task_duration) as total";
|
||||||
@ -259,5 +259,6 @@ print "</table>";
|
|||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
llxFooter('$Date$ - $Revision$');
|
llxFooter('$Date$ - $Revision$');
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -54,8 +54,8 @@ print '<tr><td width="30%" valign="top" class="notopnoleft">';
|
|||||||
*/
|
*/
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre($langs->trans("Project"),"index.php","s.nom","","","",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Project"),$_SERVER["PHP_SELF"],"s.nom","","","",$sortfield,$sortorder);
|
||||||
print '<td align="center">'.$langs->trans("NbOpenTasks").'</td>';
|
print '<td align="right">'.$langs->trans("NbOpenTasks").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$sql = "SELECT p.title, p.rowid, count(t.rowid)";
|
$sql = "SELECT p.title, p.rowid, count(t.rowid)";
|
||||||
@ -85,7 +85,7 @@ if ( $resql )
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr $bc[$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><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
|
||||||
print '<td align="center">'.$row[2].'</td>';
|
print '<td align="right">'.$row[2].'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
@ -103,7 +103,7 @@ print "</table>";
|
|||||||
print '<br /><table class="noborder" width="100%">';
|
print '<br /><table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td width="50%">'.$langs->trans('Today').'</td>';
|
print '<td width="50%">'.$langs->trans('Today').'</td>';
|
||||||
print '<td width="50%" align="center">Temps</td>';
|
print '<td width="50%" align="right">'.$langs->trans("Time").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)";
|
$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)";
|
||||||
@ -126,7 +126,7 @@ if ( $resql )
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr $bc[$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><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
|
||||||
print '<td align="center">'.$row[2].'</td>';
|
print '<td align="right">'.$row[2].'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$total += $row[2];
|
$total += $row[2];
|
||||||
}
|
}
|
||||||
@ -139,7 +139,7 @@ else
|
|||||||
}
|
}
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
print '<td>'.$langs->trans('Total').'</td>';
|
print '<td>'.$langs->trans('Total').'</td>';
|
||||||
print '<td align="center">'.$total.'</td>';
|
print '<td align="right">'.$total.'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ print "</table>";
|
|||||||
print '<br /><table class="noborder" width="100%">';
|
print '<br /><table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td width="50%">'.$langs->trans('Yesterday').'</td>';
|
print '<td width="50%">'.$langs->trans('Yesterday').'</td>';
|
||||||
print '<td width="50%" align="center">Temps</td>';
|
print '<td width="50%" align="center">'.$langs->trans("Time").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)";
|
$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)";
|
||||||
@ -170,7 +170,7 @@ if ( $resql )
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr $bc[$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><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
|
||||||
print '<td align="center">'.$row[2].'</td>';
|
print '<td align="right">'.$row[2].'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$total += $row[2];
|
$total += $row[2];
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ else
|
|||||||
}
|
}
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
print '<td>'.$langs->trans('Total').'</td>';
|
print '<td>'.$langs->trans('Total').'</td>';
|
||||||
print '<td align="center">'.$total.'</td>';
|
print '<td align="right">'.$total.'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
@ -192,8 +192,8 @@ print '</td><td width="70%" valign="top" class="notopnoleft">';
|
|||||||
/* Affichage de la liste des projets de la semaine */
|
/* Affichage de la liste des projets de la semaine */
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td width="50%">Activité sur les projets cette semaine</td>';
|
print '<td>'.$langs->trans("ActivityOnProjectThisWeek").'</td>';
|
||||||
print '<td width="50%" align="center">Temps</td>';
|
print '<td align="right">'.$langs->trans("Time").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)";
|
$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)";
|
||||||
@ -215,7 +215,7 @@ if ( $resql )
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$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><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
|
||||||
print '<td align="center">'.$row[2].'</td>';
|
print '<td align="right">'.$row[2].'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$total += $row[2];
|
$total += $row[2];
|
||||||
}
|
}
|
||||||
@ -228,15 +228,15 @@ else
|
|||||||
}
|
}
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
print '<td>'.$langs->trans('Total').'</td>';
|
print '<td>'.$langs->trans('Total').'</td>';
|
||||||
print '<td align="center">'.$total.'</td>';
|
print '<td align="right">'.$total.'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
print "</table><br />";
|
print "</table><br />";
|
||||||
|
|
||||||
/* Affichage de la liste des projets du mois */
|
/* Affichage de la liste des projets du mois */
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td width="50%">'.$langs->trans("Project").' ce mois : '.strftime("%B %Y", $now).'</td>';
|
print '<td>'.$langs->trans("ActivityOnProjectThisMonth").': '.strftime("%B %Y", $now).'</td>';
|
||||||
print '<td width="50%" align="center">Nb heures</td>';
|
print '<td align="right">'.$langs->trans("Time").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)";
|
$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)";
|
||||||
@ -249,7 +249,7 @@ $sql .= " AND tt.fk_user = ".$user->id;
|
|||||||
$sql .= " AND month(task_date) = ".strftime("%m",$now);
|
$sql .= " AND month(task_date) = ".strftime("%m",$now);
|
||||||
$sql .= " GROUP BY p.rowid";
|
$sql .= " GROUP BY p.rowid";
|
||||||
|
|
||||||
$var=true;
|
$var=false;
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ( $resql )
|
if ( $resql )
|
||||||
{
|
{
|
||||||
@ -257,7 +257,7 @@ if ( $resql )
|
|||||||
{
|
{
|
||||||
print "<tr $bc[$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><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
|
||||||
print '<td align="center">'.$row[2].'</td>';
|
print '<td align="right">'.$row[2].'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
}
|
}
|
||||||
@ -272,8 +272,8 @@ print "</table>";
|
|||||||
/* Affichage de la liste des projets de l'année */
|
/* Affichage de la liste des projets de l'année */
|
||||||
print '<br /><table class="noborder" width="100%">';
|
print '<br /><table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td width="50%">'.$langs->trans("Project").' cette année : '.strftime("%Y", $now).'</td>';
|
print '<td>'.$langs->trans("ActivityOnProjectThisYear").': '.strftime("%Y", $now).'</td>';
|
||||||
print '<td width="50%" align="center">Nb heures</td>';
|
print '<td align="right">'.$langs->trans("Time").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)";
|
$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)";
|
||||||
@ -286,7 +286,7 @@ $sql .= " AND tt.fk_user = ".$user->id;
|
|||||||
$sql .= " AND YEAR(task_date) = ".strftime("%Y",$now);
|
$sql .= " AND YEAR(task_date) = ".strftime("%Y",$now);
|
||||||
$sql .= " GROUP BY p.rowid";
|
$sql .= " GROUP BY p.rowid";
|
||||||
|
|
||||||
$var=true;
|
$var=false;
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ( $resql )
|
if ( $resql )
|
||||||
{
|
{
|
||||||
@ -294,7 +294,7 @@ if ( $resql )
|
|||||||
{
|
{
|
||||||
print "<tr $bc[$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><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
|
||||||
print '<td align="center">'.$row[2].'</td>';
|
print '<td align="right">'.$row[2].'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
}
|
}
|
||||||
@ -310,5 +310,5 @@ print '</td></tr></table>';
|
|||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
llxFooter('$Date$ - $Revision$');
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2006 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
|
||||||
@ -16,148 +15,126 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
* $Source$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/projet/tasks/index.php
|
\file htdocs/projet/tasks/mytasks.php
|
||||||
\ingroup projet
|
\ingroup projet
|
||||||
\brief Page des taches du module projet
|
\brief Fiche tâches d'un projet
|
||||||
\version $Revision$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
|
|
||||||
if (!$user->rights->projet->lire) accessforbidden();
|
if (!$user->rights->projet->lire) accessforbidden();
|
||||||
|
|
||||||
// Sécurité accés client
|
$langs->load('projects');
|
||||||
if ($user->societe_id > 0)
|
|
||||||
|
Function PLines(&$inc, $parent, $lines, &$level, &$var)
|
||||||
{
|
{
|
||||||
$action = '';
|
$form = new Form($db); // $db est null ici mais inutile pour la fonction select_date()
|
||||||
$socid = $user->societe_id;
|
global $bc, $langs;
|
||||||
|
for ($i = 0 ; $i < sizeof($lines) ; $i++)
|
||||||
|
{
|
||||||
|
if ($parent == 0)
|
||||||
|
{
|
||||||
|
$level = 0;
|
||||||
|
$var = !$var;
|
||||||
}
|
}
|
||||||
|
|
||||||
llxHeader("",$langs->trans("Projects"),"Projet");
|
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";
|
||||||
|
|
||||||
print_fiche_titre($langs->trans("ProjectsArea"));
|
for ($k = 0 ; $k < $level ; $k++)
|
||||||
|
{
|
||||||
|
print " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<a href="task.php?id='.$lines[$i][2].'">'.$lines[$i][0]."</a></td>\n";
|
||||||
|
|
||||||
print '<table border="0" width="100%" class="notopnoleftnoright">';
|
$heure = intval($lines[$i][3]);
|
||||||
print '<tr><td width="30%" valign="top" class="notopnoleft">';
|
$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
|
||||||
* Affichage de la liste des projets
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
print '<table class="noborder" width="100%">';
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print_liste_field_titre($langs->trans("Project"),"index.php","s.nom","","","",$sortfield,$sortorder);
|
|
||||||
print '<td align="center">'.$langs->trans("NbOpenTasks").'</td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
$sql = "SELECT p.title, p.rowid, count(t.rowid)";
|
$h=0;
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user";
|
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/index.php';
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
|
$head[$h][1] = $langs->trans("Tasks");
|
||||||
$sql .= " , ".MAIN_DB_PREFIX."projet_task as t";
|
$h++;
|
||||||
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)
|
dolibarr_fiche_head($head, $hselected, $langs->trans("Tasks"));
|
||||||
{
|
|
||||||
$sql .= " AND s.rowid = ".$socid;
|
/* Liste des tâches */
|
||||||
}
|
|
||||||
$sql .= " GROUP BY p.rowid";
|
$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 .= " ORDER BY p.rowid, t.fk_task_parent";
|
||||||
|
|
||||||
$var=true;
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
$tasks = array();
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$row = $db->fetch_row( $resql);
|
$obj = $db->fetch_object($resql);
|
||||||
$var=!$var;
|
$tasks[$i][0] = $obj->title;
|
||||||
print "<tr $bc[$var]>";
|
$tasks[$i][1] = $obj->fk_task_parent;
|
||||||
print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
|
$tasks[$i][2] = $obj->rowid;
|
||||||
print '<td align="center">'.$row[2].'</td>';
|
$tasks[$i][3] = $obj->duration_effective;
|
||||||
print "</tr>\n";
|
$tasks[$i][4] = $obj->ptitle;
|
||||||
|
$tasks[$i][5] = $obj->prowid;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
$db->free();
|
||||||
$db->free($resql);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_print_error($db);
|
dolibarr_print_error($db);
|
||||||
}
|
}
|
||||||
print "</table>";
|
|
||||||
|
|
||||||
print '</td><td width="70%" valign="top" class="notopnoleft">';
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
* Affichage de la liste des projets
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","","",$sortfield,$sortorder);
|
print '<td>'.$langs->trans("Project").'</td>';
|
||||||
print '<td>Nb heures</td>';
|
print '<td>'.$langs->trans("Task").'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans("DurationEffective").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)";
|
|
||||||
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 .= " , ".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";
|
|
||||||
$sql .= " AND tt.fk_task = t.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 s.rowid = ".$socid;
|
|
||||||
}
|
|
||||||
$sql .= " GROUP BY p.rowid";
|
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
$resql = $db->query($sql);
|
|
||||||
if ( $resql )
|
|
||||||
{
|
|
||||||
$num = $db->num_rows($resql);
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
while ($i < $num)
|
PLines($j, 0, $tasks, $level, $var);
|
||||||
{
|
|
||||||
$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>'.$row[2].'</td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
$db->free($resql);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dolibarr_print_error($db);
|
|
||||||
}
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
print '</div>';
|
||||||
print '</td></tr></table>';
|
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
llxFooter('$Date$ - $Revision$');
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* 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
|
* 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
|
||||||
@ -14,16 +15,13 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
* $Source$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/projet/tasks/mytasks.php
|
\file htdocs/projet/tasks/mytasks.php
|
||||||
\ingroup projet
|
\ingroup projet
|
||||||
\brief Fiche tâches d'un projet
|
\brief Fiche tâches d'un projet
|
||||||
\version $Revision$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -37,17 +37,19 @@ llxHeader("",$langs->trans("Task"));
|
|||||||
|
|
||||||
if ($_GET["id"] > 0)
|
if ($_GET["id"] > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fiche projet en mode visu
|
* Fiche projet en mode visu
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
$task = new Task($db);
|
$task = new Task($db);
|
||||||
if ($task->fetch($_GET["id"]) == 0 )
|
if ($task->fetch($_GET["id"]) >= 0 )
|
||||||
{
|
{
|
||||||
$projet = new Project($db);
|
$projet = new Project($db);
|
||||||
$projet->fetch($task->projet_id);
|
$result=$projet->fetch($task->fk_projet);
|
||||||
$projet->societe->fetch($projet->societe->id);
|
if (! empty($projet->socid))
|
||||||
|
{
|
||||||
|
$projet->societe->fetch($projet->socid);
|
||||||
|
}
|
||||||
|
|
||||||
$h=0;
|
$h=0;
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/task.php?id='.$task->id;
|
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/task.php?id='.$task->id;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -14,49 +14,177 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
* $Source$
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/task.class.php
|
\file task.class.php
|
||||||
\ingroup projet
|
\ingroup project
|
||||||
\brief Fichier de la classe de gestion des taches
|
\brief This file is a CRUD class file for Taks (Create/Read/Update/Delete)
|
||||||
\version $Revision$
|
\version $Id$
|
||||||
|
\remarks Initialy built by build_class_from_table on 2008-09-10 12:41
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Put here all includes required by your class file
|
||||||
|
//require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php");
|
||||||
|
//require_once(DOL_DOCUMENT_ROOT."/societe.class.php");
|
||||||
|
//require_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\class Task
|
\class Projet_task
|
||||||
\brief Classe permettant la gestion des taches
|
\brief Put here description of your class
|
||||||
|
\remarks Initialy built by build_class_from_table on 2008-09-10 12:41
|
||||||
*/
|
*/
|
||||||
|
class Task // extends CommonObject
|
||||||
|
{
|
||||||
|
var $db; //!< To store db handler
|
||||||
|
var $error; //!< To return error code (or message)
|
||||||
|
var $errors=array(); //!< To return several error codes (or messages)
|
||||||
|
//var $element='projet_task'; //!< Id that identify managed objects
|
||||||
|
//var $table_element='projet_task'; //!< Name of table without prefix where object is stored
|
||||||
|
|
||||||
class Task {
|
|
||||||
var $id;
|
var $id;
|
||||||
var $db;
|
|
||||||
|
var $fk_projet;
|
||||||
|
var $fk_task_parent;
|
||||||
|
var $title;
|
||||||
|
var $duration_effective;
|
||||||
|
var $fk_user_creat;
|
||||||
|
var $statut;
|
||||||
|
var $note;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Constructeur de la classe
|
* \brief Constructor
|
||||||
* \param DB handler accès base de données
|
* \param DB Database handler
|
||||||
*/
|
*/
|
||||||
function Task($DB)
|
function Task($DB)
|
||||||
{
|
{
|
||||||
$this->db = $DB;
|
$this->db = $DB;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* \brief Charge objet projet depuis la base
|
/**
|
||||||
* \param rowid id du projet à charger
|
* \brief Create in database
|
||||||
|
* \param user User that create
|
||||||
|
* \param notrigger 0=launch triggers after, 1=disable triggers
|
||||||
|
* \return int <0 if KO, Id of created object if OK
|
||||||
*/
|
*/
|
||||||
|
function create($user, $notrigger=0)
|
||||||
function fetch($rowid)
|
|
||||||
{
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
$error=0;
|
||||||
|
|
||||||
$sql = "SELECT title, fk_projet, duration_effective, statut";
|
// Clean parameters
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task";
|
|
||||||
$sql .= " WHERE rowid=".$rowid;
|
|
||||||
|
|
||||||
|
if (isset($this->fk_projet)) $this->fk_projet=trim($this->fk_projet);
|
||||||
|
if (isset($this->fk_task_parent)) $this->fk_task_parent=trim($this->fk_task_parent);
|
||||||
|
if (isset($this->title)) $this->title=trim($this->title);
|
||||||
|
if (isset($this->duration_effective)) $this->duration_effective=trim($this->duration_effective);
|
||||||
|
if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat);
|
||||||
|
if (isset($this->statut)) $this->statut=trim($this->statut);
|
||||||
|
if (isset($this->note)) $this->note=trim($this->note);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
|
// Put here code to add control on parameters values
|
||||||
|
|
||||||
|
// Insert request
|
||||||
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task(";
|
||||||
|
|
||||||
|
$sql.= "fk_projet,";
|
||||||
|
$sql.= "fk_task_parent,";
|
||||||
|
$sql.= "title,";
|
||||||
|
$sql.= "duration_effective,";
|
||||||
|
$sql.= "fk_user_creat,";
|
||||||
|
$sql.= "statut,";
|
||||||
|
$sql.= "note";
|
||||||
|
|
||||||
|
|
||||||
|
$sql.= ") VALUES (";
|
||||||
|
|
||||||
|
$sql.= " ".(! isset($this->fk_projet)?'NULL':"'".$this->fk_projet."'").",";
|
||||||
|
$sql.= " ".(! isset($this->fk_task_parent)?'NULL':"'".$this->fk_task_parent."'").",";
|
||||||
|
$sql.= " ".(! isset($this->title)?'NULL':"'".$this->title."'").",";
|
||||||
|
$sql.= " ".(! isset($this->duration_effective)?'NULL':"'".$this->duration_effective."'").",";
|
||||||
|
$sql.= " ".(! isset($this->fk_user_creat)?'NULL':"'".$this->fk_user_creat."'").",";
|
||||||
|
$sql.= " ".(! isset($this->statut)?'NULL':"'".$this->statut."'").",";
|
||||||
|
$sql.= " ".(! isset($this->note)?'NULL':"'".$this->note."'")."";
|
||||||
|
|
||||||
|
|
||||||
|
$sql.= ")";
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
dolibarr_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task");
|
||||||
|
|
||||||
|
if (! $notrigger)
|
||||||
|
{
|
||||||
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
|
// want this action call a trigger.
|
||||||
|
|
||||||
|
//// Call triggers
|
||||||
|
//include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
||||||
|
//$interface=new Interfaces($this->db);
|
||||||
|
//$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
|
||||||
|
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||||
|
//// End call triggers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit or rollback
|
||||||
|
if ($error)
|
||||||
|
{
|
||||||
|
foreach($this->errors as $errmsg)
|
||||||
|
{
|
||||||
|
dolibarr_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
|
||||||
|
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||||
|
}
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1*$error;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Load object in memory from database
|
||||||
|
* \param id id object
|
||||||
|
* \return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function fetch($id)
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$sql = "SELECT";
|
||||||
|
$sql.= " t.rowid,";
|
||||||
|
|
||||||
|
$sql.= " t.fk_projet,";
|
||||||
|
$sql.= " t.fk_task_parent,";
|
||||||
|
$sql.= " t.title,";
|
||||||
|
$sql.= " t.duration_effective,";
|
||||||
|
$sql.= " t.fk_user_creat,";
|
||||||
|
$sql.= " t.statut,";
|
||||||
|
$sql.= " t.note";
|
||||||
|
|
||||||
|
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task as t";
|
||||||
|
$sql.= " WHERE t.rowid = ".$id;
|
||||||
|
|
||||||
|
dolibarr_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -64,25 +192,185 @@ class Task {
|
|||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
$this->id = $rowid;
|
$this->id = $obj->rowid;
|
||||||
$this->title = $obj->title;
|
|
||||||
$this->statut = $obj->statut;
|
|
||||||
$this->projet_id = $obj->fk_projet;
|
|
||||||
|
|
||||||
|
$this->fk_projet = $obj->fk_projet;
|
||||||
|
$this->fk_task_parent = $obj->fk_task_parent;
|
||||||
|
$this->title = $obj->title;
|
||||||
|
$this->duration_effective = $obj->duration_effective;
|
||||||
|
$this->fk_user_creat = $obj->fk_user_creat;
|
||||||
|
$this->statut = $obj->statut;
|
||||||
|
$this->note = $obj->note;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$this->error="Error ".$this->db->lasterror();
|
||||||
|
dolibarr_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Update database
|
||||||
|
* \param user User that modify
|
||||||
|
* \param notrigger 0=launch triggers after, 1=disable triggers
|
||||||
|
* \return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function update($user=0, $notrigger=0)
|
||||||
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
// Clean parameters
|
||||||
|
|
||||||
|
if (isset($this->fk_projet)) $this->fk_projet=trim($this->fk_projet);
|
||||||
|
if (isset($this->fk_task_parent)) $this->fk_task_parent=trim($this->fk_task_parent);
|
||||||
|
if (isset($this->title)) $this->title=trim($this->title);
|
||||||
|
if (isset($this->duration_effective)) $this->duration_effective=trim($this->duration_effective);
|
||||||
|
if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat);
|
||||||
|
if (isset($this->statut)) $this->statut=trim($this->statut);
|
||||||
|
if (isset($this->note)) $this->note=trim($this->note);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
|
// Put here code to add control on parameters values
|
||||||
|
|
||||||
|
// Update request
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."projet_task SET";
|
||||||
|
|
||||||
|
$sql.= " fk_projet=".(isset($this->fk_projet)?$this->fk_projet:"null").",";
|
||||||
|
$sql.= " fk_task_parent=".(isset($this->fk_task_parent)?$this->fk_task_parent:"null").",";
|
||||||
|
$sql.= " title=".(isset($this->title)?"'".addslashes($this->title)."'":"null").",";
|
||||||
|
$sql.= " duration_effective=".(isset($this->duration_effective)?$this->duration_effective:"null").",";
|
||||||
|
$sql.= " fk_user_creat=".(isset($this->fk_user_creat)?$this->fk_user_creat:"null").",";
|
||||||
|
$sql.= " statut=".(isset($this->statut)?$this->statut:"null").",";
|
||||||
|
$sql.= " note=".(isset($this->note)?"'".addslashes($this->note)."'":"null")."";
|
||||||
|
|
||||||
|
|
||||||
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
dolibarr_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
if (! $notrigger)
|
||||||
|
{
|
||||||
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
|
// want this action call a trigger.
|
||||||
|
|
||||||
|
//// Call triggers
|
||||||
|
//include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
||||||
|
//$interface=new Interfaces($this->db);
|
||||||
|
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
|
||||||
|
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||||
|
//// End call triggers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit or rollback
|
||||||
|
if ($error)
|
||||||
|
{
|
||||||
|
foreach($this->errors as $errmsg)
|
||||||
|
{
|
||||||
|
dolibarr_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||||
|
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||||
|
}
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1*$error;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $this->db->error();
|
$this->db->commit();
|
||||||
return -2;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Delete object in database
|
||||||
|
* \param user User that delete
|
||||||
|
* \param notrigger 0=launch triggers after, 1=disable triggers
|
||||||
|
* \return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function delete($user, $notrigger=0)
|
||||||
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task";
|
||||||
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
dolibarr_syslog(get_class($this)."::delete sql=".$sql);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
if (! $notrigger)
|
||||||
|
{
|
||||||
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
|
// want this action call a trigger.
|
||||||
|
|
||||||
|
//// Call triggers
|
||||||
|
//include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
||||||
|
//$interface=new Interfaces($this->db);
|
||||||
|
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
|
||||||
|
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||||
|
//// End call triggers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit or rollback
|
||||||
|
if ($error)
|
||||||
|
{
|
||||||
|
foreach($this->errors as $errmsg)
|
||||||
|
{
|
||||||
|
dolibarr_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||||
|
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||||
|
}
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1*$error;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Initialise object with example values
|
||||||
|
* \remarks id must be 0 if object instance is a specimen.
|
||||||
|
*/
|
||||||
|
function initAsSpecimen()
|
||||||
|
{
|
||||||
|
$this->id=0;
|
||||||
|
|
||||||
|
$this->fk_projet='';
|
||||||
|
$this->fk_task_parent='';
|
||||||
|
$this->title='';
|
||||||
|
$this->duration_effective='';
|
||||||
|
$this->fk_user_creat='';
|
||||||
|
$this->statut='';
|
||||||
|
$this->note='';
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
Loading…
Reference in New Issue
Block a user