Qual: Removed codesniffer errors

This commit is contained in:
Laurent Destailleur 2011-09-20 15:59:46 +00:00
parent 9e60295d9e
commit 0661264947

View File

@ -51,41 +51,41 @@ $result = restrictedArea($user, 'projet', $projectid);
if ($_POST["action"] == 'addtime' && $user->rights->projet->creer) if ($_POST["action"] == 'addtime' && $user->rights->projet->creer)
{ {
$task = new Task($db); $task = new Task($db);
$timespent_duration=0;
foreach($_POST as $key => $time)
{
if(intval($time)>0)
{
// Hours or minutes
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 $timespent_duration=0;
if($matches[2]=='min') $timespent_duration += $time*60;
} foreach($_POST as $key => $time)
} {
} if(intval($time)>0)
{
if ($timespent_duration > 0) // Hours or minutes
{ if(preg_match("/([0-9]+)(hour|min)/",$key,$matches))
$task->fetch($id); {
$task->timespent_duration = $timespent_duration; $id = $matches[1];
$task->timespent_fk_user = $user->id;
$task->timespent_date = dol_mktime(12,0,0,$_POST["{$id}month"],$_POST["{$id}day"],$_POST["{$id}year"]); // We store HOURS in seconds
$task->addTimeSpent($user); if($matches[2]=='hour') $timespent_duration += $time*60*60;
}
else // We store MINUTES in seconds
{ if($matches[2]=='min') $timespent_duration += $time*60;
$mesg='<div class="error">'.$langs->trans("ErrorTimeSpentIsEmpty").'</div>'; }
} }
} }
if ($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);
}
else
{
$mesg='<div class="error">'.$langs->trans("ErrorTimeSpentIsEmpty").'</div>';
}
}
/* /*
* View * View
@ -107,8 +107,8 @@ $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1); // R
if ($_GET["id"]) if ($_GET["id"])
{ {
$project->fetch($_GET["id"]); $project->fetch($_GET["id"]);
$project->societe->fetch($project->societe->id); $project->societe->fetch($project->societe->id);
} }
$tasksarray=$taskstatic->getTasksArray(0,0,($project->id?$project->id:$projectsListId),$socid,0); // We want to see all task of project i am allowed to see, not only mine. Later only mine will be editable later. $tasksarray=$taskstatic->getTasksArray(0,0,($project->id?$project->id:$projectsListId),$socid,0); // We want to see all task of project i am allowed to see, not only mine. Later only mine will be editable later.