From 3a400c46adeb32582c99c4b8b986bd90ade33d90 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Jun 2017 10:15:32 +0200 Subject: [PATCH] Fix preselected email not done --- htdocs/core/class/html.formmail.class.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index d59ac6c25af..d6089ebdb54 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -528,7 +528,12 @@ class FormMail extends Form { $tmparray[$key]=dol_htmlentities($tmparray[$key], null, 'UTF-8', true); } - $out.= $form->multiselectarray("receiver", $tmparray, GETPOST("receiver"), null, null, 'inline-block minwidth500', null, ""); + $withtoselected=GETPOST("receiver"); // Array of selected value + if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action') == 'presend') + { + $withtoselected = array_keys($tmparray); + } + $out.= $form->multiselectarray("receiver", $tmparray, $withtoselected, null, null, 'inline-block minwidth500', null, ""); } } $out.= "\n"; @@ -556,7 +561,8 @@ class FormMail extends Form { $tmparray[$key]=dol_htmlentities($tmparray[$key], null, 'UTF-8', true); } - $out.= $form->multiselectarray("receivercc", $tmparray, GETPOST("receivercc"), null, null, 'inline-block minwidth500',null, ""); + $withtoccselected=GETPOST("receivercc"); // Array of selected value + $out.= $form->multiselectarray("receivercc", $tmparray, $withtoccselected, null, null, 'inline-block minwidth500',null, ""); } } $out.= "\n"; @@ -584,8 +590,8 @@ class FormMail extends Form { $tmparray[$key]=dol_htmlentities($tmparray[$key], null, 'UTF-8', true); } - //$out.= $form->selectarray("receiverccc", $this->withtoccc, GETPOST("receiverccc"), 1); - $out.= $form->multiselectarray("receiverccc", $tmparray, GETPOST("receiverccc"), null, null, null,null, "90%"); + $withtocccselected=GETPOST("receiverccc"); // Array of selected value + $out.= $form->multiselectarray("receiverccc", $tmparray, $withtocccselected, null, null, null,null, "90%"); } }