From c13648e96deab7caa38acf956cea72ad45c8b030 Mon Sep 17 00:00:00 2001 From: w3houde Date: Sun, 31 May 2026 04:11:10 +0700 Subject: [PATCH] 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 Co-authored-by: Dolicraft --- htdocs/fichinter/card.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index ae0e59426b2..1a91f1eca4b 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -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