mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-09 11:08:34 +01:00
FIX Sending email from attendee list
This commit is contained in:
@@ -88,9 +88,10 @@ if (!$error && $massaction == 'confirm_presend') {
|
||||
$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 (!$error && $massaction == 'confirm_presend') {
|
||||
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 @@ if (!$error && $massaction == 'confirm_presend') {
|
||||
}
|
||||
}
|
||||
|
||||
$listofobjectthirdparties[$thirdpartyid] = $thirdpartyid;
|
||||
$listofobjectref[$thirdpartyid][$toselectid] = $objecttmp;
|
||||
$listofobjectthirdparties[$tmpobjectid] = $tmpobjectid;
|
||||
$listofobjectref[$tmpobjectid][$toselectid] = $objecttmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -175,7 +181,7 @@ if (!$error && $massaction == 'confirm_presend') {
|
||||
$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 @@ if (!$error && $massaction == 'confirm_presend') {
|
||||
$sendto = '';
|
||||
$sendtocc = '';
|
||||
$sendtobcc = '';
|
||||
$sendtoid = array();
|
||||
//$sendtoid = array();
|
||||
|
||||
// Define $sendto
|
||||
$tmparray = array();
|
||||
@@ -202,7 +208,7 @@ if (!$error && $massaction == 'confirm_presend') {
|
||||
$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 (!$error && $massaction == 'confirm_presend') {
|
||||
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;
|
||||
|
||||
@@ -543,6 +543,10 @@ class FormMail extends Form
|
||||
$helpforsubstitution .= $langs->trans('AvailableVariables').' :<br>'."\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))).'<br>';
|
||||
}
|
||||
if (!empty($this->withsubstit)) { // Unset or set ->withsubstit=0 to disable this.
|
||||
|
||||
@@ -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 : '');
|
||||
|
||||
Reference in New Issue
Block a user