Fix #38482 Show validation error on intervention line update inline (#38519)

Updating a line of an intervention with an invalid value (typical
case: a mandatory extrafield left empty) made the page bail out with
"dol_print_error + exit", which renders the generic Dolibarr error
screen and loses the user's edit context.

Replace the bail out with a setEventMessages on the same page,
matching the pattern already used everywhere else in
fichinter/card.php (object->error, object->errors, 'errors'). The
caller stays on the intervention card, sees the validation message
and can correct the field without losing what was being typed.

Reported by @Timoune974 with the patch sketch already in the issue.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
This commit is contained in:
w3houde 2026-05-31 04:11:10 +07:00 committed by GitHub
parent 59dfe19a46
commit c13648e96d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -697,8 +697,10 @@ if (empty($reshook)) {
$result = $objectline->update($user);
if ($result < 0) {
dol_print_error($db);
exit;
// Surface validation errors (e.g. mandatory extrafield left empty) as an
// event message on the same page instead of breaking with a full Dolibarr
// error screen that loses the user's edit context.
setEventMessages($objectline->error, $objectline->errors, 'errors');
}
// Define output language