2
0
forked from Wavyzz/dolibarr

Auto detect if it's error message or not

This commit is contained in:
Laurent Destailleur
2011-06-20 21:55:07 +00:00
parent 9c12355ec5
commit 2ef93c4d09

View File

@@ -3814,7 +3814,14 @@ function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb
if (empty($mesgstring) && (! is_array($mesgarray) || sizeof($mesgarray) == 0)) return; if (empty($mesgstring) && (! is_array($mesgarray) || sizeof($mesgarray) == 0)) return;
$iserror=0; $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 ($style=='error') $iserror++;
if ($iserror) print get_htmloutput_mesg($mesgstring,$mesgarray,'error',$keepembedded); if ($iserror) print get_htmloutput_mesg($mesgstring,$mesgarray,'error',$keepembedded);