Fix edit of progess only

This commit is contained in:
Laurent Destailleur 2016-07-09 14:28:33 +02:00
parent 0e4dcb301c
commit 03dbf6e747
2 changed files with 27 additions and 7 deletions

View File

@ -100,7 +100,7 @@ if (GETPOST('submitdateselect'))
$action = ''; $action = '';
} }
if ($action == 'addtime' && GETPOST('assigntask')) if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask'))
{ {
$action = 'assigntask'; $action = 'assigntask';
@ -185,9 +185,10 @@ if ($action == 'addtime' && $user->rights->projet->lire)
} }
else else
{ {
foreach($timetoadd as $taskid => $value) foreach($timetoadd as $taskid => $value) // Loop on each task
{ {
foreach($value as $key => $val) $updateoftaskdone=0;
foreach($value as $key => $val) // Loop on each day
{ {
$amountoadd=$timetoadd[$taskid][$key]; $amountoadd=$timetoadd[$taskid][$key];
if (! empty($amountoadd)) if (! empty($amountoadd))
@ -213,6 +214,25 @@ if ($action == 'addtime' && $user->rights->projet->lire)
$error++; $error++;
break; break;
} }
$updateoftaskdone++;
}
}
}
if (! $updateoftaskdone) // Check to update progress if no update were done on task.
{
$object->fetch($taskid);
//var_dump($object->progress);var_dump(GETPOST($taskid . 'progress', 'int')); exit;
if ($object->progress != GETPOST($taskid . 'progress', 'int'))
{
$object->progress = GETPOST($taskid . 'progress', 'int');
$result=$object->update($user);
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
break;
} }
} }
} }