From 5e4be61e7a6767d0cda69ee7b9834ebcf15779c1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Feb 2024 10:16:50 +0100 Subject: [PATCH] Clean code --- htdocs/admin/mails.php | 16 +++++++++------- htdocs/core/class/html.formmail.class.php | 8 ++++++-- .../{modelemail.lib.php => emaillayout.lib.php} | 2 +- 3 files changed, 16 insertions(+), 10 deletions(-) rename htdocs/core/lib/{modelemail.lib.php => emaillayout.lib.php} (99%) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 4a28967633b..f5053296411 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -50,16 +50,18 @@ if ($action == 'test' || ($action == 'send' && $trackid = 'test')) { $substitutionarrayfortest = array( '__USER_LOGIN__' => $user->login, '__USER_EMAIL__' => $user->email, + '__USER_FIRSTNAME__' => $user->firstname, + '__USER_LASTNAME__' => $user->lastname, '__USER_SIGNATURE__' => (($user->signature && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? $usersignature : ''), // Done into actions_sendmails '__SENDEREMAIL_SIGNATURE__' => (($user->signature && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? $usersignature : ''), // Done into actions_sendmails - '__ID__' => 'RecipientID', + //'__ID__' => 'RecipientID', //'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails - '__LASTNAME__' => 'RecipientLastname', - '__FIRSTNAME__' => 'RecipientFirstname', - '__ADDRESS__'=> 'RecipientAddress', - '__ZIP__'=> 'RecipientZip', - '__TOWN_'=> 'RecipientTown', - '__COUNTRY__'=> 'RecipientCountry', + '__LASTNAME__' => $langs->trans("Lastname").' ('.$langs->trans("Recipient").')', + '__FIRSTNAME__' => $langs->trans("Firstname").' ('.$langs->trans("Recipient").')', + //'__ADDRESS__'=> $langs->trans("Address").' ('.$langs->trans("Recipient").')', + //'__ZIP__'=> $langs->trans("Zip").' ('.$langs->trans("Recipient").')', + //'__TOWN_'=> $langs->trans("Town").' ('.$langs->trans("Recipient").')', + //'__COUNTRY__'=> $langs->trans("Country").' ('.$langs->trans("Recipient").')', '__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT, '__CHECK_READ__' => '', ); diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index f1f68659748..902a112a91f 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -29,8 +29,6 @@ * \brief Fichier de la class permettant la generation du formulaire html d'envoi de mail unitaire */ require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/modelemail.lib.php'; - /** @@ -1039,6 +1037,10 @@ class FormMail extends Form event.preventDefault(); jQuery("#ai_input").toggle(); jQuery("#template-selector").hide(); + if (!jQuery("ai_input").is(":hidden")) { + console.log("Set focus on input field"); + jQuery("#ai_instructions").focus(); + } }); }); @@ -1510,6 +1512,8 @@ class FormMail extends Form */ public function getModelEmailTemplate() { + require_once DOL_DOCUMENT_ROOT.'/core/lib/emaillayout.lib.php'; + $out = '