diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php index d8739c22b08..0dd82650127 100644 --- a/htdocs/projet/fiche.php +++ b/htdocs/projet/fiche.php @@ -211,22 +211,42 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer) // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + if ($ret < 0) + { + $error++; + } + } - $result=$object->update($user); + if (! $error) + { + $result=$object->update($user); + if ($result < 0) + { + $error++; + setEventMessage($object->errors,'errors'); + } + } - if (GETPOST("reportdate") && ($object->date_start!=$old_start_date)) - { - $result=$object->shiftTaskDate($old_start_date); - if (!$result) - { - $error++; - $mesg='
'.$langs->trans("ErrorShiftTaskDate").':'.$object->error.'
'; - } - } + if (! $error) + { + if (GETPOST("reportdate") && ($object->date_start!=$old_start_date)) + { + $result=$object->shiftTaskDate($old_start_date); + if ($result < 0) + { + $error++; + $mesg='
'.$langs->trans("ErrorShiftTaskDate").':'.$object->error.'
'; + } + } + } + + if ($error) + { + $action='edit'; } else - { - $action='edit'; + { + $object->societe->fetch(GETPOST('socid','int')); } }