From d9e81cbabe281684d3c1a834eee2e4c91c884695 Mon Sep 17 00:00:00 2001 From: Alexandre Janniaux Date: Sun, 19 Nov 2023 14:56:25 +0100 Subject: [PATCH] command: forward database error on failure If the database triggered a failure, it wasn't reported in the tests because $this->error was not set. Conversely, the error was always printed through dol_print_error() whose documentation explicitely states that it should not be used for class and $this->error should be used instead. --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 99024dca83f..5ec0a3374d1 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1191,7 +1191,7 @@ class Commande extends CommonOrder return 0; } else { - dol_print_error($this->db); + $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; }