diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 06b6a18b870..9da814f3369 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -1255,7 +1255,7 @@ class FormMail extends Form
*/
public function getEMailTemplate($db, $type_template, $user, $outputlangs, $id = 0, $active = 1, $label = '')
{
- global $conf;
+ global $conf, $langs;
$ret = new ModelMail();
diff --git a/htdocs/eventorganization/conferenceorbooth_contact.php b/htdocs/eventorganization/conferenceorbooth_contact.php
index 4906a4e05e3..8595da92652 100644
--- a/htdocs/eventorganization/conferenceorbooth_contact.php
+++ b/htdocs/eventorganization/conferenceorbooth_contact.php
@@ -309,7 +309,15 @@ if (!empty($withproject)) {
print "";
print '
'.$langs->trans("EventOrganizationICSLink").' ';
- print '';
+ // Define $urlwithroot
+ $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
+ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
+
+ // Show message
+ $message = 'entity : "");
+ $message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...');
+ $message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').' ';
+ print $message;
print " ";
print '';
diff --git a/htdocs/eventorganization/conferenceorbooth_document.php b/htdocs/eventorganization/conferenceorbooth_document.php
index fc3673d618f..8b064c12b72 100644
--- a/htdocs/eventorganization/conferenceorbooth_document.php
+++ b/htdocs/eventorganization/conferenceorbooth_document.php
@@ -266,8 +266,15 @@ if (!empty($withproject)) {
print "";
print ''.$langs->trans("EventOrganizationICSLink").' ';
- print '';
- //TODO fill with ics
+ // Define $urlwithroot
+ $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
+ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
+
+ // Show message
+ $message = 'entity : "");
+ $message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...');
+ $message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').' ';
+ print $message;
print " ";
print '';
diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php
index ab595e8b86e..270c87fb15c 100644
--- a/htdocs/eventorganization/conferenceorbooth_list.php
+++ b/htdocs/eventorganization/conferenceorbooth_list.php
@@ -173,7 +173,10 @@ if (GETPOST('cancel', 'alpha')) {
$action = 'list';
$massaction = '';
}
-if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
+if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend'
+ && $massaction != 'presend_attendees'
+ && $massaction != 'confirm_presend'
+ && $massaction != 'confirm_presend_attendees') {
$massaction = '';
}
@@ -211,6 +214,7 @@ if (empty($reshook)) {
$objectclass = 'ConferenceOrBooth';
$objectlabel = 'ConferenceOrBooth';
$uploaddir = $conf->eventorganization->dir_output;
+ include DOL_DOCUMENT_ROOT.'/eventorganization/core/actions_massactions_mail.inc.php';
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
@@ -581,12 +585,13 @@ $arrayofmassactions = array(
//'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
//'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
- //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
+ 'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail").' - '.$langs->trans("ConferenceOrBooth"),
+ 'presend_attendees'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail").' - '.$langs->trans("Attendees"),
);
if ($permissiontodelete) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
-if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
+if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'presend_attendees', 'predelete'))) {
$arrayofmassactions = array();
}
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
@@ -610,9 +615,11 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort
$topicmail = "SendConferenceOrBoothRef";
$modelmail = "conferenceorbooth";
$objecttmp = new ConferenceOrBooth($db);
-$trackid = 'xxxx'.$object->id;
+$trackid = 'conferenceorbooth_'.$object->id;
+include DOL_DOCUMENT_ROOT.'/eventorganization/tpl/massactions_mail_pre.tpl.php';
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
+
if ($search_all) {
foreach ($fieldstosearchall as $key => $val) {
$fieldstosearchall[$key] = $langs->trans($val);
diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php
index 658640d5834..e8e86a2641a 100644
--- a/htdocs/eventorganization/conferenceorboothattendee_list.php
+++ b/htdocs/eventorganization/conferenceorboothattendee_list.php
@@ -499,7 +499,15 @@ if ($confOrBooth->id > 0) {
print "";
print ''.$langs->trans("EventOrganizationICSLink").' ';
- print '';
+ // Define $urlwithroot
+ $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
+ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
+
+ // Show message
+ $message = 'entity : "");
+ $message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...');
+ $message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').' ';
+ print $message;
print " ";
print '';
diff --git a/htdocs/eventorganization/core/actions_massactions_mail.inc.php b/htdocs/eventorganization/core/actions_massactions_mail.inc.php
new file mode 100644
index 00000000000..483a1e5bc84
--- /dev/null
+++ b/htdocs/eventorganization/core/actions_massactions_mail.inc.php
@@ -0,0 +1,315 @@
+
+ * Copyright (C) 2018-2021 Nicolas ZABOURI
+ * Copyright (C) 2018 Juanjo Menent
+ * Copyright (C) 2019 Ferran Marcet
+ * Copyright (C) 2019-2021 Frédéric France
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ * or see https://www.gnu.org/
+ */
+
+/**
+ * \file htdocs/core/actions_massactions.inc.php
+ * \brief Code for actions done with massaction button (send by email, merge pdf, delete, ...)
+ */
+
+
+// $massaction must be defined
+// $objectclass and $objectlabel must be defined
+// $parameters, $object, $action must be defined for the hook.
+
+// $permissiontoread, $permissiontoadd, $permissiontodelete, $permissiontoclose may be defined
+// $uploaddir may be defined (example to $conf->projet->dir_output."/";)
+// $toselect may be defined
+// $diroutputmassaction may be defined
+
+
+// Protection
+if (empty($objectclass) || empty($uploaddir)) {
+ dol_print_error(null, 'include of actions_massactions.inc.php is done but var $objectclass or $uploaddir was not defined');
+ exit;
+}
+
+// For backward compatibility
+if (!empty($permtoread) && empty($permissiontoread)) {
+ $permissiontoread = $permtoread;
+}
+if (!empty($permtocreate) && empty($permissiontoadd)) {
+ $permissiontoadd = $permtocreate;
+}
+if (!empty($permtodelete) && empty($permissiontodelete)) {
+ $permissiontodelete = $permtodelete;
+}
+
+
+// Mass actions. Controls on number of lines checked.
+$maxformassaction = (empty($conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS) ? 1000 : $conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS);
+if (!empty($massaction) && is_array($toselect) && count($toselect) < 1) {
+ $error++;
+ setEventMessages($langs->trans("NoRecordSelected"), null, "warnings");
+}
+if (!$error && is_array($toselect) && count($toselect) > $maxformassaction) {
+ setEventMessages($langs->trans('TooManyRecordForMassAction', $maxformassaction), null, 'errors');
+ $error++;
+}
+
+if (!$error && $massaction == 'confirm_presend_attendees' && !GETPOST('sendmail')) { // If we do not choose button send (for example when we change template or limit), we must not send email, but keep on send email form
+ $massaction = 'presend_attendees';
+}
+if (!$error && $massaction == 'confirm_presend_attendees') {
+ $resaction = '';
+ $nbsent = 0;
+ $nbignored = 0;
+ $langs->load("mails");
+ include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
+
+ $listofobjectid = array();
+
+ $listofobjectref = array();
+ $oneemailperrecipient = (GETPOST('oneemailperrecipient') == 'on' ? 1 : 0);
+
+ if (!$error) {
+ require_once DOL_DOCUMENT_ROOT . '/eventorganization/class/conferenceorboothattendee.class.php';
+ $attendee = new ConferenceOrBoothAttendee($db);
+ $listofselectedid = array();
+ $listofselectedref = array();
+ $objecttmp = new $objectclass($db);
+
+ foreach ($toselect as $toselectid) {
+ $result = $objecttmp->fetch($toselectid);
+ if ($result > 0) {
+ $attendees = $attendee->fetchAll('', '', 0, 0, array('t.fk_actioncomm' => $objecttmp->id));
+ if (is_array($attendees) && count($attendees) > 0) {
+ foreach ($attendees as $attmail) {
+ if (!empty($attmail->email)) {
+ $attmail->fetch_thirdparty();
+ $listofselectedid[$attmail->email] = $attmail;
+ $listofselectedref[$attmail->email] = $objecttmp;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Check mandatory parameters
+ if (GETPOST('fromtype', 'alpha') === 'user' && empty($user->email)) {
+ $error++;
+ setEventMessages($langs->trans("NoSenderEmailDefined"), null, 'warnings');
+ $massaction = 'presend_attendees';
+ }
+
+ $receiver = $_POST['receiver'];
+ if (!is_array($receiver)) {
+ if (empty($receiver) || $receiver == '-1') {
+ $receiver = array();
+ } else {
+ $receiver = array($receiver);
+ }
+ }
+ if (!trim($_POST['sendto']) && count($receiver) == 0 && count($listofselectedid) == 1) { // if only one recipient, receiver is mandatory
+ $error++;
+ setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Recipient")), null, 'warnings');
+ $massaction = 'presend_attendees';
+ }
+
+ if (!GETPOST('subject', 'restricthtml')) {
+ $error++;
+ setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MailTopic")), null, 'warnings');
+ $massaction = 'presend_attendees';
+ }
+
+ if (!$error) {
+ $objecttmp->fetch_thirdparty();
+ foreach ($listofselectedid as $email => $attendees) {
+ $sendto = '';
+ $sendtocc = '';
+ $sendtobcc = '';
+ $sendtoid = array();
+
+ // Define $sendto
+ $sendto = $attendees->thirdparty->name . '<' . trim($attendees->email) . '>';
+
+ // Define $sendtocc
+ $receivercc = $_POST['receivercc'];
+ if (!is_array($receivercc)) {
+ if ($receivercc == '-1') {
+ $receivercc = array();
+ } else {
+ $receivercc = array($receivercc);
+ }
+ }
+ $tmparray = array();
+ if (trim($_POST['sendtocc'])) {
+ $tmparray[] = trim($_POST['sendtocc']);
+ }
+ $sendtocc = implode(',', $tmparray);
+
+
+ $langs->load("commercial");
+
+ $reg = array();
+ $fromtype = GETPOST('fromtype');
+ if ($fromtype === 'user') {
+ $from = $user->getFullName($langs) . ' <' . $user->email . '>';
+ } elseif ($fromtype === 'company') {
+ $from = $conf->global->MAIN_INFO_SOCIETE_NOM . ' <' . $conf->global->MAIN_INFO_SOCIETE_MAIL . '>';
+ } elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) {
+ $tmp = explode(',', $user->email_aliases);
+ $from = trim($tmp[($reg[1] - 1)]);
+ } elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) {
+ $tmp = explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES);
+ $from = trim($tmp[($reg[1] - 1)]);
+ } elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) {
+ $sql = 'SELECT rowid, label, email FROM ' . MAIN_DB_PREFIX . 'c_email_senderprofile WHERE rowid = ' . (int) $reg[1];
+ $resql = $db->query($sql);
+ $obj = $db->fetch_object($resql);
+ if ($obj) {
+ $from = $obj->label . ' <' . $obj->email . '>';
+ }
+ } else {
+ $from = $_POST['fromname'] . ' <' . $_POST['frommail'] . '>';
+ }
+
+ $replyto = $from;
+ $subject = GETPOST('subject', 'restricthtml');
+ $message = GETPOST('message', 'restricthtml');
+
+ $sendtobcc = GETPOST('sendtoccc');
+
+ // $objecttmp is a real object or an empty object if we choose to send one email per thirdparty instead of one per object
+ // Make substitution in email content
+ $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $attendees);
+
+ if (!empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY)) {
+ $urlwithouturlroot = preg_replace('/' . preg_quote(DOL_URL_ROOT, '/') . '$/i', '', trim($dolibarr_main_url_root));
+ $urlwithroot = $urlwithouturlroot . DOL_URL_ROOT;
+ $url_link = $urlwithroot . '/public/agenda/agendaexport.php?format=ical' . ($conf->entity > 1 ? "&entity=" . $conf->entity : "");
+ $url_link .= '&exportkey=' . ($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ? urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...');
+ $url_link .= "&project=" . $listofselectedref[$email]->fk_project . '&module=' . urlencode('@eventorganization') . '&status=' . ConferenceOrBooth::STATUS_CONFIRMED;
+ $html_link = '' . $langs->trans('DownloadICSLink') . ' ';
+ }
+ $substitutionarray['__EVENTORGANIZATION_ICS_LINK__'] = $html_link;
+ $substitutionarray['__EVENTORGANIZATION_URL_LINK__'] = $url_link;
+ $substitutionarray['__CHECK_READ__'] = ' ';
+
+ $parameters = array('mode' => 'formemail');
+
+ if (!empty($listofobjectref)) {
+ $parameters['listofobjectref'] = $listofobjectref;
+ }
+
+ complete_substitutions_array($substitutionarray, $langs, $attendees, $parameters);
+
+ $subjectreplaced = make_substitutions($subject, $substitutionarray);
+ $messagereplaced = make_substitutions($message, $substitutionarray);
+
+
+ if (empty($sendcontext)) {
+ $sendcontext = 'standard';
+ }
+
+ // Send mail (substitutionarray must be done just before this)
+ require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
+ $mailfile = new CMailFile($subjectreplaced, $sendto, $from, $messagereplaced, array(), array(), array(), $sendtocc, $sendtobcc, $deliveryreceipt, -1, '', '', "attendees_".$attendees->id, '', $sendcontext);
+ if ($mailfile->error) {
+ $resaction .= '' . $mailfile->error . '
';
+ } else {
+ $result = $mailfile->sendfile();
+ if ($result) {
+ $resaction .= $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2)) . ' '; // Must not contain "
+ $error = 0;
+
+ dol_syslog("Try to insert email event into agenda for objid=" . $attendees->id . " => objectobj=" . get_class($attendees));
+
+ $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto;
+ if ($message) {
+ if ($sendtocc) {
+ $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
+ }
+ $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subjectreplaced);
+ $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
+ $actionmsg = dol_concatdesc($actionmsg, $messagereplaced);
+ }
+ $actionmsg2 = '';
+
+ $objectobj2 = $listofselectedref[$email];
+ // Initialisation donnees
+ $objectobj2->actionmsg = $actionmsg; // Long text
+ $objectobj2->actionmsg2 = $actionmsg2; // Short text
+ $objectobj2->fk_element = $objectobj2->id;
+ $objectobj2->elementtype = $objectobj2->element;
+
+ $triggername = 'CONFERENCEORBOOTHATTENDEE_SENTBYMAIL';
+ if (!empty($triggername)) {
+ // Call trigger
+ $result = $objectobj2->call_trigger($triggername, $user);
+ if ($result < 0) {
+ $error++;
+ }
+ // End call triggers
+
+ if ($error) {
+ setEventMessages($db->lasterror(), $objectobj2->errors, 'errors');
+ dol_syslog("Error in trigger " . $triggername . ' ' . $db->lasterror(), LOG_ERR);
+ }
+ }
+
+ $nbsent++; // Nb of object sent
+ } else {
+ $langs->load("other");
+ if ($mailfile->error) {
+ $resaction .= $langs->trans('ErrorFailedToSendMail', $from, $sendto);
+ $resaction .= '' . $mailfile->error . '
';
+ } elseif (!empty($conf->global->MAIN_DISABLE_ALL_MAILS)) {
+ $resaction .= 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS
';
+ } else {
+ $resaction .= $langs->trans('ErrorFailedToSendMail', $from, $sendto) . '(unhandled error)
';
+ }
+ }
+ }
+ }
+ }
+ $resaction .= ($resaction ? ' ' : $resaction);
+ $resaction .= '' . $langs->trans("ResultOfMailSending") . ': ' . "\n";
+ $resaction .= $langs->trans("NbSelected") . ': ' . count($toselect) . "\n ";
+ $resaction .= $langs->trans("NbIgnored") . ': ' . ($nbignored ? $nbignored : 0) . "\n ";
+ $resaction .= $langs->trans("NbSent") . ': ' . ($nbsent ? $nbsent : 0) . "\n ";
+
+ if ($nbsent) {
+ $action = ''; // Do not show form post if there was at least one successfull sent
+ //setEventMessages($langs->trans("EMailSentToNRecipients", $nbsent.'/'.count($toselect)), null, 'mesgs');
+ setEventMessages($langs->trans("EMailSentForNElements", $nbsent . '/' . count($toselect)), null, 'mesgs');
+ setEventMessages($resaction, null, 'mesgs');
+ } else {
+ //setEventMessages($langs->trans("EMailSentToNRecipients", 0), null, 'warnings'); // May be object has no generated PDF file
+ setEventMessages($resaction, null, 'warnings');
+ }
+
+ $action = 'list';
+ $massaction = '';
+}
+
+
+
+$parameters['toselect'] = $toselect;
+$parameters['uploaddir'] = $uploaddir;
+$parameters['massaction'] = $massaction;
+$parameters['diroutputmassaction'] = isset($diroutputmassaction) ? $diroutputmassaction : null;
+
+$reshook = $hookmanager->executeHooks('doMassActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
+if ($reshook < 0) {
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+}
diff --git a/htdocs/eventorganization/tpl/massactions_mail_pre.tpl.php b/htdocs/eventorganization/tpl/massactions_mail_pre.tpl.php
new file mode 100644
index 00000000000..17c78babfea
--- /dev/null
+++ b/htdocs/eventorganization/tpl/massactions_mail_pre.tpl.php
@@ -0,0 +1,130 @@
+
+ * Copyright (C) 2013-2014 Laurent Destailleur
+ * Copyright (C) 2015 Marcos García
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ * or see https://www.gnu.org/
+ */
+
+// Following var must be set:
+// $arrayofselected = array of id selected
+// $object
+// $objecttmp=new Propal($db);
+// $topicmail="SendSupplierProposalRef";
+// $modelmail="supplier_proposal_send";
+// $trackid='ord'.$object->id;
+
+if ($massaction == 'presend_attendees') {
+ $langs->load("mails");
+ require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php';
+ $attendee = new ConferenceOrBoothAttendee($db);
+ $listofselectedid = array();
+ $listofselectedref = array();
+
+ if (!GETPOST('cancel', 'alpha')) {
+ foreach ($arrayofselected as $toselectid) {
+ $result = $objecttmp->fetch($toselectid);
+ if ($result > 0) {
+ $attendees = $attendee->fetchAll('', '', 0, 0, array('t.fk_actioncomm'=>$objecttmp->id));
+ if (is_array($attendees) && count($attendees)>0) {
+ foreach ($attendees as $attmail) {
+ if (!empty($attmail->email)) {
+ $listofselectedid[$attmail->email] = $attmail->id;
+ $listofselectedref[$attmail->id][$toselectid] = $objecttmp->ref;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ print ' ';
+ print ' ';
+
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
+ $formmail = new FormMail($db);
+
+ print dol_get_fiche_head(null, '', '');
+
+ // Cree l'objet formulaire mail
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
+ $formmail = new FormMail($db);
+ $formmail->withform = -1;
+ $formmail->fromtype = (GETPOST('fromtype') ? GETPOST('fromtype') : (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user'));
+
+ if ($formmail->fromtype === 'user') {
+ $formmail->fromid = $user->id;
+ }
+ $formmail->trackid = $trackid;
+ if (!empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) { // If bit 2 is set
+ include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+ $formmail->frommail = dolAddEmailTrackId($formmail->frommail, $trackid);
+ }
+ $formmail->withfrom = 1;
+ $liste = $langs->trans("AllRecipientSelected", count($listofselectedid));
+ $formmail->withtoreadonly = 1;
+
+ $formmail->withoptiononeemailperrecipient = ((count($listofselectedref) == 1 && count(reset($listofselectedref)) == 1) || empty($liste)) ? 0 : ((GETPOST('oneemailperrecipient') == 'on') ? 1 : -1);
+
+ $formmail->withto = empty($liste) ? (GETPOST('sendto', 'alpha') ?GETPOST('sendto', 'alpha') : array()) : $liste;
+ $formmail->withtofree = empty($liste) ? 1 : 0;
+ $formmail->withtocc = 1;
+ $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
+ $formmail->withtopic = $langs->transnoentities($topicmail, '__REF__', '__REF_CLIENT__');
+ $formmail->withfile = 0;
+ // $formmail->withfile = 2; Not yet supported in mass action
+ $formmail->withmaindocfile = 0; // Add a checkbox "Attach also main document"
+ $formmail->withbody = 1;
+ $formmail->withdeliveryreceipt = 1;
+ $formmail->withcancel = 1;
+
+ // Make substitution in email content
+ $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $object);
+
+ $substitutionarray['__EMAIL__'] = $sendto;
+ $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? ' ' : '';
+ $substitutionarray['__PERSONALIZED__'] = ''; // deprecated
+ $substitutionarray['__CONTACTCIVNAME__'] = '';
+
+ $parameters = array(
+ 'mode' => 'formemail'
+ );
+ complete_substitutions_array($substitutionarray, $langs, $object, $parameters);
+
+ // Tableau des substitutions
+ $formmail->substit = $substitutionarray;
+
+ // Tableau des parametres complementaires du post
+ $formmail->param['action'] = $action;
+ $formmail->param['models'] = $modelmail;
+ $formmail->param['models_id'] = empty(GETPOST('modelmailselected', 'int'))?$conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES:GETPOST('modelmailselected', 'int');
+ $formmail->param['id'] = join(',', $arrayofselected);
+ // $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
+ if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && count($listofselectedid) > $conf->global->MAILING_LIMIT_SENDBYWEB) {
+ $langs->load("errors");
+ print img_warning().' '.$langs->trans('WarningNumberOfRecipientIsRestrictedInMassAction', $conf->global->MAILING_LIMIT_SENDBYWEB);
+ print ' - '.$langs->trans("GoBack").' ';
+ $arrayofmassactions = array();
+ } else {
+ print $formmail->get_form();
+ }
+
+ print dol_get_fiche_end();
+}
+// Allow Pre-Mass-Action hook (eg for confirmation dialog)
+$parameters = array(
+ 'toselect' => $toselect,
+ 'uploaddir' => isset($uploaddir) ? $uploaddir : null
+);
diff --git a/htdocs/install/mysql/data/llx_c_email_templates.sql b/htdocs/install/mysql/data/llx_c_email_templates.sql
index e2b1cd65077..393875dd40f 100644
--- a/htdocs/install/mysql/data/llx_c_email_templates.sql
+++ b/htdocs/install/mysql/data/llx_c_email_templates.sql
@@ -35,9 +35,9 @@ INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private,
INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0,'recruitment','recruitmentcandidature_send','',0,null,null,'(AnswerCandidature)' ,100,'$conf->recruitment->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourCandidature)__', '__(Hello)__ __CANDIDATE_FULLNAME__, \n\n__(YourCandidatureAnswerMessage)__ __ONLINE_INTERVIEW_SCHEDULER_TEXT_AND_URL__\n \n__(Sincerely)__ __USER_SIGNATURE__',null, 0);
-- Event organization
-INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, 'EventOrganizationEmailAskConf', 10, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskConf)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOrganizationEventConfRequestWasReceived)__ __ONLINE_PAYMENT_TEXT_AND_URL__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
-INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, 'EventOrganizationEmailAskBooth', 20, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskBooth)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOrganizationEventBoothRequestWasReceived)__ __ONLINE_PAYMENT_TEXT_AND_URL__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
-INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, 'EventOrganizationEmailSubsBooth', 30, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailSubsBooth)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOrganizationEventBoothSubscriptionWasReceived)__ __ONLINE_PAYMENT_TEXT_AND_URL__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
-INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, 'EventOrganizationEmailSubsEvent', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailSubsEvent)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOrganizationEventEventSubscriptionWasReceived)__ __(Sincerely)__ __MYCOMPANY_NAME__ __USER_SIGNATURE__', null, '1', null);
-INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, 'EventOrganizationMassEmailAttendees', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendees)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOrganizationEventBulkMailToAttendees)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
-INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, 'EventOrganizationMassEmailSpeakers', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOrganizationEventBulkMailToSpeakers)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
+INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskConf)', 10, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskConf)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOrganizationEventConfRequestWasReceived)__ __ONLINE_PAYMENT_TEXT_AND_URL__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
+INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskBooth)', 20, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskBooth)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOrganizationEventBoothRequestWasReceived)__ __ONLINE_PAYMENT_TEXT_AND_URL__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
+INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsBooth)', 30, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailSubsBooth)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOrganizationEventBoothSubscriptionWasReceived)__ __ONLINE_PAYMENT_TEXT_AND_URL__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
+INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsEvent)', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailSubsEvent)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOrganizationEventEventSubscriptionWasReceived)__ __(Sincerely)__ __MYCOMPANY_NAME__ __USER_SIGNATURE__', null, '1', null);
+INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailAttendees)', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendees)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOrganizationEventBulkMailToAttendees)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
+INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailSpeakers)', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOrganizationEventBulkMailToSpeakers)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
diff --git a/htdocs/langs/fr_FR/eventorganization.lang b/htdocs/langs/fr_FR/eventorganization.lang
index 7ef2977adc3..ef7de0fd710 100644
--- a/htdocs/langs/fr_FR/eventorganization.lang
+++ b/htdocs/langs/fr_FR/eventorganization.lang
@@ -40,8 +40,8 @@ EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF = Modèle de courriel à envoyer aprè
EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH = Modèle de courriel à envoyer après avoir reçu une suggestion d'un stand.
EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH = Modèle de courriel à envoyer après paiement d'une inscription à un stand.
EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT = Modèle de courriel à envoyer après paiement d'une inscription à un événement.
-EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER = Modèle de courriel pour action de masse aux participants
-EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES = Modèle de courriel pour action de masse aux intervenants
+EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER = Modèle de courriel pour action de masse aux intervenants
+EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES = Modèle de courriel pour action de masse aux participants
EVENTORGANIZATION_FILTERATTENDEES_CAT = Filtrer la liste de sélection des tiers dans la fiche/le formulaire de création des participants avec/selon la catégorie
EVENTORGANIZATION_FILTERATTENDEES_TYPE = Filtrer la liste de sélection des tiers dans la fiche/le formulaire de création des participants avec le type de client