From ef7f607978c400d7d6d4972d85e25169b0595f3c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Jan 2025 12:21:06 +0100 Subject: [PATCH 1/2] Debug v23 --- htdocs/blockedlog/class/blockedlog.class.php | 4 ++-- htdocs/core/actions_sendmails.inc.php | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 6c0efef5010..e0ae80c5182 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -477,11 +477,11 @@ class BlockedLog /** * Populate properties of an unalterable log entry from object data. - * This populates ->object_data but also other fields like ->action, ->module_source, ->amounts_taxexcl, ->amounts and ->linktoref and ->linktype + * This populates ->object_data but also other fields like ->action, ->module_source, ->amounts_taxexcl, ->amounts and ->linktoref and ->linktype * It also populates some debug info like ->element and ->fk_object * * @param CommonObject|stdClass $object Object to store - * @param string $action Action code + * @param string $action Action code ('BILL_VALIDATE', 'BILL_SENTBYMAIL', ...) * @param float|int $amounts amounts (incl tax) * @param ?User $fuser User object (forced) * @param float|int|null $amounts_taxexcl amounts (excl tax or null if not relevant) diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 8bd0321bb77..55abd2927fb 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -346,7 +346,10 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO $from = dol_string_nospecial(GETPOST('fromname'), ' ', array(",")).' <'.GETPOST('frommail').'>'; } - $replyto = dol_string_nospecial(GETPOST('replytoname'), ' ', array(",")).' <'.GETPOST('replytomail').'>'; + $replyto = ''; + if (GETPOST('replytoname')) { + $replyto = dol_string_nospecial(GETPOST('replytoname'), ' ', array(",")).' <'.GETPOST('replytomail').'>'; + } $message = GETPOST('message', 'restricthtml'); $subject = GETPOST('subject', 'restricthtml'); @@ -412,7 +415,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO if (empty($sendcontext)) { $sendcontext = 'standard'; } - $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1, '', '', $trackid, '', $sendcontext, '', $upload_dir_tmp); + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1, '', '', $trackid, '', $sendcontext, $replyto, $upload_dir_tmp); if (!empty($mailfile->error) || !empty($mailfile->errors)) { setEventMessages($mailfile->error, $mailfile->errors, 'errors'); From 717af9730733df7790e6ea8dfb7460d29750271a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Jan 2025 12:29:00 +0100 Subject: [PATCH 2/2] Fix reply to --- htdocs/core/actions_sendmails.inc.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 55abd2927fb..435c0c51d27 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -314,11 +314,11 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO $fromtype = GETPOST('fromtype', 'alpha'); $emailsendersignature = ''; if ($fromtype === 'robot') { - $from = dol_string_nospecial($conf->global->MAIN_MAIL_EMAIL_FROM, ' ', array(",")).' <' . getDolGlobalString('MAIN_MAIL_EMAIL_FROM').'>'; + $from = dol_string_nospecial(getDolGlobalString('MAIN_MAIL_EMAIL_FROM'), ' ', array(",")).' <' . getDolGlobalString('MAIN_MAIL_EMAIL_FROM').'>'; } elseif ($fromtype === 'user') { $from = dol_string_nospecial($user->getFullName($langs), ' ', array(",")).' <'.$user->email.'>'; } elseif ($fromtype === 'company') { - $from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")).' <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>'; + $from = dol_string_nospecial(getDolGlobalString('MAIN_INFO_SOCIETE_NOM'), ' ', array(",")).' <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>'; } elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) { $tmp = explode(',', $user->email_aliases); $from = trim($tmp[((int) $reg[1] - 1)]); @@ -347,8 +347,9 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO } $replyto = ''; - if (GETPOST('replytoname')) { - $replyto = dol_string_nospecial(GETPOST('replytoname'), ' ', array(",")).' <'.GETPOST('replytomail').'>'; + if (GETPOST('replytomail')) { + $replyto = dol_string_nospecial(GETPOST('replytoname'), ' ', array(",")); + $replyto .= ($replyto ? ' ' : '').'<'.GETPOST('replytomail').'>'; } $message = GETPOST('message', 'restricthtml');