From 8cdddcbafb9326741fc860ee5464041001d3216a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Mar 2026 17:11:10 +0100 Subject: [PATCH] Fir return of array error --- htdocs/core/class/commoninvoice.class.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 59b8649d456..7c3e0223ff4 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -786,9 +786,10 @@ abstract class CommonInvoice extends CommonObject if (!empty($hookmanager->resArray['result'])) { $this->error = $hookmanager->resArray['error']; if (!empty($hookmanager->resArray['errors'])) { - $this->errors = array_merge($this->errors, array($this->error), $hookmanager->resArray['errors']); - } else { - $this->errors = array_merge($this->errors, array($this->error)); + $this->errors = array_merge($this->errors, $hookmanager->resArray['errors']); + } + if (!in_array($this->error, $this->errors)) { + $this->errors[] = $this->error; } return $hookmanager->resArray['result']; } @@ -893,9 +894,10 @@ abstract class CommonInvoice extends CommonObject if (!empty($hookmanager->resArray['result'])) { $this->error = $hookmanager->resArray['error']; if (!empty($hookmanager->resArray['errors'])) { - $this->errors = array_merge($this->errors, array($this->error), $hookmanager->resArray['errors']); - } else { - $this->errors = array_merge($this->errors, array($this->error)); + $this->errors = array_merge($this->errors, $hookmanager->resArray['errors']); + } + if (!in_array($this->error, $this->errors)) { + $this->errors[] = $this->error; } return $hookmanager->resArray['result']; }