From 8d7f24a6d9b52e321f797632b583bbdc6a3657f3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 May 2019 15:34:29 +0200 Subject: [PATCH] FIX Default value on form to send email --- htdocs/core/class/html.formmail.class.php | 4 ++-- htdocs/core/lib/functions.lib.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index bf03477643b..d455d1058fc 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -711,7 +711,7 @@ class FormMail extends Form } else { - $out.= 'withtocc) : (isset($_POST["sendtocc"])?$_POST["sendtocc"]:"") ).'" />'; + $out.= 'withtocc) && ! is_numeric($this->withtocc)) ? $this->withtocc : '')).'" />'; if (! empty($this->withtocc) && is_array($this->withtocc)) { $out.= " ".$langs->trans("and")."/".$langs->trans("or")." "; @@ -762,7 +762,7 @@ class FormMail extends Form } else { - $out.= 'withtoccc) : (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:"") ).'" />'; + $out.= 'withtoccc) && ! is_numeric($this->withtoccc)) ? $this->withtoccc : '')).'" />'; if (! empty($this->withtoccc) && is_array($this->withtoccc)) { $out.= " ".$langs->trans("and")."/".$langs->trans("or")." "; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8c3393dd08e..570d00ef2bd 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -349,7 +349,7 @@ function GETPOST($paramname, $check='none', $method=0, $filter=null, $options=nu } if (! empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) { - if (! empty($_GET['action']) && $_GET['action'] == 'create' && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname])) + if (! empty($_GET['action']) && (preg_match('/^create/', $_GET['action']) || preg_match('/^presend/', $_GET['action'])) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname])) { // Now search in setup to overwrite default values if (! empty($user->default_values)) // $user->default_values defined from menu 'Setup - Default values'