From 12d91d7444ecca97d8e6526e6f7302b6ea1c52b6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Dec 2017 18:26:27 +0100 Subject: [PATCH] Fix missing messages in error report. Fix test on non empty array --- dev/setup/codesniffer/ruleset.xml | 2 +- htdocs/core/class/html.formmail.class.php | 2 +- htdocs/core/lib/functions.lib.php | 10 +++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index b8cb751fe9e..e5485b280ae 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -131,7 +131,7 @@ - + diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index a3a37c86e8c..30719d0da80 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -755,7 +755,7 @@ class FormMail extends Form $defaulttopic=GETPOST('subject','none'); if (! GETPOST('modelselected','alpha') || GETPOST('modelmailselected') != '-1') { - if (count($arraydefaultmessage) > 0 && $arraydefaultmessage['topic']) $defaulttopic=$arraydefaultmessage['topic']; + if (is_array($arraydefaultmessage) && count($arraydefaultmessage) > 0 && $arraydefaultmessage['topic']) $defaulttopic=$arraydefaultmessage['topic']; elseif (! is_numeric($this->withtopic)) $defaulttopic=$this->withtopic; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4cb19f6dc7e..38da587cef0 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3492,9 +3492,10 @@ function dol_print_error($db='',$error='',$errors=null) * * @param string $prefixcode Prefix of public error code * @param string $errormessage Complete error message + * @param array $errormessages Array of error messages * @return void */ -function dol_print_error_email($prefixcode, $errormessage='') +function dol_print_error_email($prefixcode, $errormessage='', $errormessages=array()) { global $langs,$conf; @@ -3503,6 +3504,13 @@ function dol_print_error_email($prefixcode, $errormessage='') print '
'; print $langs->trans("ErrorContactEMail", $conf->global->MAIN_INFO_SOCIETE_MAIL, $prefixcode.dol_print_date($now,'%Y%m%d')); if ($errormessage) print '

'.$errormessage; + if (is_array($errormessages) && count($errormessages)) + { + foreach($errormessages as $mesgtoshow) + { + print '

'.$mesgtoshow; + } + } print '
'; }