diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php
index 5fbc305b58bf0..3ef0b96c1e846 100644
--- a/htdocs/core/actions_massactions.inc.php
+++ b/htdocs/core/actions_massactions.inc.php
@@ -88,9 +88,10 @@
$oneemailperrecipient = (GETPOST('oneemailperrecipient', 'int') ? 1 : 0);
if (!$error) {
- $thirdparty = new Societe($db);
-
$objecttmp = new $objectclass($db);
+
+ // Define object $thirdparty (Societe or User, Adherent, ConferenceOrBoothAttendee...)
+ $thirdparty = new Societe($db);
if ($objecttmp->element == 'expensereport') {
$thirdparty = new User($db);
}
@@ -100,28 +101,33 @@
if ($objecttmp->element == 'holiday') {
$thirdparty = new User($db);
}
+ if ($objecttmp->element == 'conferenceorboothattendee') {
+ $thirdparty = new ConferenceOrBoothAttendee($db);
+ }
foreach ($toselect as $toselectid) {
$objecttmp = new $objectclass($db); // we must create new instance because instance is saved into $listofobjectref array for future use
$result = $objecttmp->fetch($toselectid);
if ($result > 0) {
$listofobjectid[$toselectid] = $toselectid;
-
- $thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid);
+ $tmpobjectid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid);
if ($objecttmp->element == 'societe') {
- $thirdpartyid = $objecttmp->id;
+ $tmpobjectid = $objecttmp->id;
}
if ($objecttmp->element == 'expensereport') {
- $thirdpartyid = $objecttmp->fk_user_author;
+ $tmpobjectid = $objecttmp->fk_user_author;
}
if ($objecttmp->element == 'partnership' && getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') {
- $thirdpartyid = $objecttmp->fk_member;
+ $tmpobjectid = $objecttmp->fk_member;
}
if ($objecttmp->element == 'holiday') {
- $thirdpartyid = $objecttmp->fk_user;
+ $tmpobjectid = $objecttmp->fk_user;
}
- if (empty($thirdpartyid)) {
- $thirdpartyid = 0;
+ if ($objecttmp->element == 'conferenceorboothattendee') {
+ $tmpobjectid = $objecttmp->id;
+ }
+ if (empty($tmpobjectid)) {
+ $tmpobjectid = 0;
}
if ($objectclass == 'Facture') {
@@ -142,8 +148,8 @@
}
}
- $listofobjectthirdparties[$thirdpartyid] = $thirdpartyid;
- $listofobjectref[$thirdpartyid][$toselectid] = $objecttmp;
+ $listofobjectthirdparties[$tmpobjectid] = $tmpobjectid;
+ $listofobjectref[$tmpobjectid][$toselectid] = $objecttmp;
}
}
}
@@ -175,7 +181,7 @@
$massaction = 'presend';
}
- // Loop on each recipient/thirdparty
+ // Loop on each recipient (may be a thirdparty but also a user, a conferenceorboothattendee, ...)
if (!$error) {
foreach ($listofobjectthirdparties as $thirdpartyid) {
$result = $thirdparty->fetch($thirdpartyid);
@@ -187,7 +193,7 @@
$sendto = '';
$sendtocc = '';
$sendtobcc = '';
- $sendtoid = array();
+ //$sendtoid = array();
// Define $sendto
$tmparray = array();
@@ -202,7 +208,7 @@
$tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>';
} elseif ($val && method_exists($thirdparty, 'contact_get_property')) { // Id of contact
$tmparray[] = $thirdparty->contact_get_property((int) $val, 'email');
- $sendtoid[] = $val;
+ //$sendtoid[] = $val;
}
}
}
@@ -302,6 +308,8 @@
if (count($emails_to_sends) > 0) {
$sendto = implode(',', $emails_to_sends);
}
+ } elseif ($objectobj->element == 'conferenceorboothattendee') {
+ $sendto = $objectobj->email;
} else {
$objectobj->fetch_thirdparty();
$sendto = $objectobj->thirdparty->email;
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 665ec68c85fde..5a03184996488 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -543,6 +543,10 @@ public function get_form($addfileaction = 'addfile', $removefileaction = 'remove
$helpforsubstitution .= $langs->trans('AvailableVariables').' :
'."\n";
}
foreach ($this->substit as $key => $val) {
+ // Do not show deprecated variables into the tooltip help of substitution variables
+ if (in_array($key, array('__NEWREF__', '__REFCLIENT__', '__REFSUPPLIER__', '__SUPPLIER_ORDER_DATE_DELIVERY__', '__SUPPLIER_ORDER_DELAY_DELIVERY__'))) {
+ continue;
+ }
$helpforsubstitution .= $key.' -> '.$langs->trans(dol_string_nohtmltag(dolGetFirstLineOfText($val))).'
';
}
if (!empty($this->withsubstit)) { // Unset or set ->withsubstit=0 to disable this.
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 7a6bb97c0f905..03783e37561d8 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -7747,7 +7747,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__DATE_DELIVERY_MM__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, "%M") : '');
$substitutionarray['__DATE_DELIVERY_SS__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, "%S") : '');
- // For backward compatibility
+ // For backward compatibility (deprecated)
$substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null));
$substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null);
$substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs) : '');
@@ -7841,6 +7841,11 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__CANDIDATE_FIRSTNAME__'] = isset($object->firstname) ? $object->firstname : '';
$substitutionarray['__CANDIDATE_LASTNAME__'] = isset($object->lastname) ? $object->lastname : '';
}
+ if (is_object($object) && $object->element == 'conferenceorboothattendee') {
+ $substitutionarray['__ATTENDEE_FULLNAME__'] = $object->getFullName($outputlangs);
+ $substitutionarray['__ATTENDEE_FIRSTNAME__'] = isset($object->firstname) ? $object->firstname : '';
+ $substitutionarray['__ATTENDEE_LASTNAME__'] = isset($object->lastname) ? $object->lastname : '';
+ }
if (is_object($object->project)) {
$substitutionarray['__PROJECT_ID__'] = (is_object($object->project) ? $object->project->id : '');