From 2ef93c4d09795b77a2c1b3fcfeaa1d706a7b3330 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Jun 2011 21:55:07 +0000 Subject: [PATCH] Auto detect if it's error message or not --- htdocs/lib/functions.lib.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index bfb074c71af..e410561526f 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -3814,7 +3814,14 @@ function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb if (empty($mesgstring) && (! is_array($mesgarray) || sizeof($mesgarray) == 0)) return; $iserror=0; - if (preg_match('/class="error"/i',$mesgstring)) $iserror++; + if (is_array($mesg_array)) + { + foreach($mesg_array as $val) + { + if ($val && preg_match('/class="error"/i',$val)) { $iserror++; break; } + } + } + else if ($mesgstring && preg_match('/class="error"/i',$mesgstring)) $iserror++; if ($style=='error') $iserror++; if ($iserror) print get_htmloutput_mesg($mesgstring,$mesgarray,'error',$keepembedded);