From b3f7ea4f5ab7e81d91185d2386f826a22e602680 Mon Sep 17 00:00:00 2001 From: Sami Date: Thu, 10 Oct 2024 11:17:21 +0200 Subject: [PATCH 1/3] update --- htdocs/core/actions_massactions.inc.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index c7de54e22e078..f62ca728eb8e8 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -488,6 +488,20 @@ complete_substitutions_array($substitutionarray, $langs, $objecttmp, $parameters); + $contactarr = $objecttmp->liste_contact(-1, 'external', 0, '', 1); + + if (is_array($contactarr) && count($contactarr) > 0) { + $contactstatic = new Contact($db); + foreach ($contactarr as $contact) { + $contactstatic->fetch($contact['id']); + + $substitutionarray['__CONTACT_NAME_'.$contact['code'].'__'] = $contactstatic->getFullName($langs, 1); + $substitutionarray['__CONTACT_LASTNAME_'.$contact['code'].'__'] = $contactstatic->lastname; + $substitutionarray['__CONTACT_FIRSTNAME_'.$contact['code'].'__'] = $contactstatic->firstname; + $substitutionarray['__CONTACT_TITLE_'.$contact['code'].'__'] = $contactstatic->getCivilityLabel(); + } + } + $subjectreplaced = make_substitutions($subject, $substitutionarray); $messagereplaced = make_substitutions($message, $substitutionarray); From c3694b60c0879846a80f03f1ce83467a49cc9ede Mon Sep 17 00:00:00 2001 From: Sami Date: Thu, 10 Oct 2024 11:30:21 +0200 Subject: [PATCH 2/3] fix empty space --- htdocs/core/actions_massactions.inc.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index f62ca728eb8e8..f13a2ee406473 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -495,10 +495,10 @@ foreach ($contactarr as $contact) { $contactstatic->fetch($contact['id']); - $substitutionarray['__CONTACT_NAME_'.$contact['code'].'__'] = $contactstatic->getFullName($langs, 1); - $substitutionarray['__CONTACT_LASTNAME_'.$contact['code'].'__'] = $contactstatic->lastname; - $substitutionarray['__CONTACT_FIRSTNAME_'.$contact['code'].'__'] = $contactstatic->firstname; - $substitutionarray['__CONTACT_TITLE_'.$contact['code'].'__'] = $contactstatic->getCivilityLabel(); + $substitutionarray['__CONTACT_NAME_' . $contact['code'] . '__'] = $contactstatic->getFullName($langs, 1); + $substitutionarray['__CONTACT_LASTNAME_' . $contact['code'] . '__'] = $contactstatic->lastname; + $substitutionarray['__CONTACT_FIRSTNAME_' . $contact['code'] . '__'] = $contactstatic->firstname; + $substitutionarray['__CONTACT_TITLE_' . $contact['code'] . '__'] = $contactstatic->getCivilityLabel(); } } From d3e077c6fdf0b5298596fe01716df7c0ec993219 Mon Sep 17 00:00:00 2001 From: Sami Date: Thu, 10 Oct 2024 11:39:37 +0200 Subject: [PATCH 3/3] update changelog --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 395b7faeca134..ad8cfaaf80c6a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ English Dolibarr ChangeLog ***** ChangeLog for 19.0.2 compared to 19.0.1 ***** +FIX : Addition of contact substitution keys for sending emails from massactions FIX: $object->oldcopy may be a stdClass and not original object FIX: 16.0 - parent company gets emptied when updating a third party from the card in edit mode (#28269) FIX: 16.0 - the e-mail templates configured in the notification module are not used if the recipient is a fixed e-mail address (#29407)