Clean code

This commit is contained in:
Laurent Destailleur 2024-02-19 10:16:50 +01:00
parent 008b357825
commit 5e4be61e7a
3 changed files with 16 additions and 10 deletions

View file

@ -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__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag=undefinedtag&securitykey='.dol_hash(getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY')."-undefinedtag", 'md5').'" width="1" height="1" style="width:1px;height:1px" border="0" />',
);

View file

@ -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();
}
});
});
</script>
@ -1510,6 +1512,8 @@ class FormMail extends Form
*/
public function getModelEmailTemplate()
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/emaillayout.lib.php';
$out = '<div id="template-selector" class="template-container hidden">';
$templates = array(
'empty' => 'empty',

View file

@ -18,7 +18,7 @@
*/
/**
* \file htdocs/core/lib/emailmodel.lib.php
* \file htdocs/core/lib/emaillayout.lib.php
* \brief File for getting email html models
*/