diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 216702da9ed..a4a270f5227 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -259,10 +259,6 @@ if (empty($reshook)) { } $id = $object->create($user); - if ($id < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } - if ($id > 0) { dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); @@ -374,6 +370,9 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); $error++; } + if ($error) { + $action = 'create'; + } } else { $result = $object->create($user); if ($result > 0) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 93353f91e07..bd8ab4c22f4 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7915,7 +7915,7 @@ abstract class CommonObject // a first td column was already output (and may be another on before if MAIN_VIEW_LINE_NUMBER set), so this td is the next one $out .= '