Fix: Missing column
Fix: Line was not added correctly Fix: Missing message
This commit is contained in:
parent
0587ad5af8
commit
922929fffb
@ -1,28 +1,28 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/lib/project.lib.php
|
||||
* \brief Functions used by project module
|
||||
* \ingroup project
|
||||
*/
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
|
||||
|
||||
@ -473,19 +473,24 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
|
||||
print '</td>';
|
||||
|
||||
// Planned Workload
|
||||
print '<td align="center">';
|
||||
if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'all');
|
||||
print '<td align="right">';
|
||||
if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin');
|
||||
else print '--:--';
|
||||
print '</td>';
|
||||
|
||||
// Progress
|
||||
// Progress declared %
|
||||
print '<td align="right">';
|
||||
print $lines[$i]->progress.' %';
|
||||
print '</td>';
|
||||
|
||||
// Time spent
|
||||
print '<td align="right">';
|
||||
if ($lines[$i]->duration) print convertSecondToTime($lines[$i]->duration,'all');
|
||||
if ($lines[$i]->duration)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.'">';
|
||||
print convertSecondToTime($lines[$i]->duration,'allhourmin');
|
||||
print '</a>';
|
||||
}
|
||||
else print '--:--';
|
||||
print "</td>\n";
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010 François Legastelois <flegastelois@teclib.com>
|
||||
*
|
||||
@ -56,35 +56,42 @@ if ($action == 'addtime' && $user->rights->projet->creer)
|
||||
{
|
||||
$task = new Task($db);
|
||||
|
||||
$timespent_duration=0;
|
||||
$timespent_duration=array();
|
||||
|
||||
foreach($_POST as $key => $time)
|
||||
{
|
||||
if(intval($time)>0)
|
||||
if (intval($time) > 0)
|
||||
{
|
||||
// Hours or minutes
|
||||
if(preg_match("/([0-9]+)(hour|min)/",$key,$matches))
|
||||
if (preg_match("/([0-9]+)(hour|min)/",$key,$matches))
|
||||
{
|
||||
$id = $matches[1];
|
||||
|
||||
// We store HOURS in seconds
|
||||
if($matches[2]=='hour') $timespent_duration += $time*60*60;
|
||||
|
||||
// We store MINUTES in seconds
|
||||
if($matches[2]=='min') $timespent_duration += $time*60;
|
||||
if ($id > 0)
|
||||
{
|
||||
// We store HOURS in seconds
|
||||
if($matches[2]=='hour') $timespent_duration[$id] += $time*60*60;
|
||||
|
||||
// We store MINUTES in seconds
|
||||
if($matches[2]=='min') $timespent_duration[$id] += $time*60;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($timespent_duration > 0)
|
||||
if (count($timespent_duration) > 0)
|
||||
{
|
||||
$task->fetch($id);
|
||||
$task->timespent_duration = $timespent_duration;
|
||||
$task->timespent_fk_user = $user->id;
|
||||
$task->timespent_date = dol_mktime(12,0,0,$_POST["{$id}month"],$_POST["{$id}day"],$_POST["{$id}year"]);
|
||||
$task->addTimeSpent($user);
|
||||
|
||||
// header to avoid submit twice on back
|
||||
foreach($timespent_duration as $key => $val)
|
||||
{
|
||||
$task->fetch($key);
|
||||
$task->timespent_duration = $val;
|
||||
$task->timespent_fk_user = $user->id;
|
||||
$task->timespent_date = dol_mktime(12,0,0,$_POST["{$key}month"],$_POST["{$key}day"],$_POST["{$key}year"]);
|
||||
$task->addTimeSpent($user);
|
||||
}
|
||||
|
||||
setEventMessage($langs->trans("RecordSaved"));
|
||||
|
||||
// Redirect to avoid submit twice on back
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$projectid.($mode?'&mode='.$mode:''));
|
||||
exit;
|
||||
}
|
||||
@ -144,6 +151,7 @@ print '<td>'.$langs->trans("RefTask").'</td>';
|
||||
print '<td>'.$langs->trans("LabelTask").'</td>';
|
||||
print '<td align="center">'.$langs->trans("DateStart").'</td>';
|
||||
print '<td align="center">'.$langs->trans("DateEnd").'</td>';
|
||||
print '<td align="right">'.$langs->trans("PlannedWorkload").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Progress").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
|
||||
print '<td colspan="2">'.$langs->trans("AddDuration").'</td>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user