29require
'../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/modules/mailings/modules_mailings.php';
31require_once DOL_DOCUMENT_ROOT.
'/comm/mailing/class/mailing.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmailing.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/emailing.lib.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/ajax.lib.php';
39$langs->loadLangs(array(
"mails",
"admin"));
43$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
44$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
46if (empty($page) || $page == -1) {
49$offset = $limit * $page;
53 $sortfield =
"mc.statut,email";
56 $sortorder =
"DESC,ASC";
61$action =
GETPOST(
'action',
'aZ09');
62$search_lastname =
GETPOST(
"search_lastname",
'alphanohtml');
63$search_firstname =
GETPOST(
"search_firstname",
'alphanohtml');
64$search_email =
GETPOST(
"search_email",
'alphanohtml');
65$search_other =
GETPOST(
"search_other",
'alphanohtml');
66$search_dest_status =
GETPOST(
'search_dest_status',
'int');
75$hookmanager->initHooks(array(
'ciblescard',
'globalcard'));
80$listofmethods = array();
82$listofmethods[
'mail'] =
'PHP mail function';
84$listofmethods[
'smtps'] =
'SMTP/SMTPS socket library';
85if (version_compare(phpversion(),
'7.0',
'>=')) {
86 $listofmethods[
'swiftmailer'] =
'Swift Mailer socket library';
90if (!$user->hasRight(
'mailing',
'lire') || (!
getDolGlobalString(
'EXTERNAL_USERS_ARE_AUTHORIZED') && $user->socid > 0)) {
93if (empty($action) && empty(
$object->id)) {
97$permissiontoread = $user->hasRight(
'maling',
'lire');
98$permissiontocreate = $user->hasRight(
'mailing',
'creer');
99$permissiontovalidatesend = $user->hasRight(
'mailing',
'valider');
100$permissiontodelete = $user->hasRight(
'mailing',
'supprimer');
107if ($action ==
'add' && $permissiontocreate) {
108 $module =
GETPOST(
"module",
'alpha');
111 foreach ($modulesdir as $dir) {
114 dol_syslog(
"Scan directory ".$dir.
" for modules");
117 $file = $dir.
"/".$module.
".modules.php";
118 $classname =
"mailing_".$module;
120 if (file_exists($file)) {
124 dol_syslog(
"Call add_to_target() on class ".$classname.
" evenunsubscribe=".
$object->evenunsubscribe);
126 if (class_exists($classname)) {
127 $obj =
new $classname($db);
128 $obj->evenunsubscribe =
$object->evenunsubscribe;
130 $result = $obj->add_to_target($id);
132 $sqlmessage = $obj->sql;
141 if (
$object->status == $object::STATUS_SENTCOMPLETELY) {
142 $object->setStatut($object::STATUS_SENTPARTIALY);
152 setEventMessages($langs->trans(
"Error").($obj->error ?
' '.$obj->error :
''), null,
'errors');
156if (
GETPOSTINT(
'clearlist') && $permissiontocreate) {
159 $obj->clear_target($id);
166if (
GETPOSTINT(
'exportcsv') && $permissiontoread) {
167 $completefilename =
'targets_emailing'.$object->id.
'_'.
dol_print_date(
dol_now(),
'dayhourlog').
'.csv';
168 header(
'Content-Type: text/csv');
169 header(
'Content-Disposition: attachment;filename='.$completefilename);
172 $sql =
"SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut as status, mc.date_envoi, mc.tms,";
173 $sql .=
" mc.source_id, mc.source_type, mc.error_text";
174 $sql .=
" FROM ".MAIN_DB_PREFIX.
"mailing_cibles as mc";
175 $sql .=
" WHERE mc.fk_mailing = ".((int)
$object->id);
176 $sql .= $db->order($sortfield, $sortorder);
178 $resql = $db->query($sql);
180 $num = $db->num_rows($resql);
183 while ($obj = $db->fetch_object($resql)) {
184 print $obj->rowid.$sep;
185 print
'"'.$obj->lastname.
'"'.$sep;
186 print
'"'.$obj->firstname.
'"'.$sep;
187 print $obj->email.$sep;
188 print $obj->other.$sep;
189 print $obj->tms.$sep;
190 print $obj->source_type.$sep;
191 print $obj->source_id.$sep;
192 print $obj->date_envoi.$sep;
193 print $obj->status.$sep;
194 print
'"'.$obj->error_text.
'"'.$sep;
205if ($action ==
'delete' && $permissiontocreate) {
207 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"mailing_cibles WHERE rowid = ".((int) $rowid);
208 $resql = $db->query($sql);
212 $obj->update_nb($id);
216 header(
"Location: list.php");
225if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
226 $search_lastname =
'';
227 $search_firstname =
'';
230 $search_dest_status =
'';
234if (($action ==
'settitle' || $action ==
'setemail_from' || $action ==
'setreplyto' || $action ==
'setemail_errorsto' || $action ==
'setevenunsubscribe') && $permissiontocreate) {
235 $upload_dir = $conf->mailing->dir_output.
"/".
get_exdir(
$object->id, 2, 0, 1, $object,
'mailing');
237 if ($action ==
'settitle') {
239 } elseif ($action ==
'setemail_from') {
240 $object->email_from = trim(
GETPOST(
'email_from',
'alphawithlgt'));
241 } elseif ($action ==
'setemail_replyto') {
242 $object->email_replyto = trim(
GETPOST(
'email_replyto',
'alphawithlgt'));
243 } elseif ($action ==
'setemail_errorsto') {
244 $object->email_errorsto = trim(
GETPOST(
'email_errorsto',
'alphawithlgt'));
245 } elseif ($action ==
'settitle' && empty(
$object->title)) {
246 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"MailTitle"));
247 } elseif ($action ==
'setfrom' && empty(
$object->email_from)) {
248 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"MailFrom"));
249 } elseif ($action ==
'setevenunsubscribe') {
254 $result =
$object->update($user);
256 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
271llxHeader(
'', $langs->trans(
"Mailing"),
'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing');
273$form =
new Form($db);
281 $linkback =
'<a href="'.DOL_URL_ROOT.
'/comm/mailing/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
283 $morehtmlref =
'<div class="refidno">';
285 $morehtmlref .= $form->editfieldkey(
"",
'title',
$object->title, $object, 0,
'string',
'', 0, 1);
286 $morehtmlref .= $form->editfieldval(
"",
'title',
$object->title, $object, 0,
'string',
'',
null,
null,
'', 1);
287 $morehtmlref .=
'</div>';
289 $morehtmlstatus =
'';
291 if (
$object->status == $object::STATUS_SENTPARTIALY ||
$object->status == $object::STATUS_SENTCOMPLETELY) {
292 $nbtry =
$object->countNbOfTargets(
'alreadysent');
293 $nbko =
$object->countNbOfTargets(
'alreadysentko');
294 $nbok = ($nbtry - $nbko);
296 $morehtmlstatus .=
' ('.$nbtry.
'/'.
$object->nbemail;
298 $morehtmlstatus .=
' - '.$nbko.
' '.$langs->trans(
"Error");
300 $morehtmlstatus .=
') ';
303 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref,
'', 0,
'', $morehtmlstatus);
305 print
'<div class="fichecenter">';
306 print
'<div class="fichehalfleft">';
307 print
'<div class="underbanner clearboth"></div>';
309 print
'<table class="border centpercent tableforfield">';
312 print
'<tr><td class="titlefield">'.$langs->trans(
"MailFrom").
'</td><td>';
314 foreach ($emailarray as $email => $name) {
315 if ($name && $name != $email) {
319 $langs->load(
"errors");
320 print
img_warning($langs->trans(
"ErrorBadEMail", $email));
331 if (
$object->messtype !=
'sms') {
332 print
'<tr><td>'.$langs->trans(
"MailErrorsTo").
'</td><td>';
334 foreach ($emailarray as $email => $name) {
335 if ($name != $email) {
339 $langs->load(
"errors");
340 print
img_warning($langs->trans(
"ErrorBadEMail", $email));
342 $langs->load(
"errors");
343 print
img_warning($langs->trans(
"ErrorBadMXDomain", $email));
353 if (
$object->messtype !=
'sms') {
355 print $form->editfieldkey(
"MailReply",
'email_replyto',
$object->email_replyto, $object, $user->hasRight(
'mailing',
'creer') &&
$object->status < $object::STATUS_SENTCOMPLETELY,
'string');
357 print $form->editfieldval(
"MailReply",
'email_replyto',
$object->email_replyto, $object, $user->hasRight(
'mailing',
'creer') &&
$object->status < $object::STATUS_SENTCOMPLETELY,
'string');
359 if ($action !=
'editemail_replyto') {
361 $langs->load(
"errors");
362 print
img_warning($langs->trans(
"ErrorBadEMail", $email));
364 $langs->load(
"errors");
365 print
img_warning($langs->trans(
"ErrorBadMXDomain", $email));
375 print
'<div class="fichehalfright">';
376 print
'<div class="underbanner clearboth"></div>';
378 print
'<table class="border centpercent tableforfield">';
382 print $langs->trans(
"TotalNbOfDistinctRecipients");
385 if (is_numeric($nbemail)) {
389 $text .= $langs->trans(
'LimitSendingEmailing',
getDolGlobalString(
'MAILING_LIMIT_SENDBYWEB'));
391 $text .= $langs->trans(
'SendingFromWebInterfaceIsNotAllowed');
394 if (empty($nbemail)) {
395 $nbemail .=
' '.img_warning($langs->trans(
'ToAddRecipientsChooseHere'));
399 print $form->textwithpicto($nbemail, $text, 1,
'warning');
407 print $langs->trans(
"MAIN_MAIL_SENDMODE");
409 if (
$object->messtype !=
'sms') {
415 $text = $listofmethods[
'mail'];
420 print
' <span class="opacitymedium">('.getDolGlobalString(
'MAIN_MAIL_SMTP_SERVER_EMAILING',
getDolGlobalString(
'MAIN_MAIL_SMTP_SERVER')).
')</span>';
423 print
' <span class="opacitymedium">('.getDolGlobalString(
'MAIN_MAIL_SMTP_SERVER').
')</span>';
427 print
' <span class="opacitymedium">('.getDolGlobalString(
'MAIN_MAIL_SMTP_SERVER').
')</span>';
432 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
438 print
'<div class="clearboth"></div>';
446 $allowaddtarget = (
$object->status == $object::STATUS_DRAFT);
447 if (
GETPOST(
'allowaddtarget')) {
450 if (!$allowaddtarget) {
451 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&allowaddtarget=1',
'', $user->hasRight(
'mailing',
'creer'));
455 if ($allowaddtarget && $user->hasRight(
'mailing',
'creer')) {
456 print
load_fiche_titre($langs->trans(
"ToAddRecipientsChooseHere"), ($user->admin ?
info_admin($langs->trans(
"YouCanAddYourOwnPredefindedListHere"), 1) :
''),
'generic');
458 print
'<div class="div-table-responsive">';
459 print
'<div class="tagtable centpercentwithout1imp liste_titre_bydiv borderbottom" id="tablelines">';
461 print
'<div class="tagtr liste_titre">';
462 print
'<div class="tagtd"></div>';
463 print
'<div class="tagtd">'.$langs->trans(
"RecipientSelectionModules").
'</div>';
464 print
'<div class="tagtd center maxwidth150">';
465 if (
$object->messtype !=
'sms') {
466 print $langs->trans(
"NbOfUniqueEMails");
468 print $langs->trans(
"NbOfUniquePhones");
471 print
'<div class="tagtd left"><div class="inline-block">'.$langs->trans(
"Filters").
'</div>';
472 if (
$object->messtype !=
'sms') {
473 print
' <div class=" inline-block">'.$langs->trans(
"EvenUnsubscribe").
' ';
474 print
ajax_object_onoff($object,
'evenunsubscribe',
'evenunsubscribe',
'EvenUnsubscribe:switch_on:warning',
'EvenUnsubscribe', array(),
'small valignmiddle',
'', 1);
478 print
'<div class="tagtd"> </div>';
483 foreach ($modulesdir as $dir) {
484 $modulenames = array();
488 dol_syslog(
"Scan directory ".$dir.
" for modules");
489 $handle = @opendir($dir);
490 if (is_resource($handle)) {
491 while (($file = readdir($handle)) !==
false) {
492 if (substr($file, 0, 1) !=
'.' && substr($file, 0, 3) !=
'CVS') {
494 if (preg_match(
"/(.*)\.modules\.php$/i", $file, $reg)) {
495 if ($reg[1] ==
'example') {
498 $modulenames[] = $reg[1];
511 foreach ($modulenames as $modulename) {
513 $file = $dir.$modulename.
".modules.php";
514 $classname =
"mailing_".$modulename;
517 $obj =
new $classname($db);
520 $qualified = (is_null($obj->enabled) ? 1 : (int)
dol_eval($obj->enabled, 1));
523 foreach ($obj->require_module as $key) {
524 if (empty($conf->$key->enabled) || (empty($user->admin) && $obj->require_admin)) {
535 if ($allowaddtarget) {
536 print
'<form '.$bctag[$var].
' name="'.$modulename.
'" action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&module='.$modulename.
'" method="POST" enctype="multipart/form-data">';
537 print
'<input type="hidden" name="token" value="'.newToken().
'">';
538 print
'<input type="hidden" name="action" value="add">';
539 print
'<input type="hidden" name="page_y" value="'.newToken().
'">';
541 print
'<div '.$bctag[$var].
'>';
544 print
'<div class="tagtd paddingleftimp marginleftonly paddingrightimp marginrightonly valignmiddle center">';
545 if (empty($obj->picto)) {
546 $obj->picto =
'generic';
548 print
img_object($langs->trans(
"EmailingTargetSelector").
': '.get_class($obj), $obj->picto,
'class="valignmiddle width25 size15x"');
550 print
'<div class="tagtd valignmiddle">';
551 print $obj->getDesc();
555 $obj->evenunsubscribe =
$object->evenunsubscribe;
557 $nbofrecipient = $obj->getNbOfRecipients(
'');
562 print
'<div class="tagtd center valignmiddle">';
563 if ($nbofrecipient ===
'' || $nbofrecipient >= 0) {
564 print $nbofrecipient;
566 print $langs->trans(
"Error").
' '.
img_error($obj->error);
570 print
'<div class="tagtd left valignmiddle">';
571 if ($allowaddtarget) {
573 $filter = $obj->formFilter();
580 print $langs->trans(
"None");
585 print
'<div class="tagtd right valignmiddle">';
586 if ($allowaddtarget) {
587 print
'<input type="submit" class="button button-add small reposition" name="button_'.$modulename.
'" value="'.$langs->trans(
"Add").
'">';
589 print
'<input type="submit" class="button small disabled" disabled="disabled" name="button_'.$modulename.
'" value="'.$langs->trans(
"Add").
'">';
595 if ($allowaddtarget) {
604 $parameters = array();
605 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
606 print $hookmanager->resPrint;
613 if ($sqlmessage && $user->admin) {
614 print
info_admin($langs->trans(
"SQLUsedForExport").
':<br> '.$sqlmessage, 0, 0, 1,
'',
'TechnicalInformation');
622 $sql =
"SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut as status, mc.date_envoi, mc.tms,";
623 $sql .=
" mc.source_url, mc.source_id, mc.source_type, mc.error_text,";
624 $sql .=
" COUNT(mu.rowid) as nb";
625 $sql .=
" FROM ".MAIN_DB_PREFIX.
"mailing_cibles as mc";
626 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"mailing_unsubscribe as mu ON mu.email = mc.email";
627 $sql .=
" WHERE mc.fk_mailing=".((int)
$object->id);
628 $asearchcriteriahasbeenset = 0;
629 if ($search_lastname) {
631 $asearchcriteriahasbeenset++;
633 if ($search_firstname) {
635 $asearchcriteriahasbeenset++;
639 $asearchcriteriahasbeenset++;
643 $asearchcriteriahasbeenset++;
645 if ($search_dest_status !=
'' && (
int) $search_dest_status >= -1) {
646 $sql .=
" AND mc.statut = ".((int) $search_dest_status);
647 $asearchcriteriahasbeenset++;
649 $sql .=
' GROUP BY mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.tms, mc.source_url, mc.source_id, mc.source_type, mc.error_text';
650 $sql .= $db->order($sortfield, $sortorder);
654 $nbtotalofrecords =
'';
656 $result = $db->query($sql);
657 $nbtotalofrecords = $db->num_rows($result);
658 if (($page * $limit) > $nbtotalofrecords) {
664 if (empty($asearchcriteriahasbeenset)) {
665 if ($nbtotalofrecords !=
$object->nbemail) {
666 dol_syslog(
"We found a difference in nb of record in target table and the property ->nbemail, we fix ->nbemail");
668 $resultrefresh =
$object->refreshNbOfTargets();
669 if ($resultrefresh < 0) {
677 $sql .= $db->plimit($limit + 1, $offset);
679 $resql = $db->query($sql);
681 $num = $db->num_rows($resql);
683 $param =
"&id=".$object->id;
685 if ($limit > 0 && $limit != $conf->liste_limit) {
686 $param .=
'&limit='.((int) $limit);
688 if ($search_lastname) {
689 $param .=
"&search_lastname=".urlencode($search_lastname);
691 if ($search_firstname) {
692 $param .=
"&search_firstname=".urlencode($search_firstname);
695 $param .=
"&search_email=".urlencode($search_email);
698 $param .=
"&search_other=".urlencode($search_other);
701 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
702 print
'<input type="hidden" name="token" value="'.newToken().
'">';
703 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
704 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
705 print
'<input type="hidden" name="page" value="'.$page.
'">';
706 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
707 print
'<input type="hidden" name="page_y" value="">';
709 $morehtmlcenter =
'';
710 if (
$object->status == $object::STATUS_DRAFT) {
711 $morehtmlcenter =
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ToClearAllRecipientsClickHere").
'</span> <a href="'.$_SERVER[
"PHP_SELF"].
'?clearlist=1&id='.
$object->id.
'" class="button reposition smallpaddingimp">'.$langs->trans(
"TargetsReset").
'</a>';
713 $morehtmlcenter .=
' <a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=exportcsv&token='.
newToken().
'&exportcsv=1&id='.
$object->id.
'">'.
img_picto(
'',
'download',
'class="pictofixedwidth"').$langs->trans(
"Download").
'</a>';
715 $massactionbutton =
'';
718 print_barre_liste($langs->trans(
"MailSelectedRecipients"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $morehtmlcenter, $num, $nbtotalofrecords,
'generic', 0, $newcardbutton,
'', $limit, 0, 0, 1);
722 print
"\n<!-- Liste destinataires selectionnes -->\n";
723 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
724 print
'<input type="hidden" name="token" value="'.newToken().
'">';
725 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
726 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
727 print
'<input type="hidden" name="page" value="'.$page.
'">';
728 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
729 print
'<input type="hidden" name="limit" value="'.$limit.
'">';
730 print
'<input type="hidden" name="page_y" value="">';
732 print
'<div class="div-table-responsive">';
733 print
'<table class="noborder centpercent">';
736 print
'<tr class="liste_titre_filter">';
740 print
'<td class="liste_titre maxwidthsearch">';
741 $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0,
'checkforselect', 1);
746 print
'<td class="liste_titre">';
747 print
'<input class="flat maxwidth75" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).
'">';
750 print
'<td class="liste_titre">';
751 print
'<input class="flat maxwidth50" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).
'">';
754 print
'<td class="liste_titre">';
755 print
'<input class="flat maxwidth50" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).
'">';
758 print
'<td class="liste_titre">';
759 print
'<input class="flat maxwidth100" type="text" name="search_other" value="'.dol_escape_htmltag($search_other).
'">';
762 print
'<td class="liste_titre">';
767 print
'<td class="liste_titre">';
772 print
'<td class="liste_titre">';
777 print
'<td class="liste_titre center parentonrightofpage">';
778 print $formmailing->selectDestinariesStatus($search_dest_status,
'search_dest_status', 1,
'width100 onrightofpage');
783 print
'<td class="liste_titre maxwidthsearch">';
784 $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0,
'checkforselect', 1);
792 $param .=
"&page=".urlencode((
string) ($page));
795 print
'<tr class="liste_titre">';
801 print_liste_field_titre(
"Lastname", $_SERVER[
"PHP_SELF"],
"mc.lastname", $param,
"",
"", $sortfield, $sortorder);
802 print_liste_field_titre(
"Firstname", $_SERVER[
"PHP_SELF"],
"mc.firstname", $param,
"",
"", $sortfield, $sortorder);
803 print_liste_field_titre(
"OtherInformations", $_SERVER[
"PHP_SELF"],
"", $param,
"",
"", $sortfield, $sortorder);
804 print_liste_field_titre(
"Source", $_SERVER[
"PHP_SELF"],
"", $param,
"",
'', $sortfield, $sortorder,
'center ');
806 print_liste_field_titre(
"DateLastModification", $_SERVER[
"PHP_SELF"],
"mc.tms", $param,
"",
'', $sortfield, $sortorder,
'center ');
808 print_liste_field_titre(
"DateSending", $_SERVER[
"PHP_SELF"],
"mc.date_envoi", $param,
'',
'', $sortfield, $sortorder,
'center ');
809 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"mc.statut", $param,
'',
'', $sortfield, $sortorder,
'center ');
819 include_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
820 include_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
821 include_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
822 include_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
823 include_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
825 $objectstaticmember =
new Adherent($db);
826 $objectstaticuser =
new User($db);
827 $objectstaticcompany =
new Societe($db);
828 $objectstaticcontact =
new Contact($db);
831 while ($i < min($num, $limit)) {
832 $obj = $db->fetch_object($resql);
834 print
'<tr class="oddeven">';
838 print
'<td class="center">';
839 print
'<!-- ID mailing_cibles = '.$obj->rowid.
' -->';
840 if ($obj->status == $object::STATUS_DRAFT) {
841 if ($user->hasRight(
'mailing',
'creer')) {
842 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&rowid='.((int) $obj->rowid).$param.
'">'.
img_delete($langs->trans(
"RemoveRecipient")).
'</a>';
852 print
'<td class="tdoverflowmax150">';
853 print
img_picto($obj->email,
'email',
'class="paddingright"');
855 print
img_warning($langs->trans(
"EmailOptedOut"),
'warning',
'pictofixedwidth');
860 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).
'">'.
dol_escape_htmltag($obj->lastname).
'</td>';
862 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->firstname).
'">'.
dol_escape_htmltag($obj->firstname).
'</td>';
864 print
'<td class="tdoverflowmax300" title="'.dol_escape_htmltag($obj->other).
'"><span class="small">'.
dol_escape_htmltag($obj->other).
'</small></td>';
866 print
'<td class="center tdoverflowmax150">';
867 if (empty($obj->source_id) || empty($obj->source_type)) {
868 print empty($obj->source_url) ?
'' : $obj->source_url;
870 if ($obj->source_type ==
'member') {
871 $objectstaticmember->fetch($obj->source_id);
872 print $objectstaticmember->getNomUrl(1);
873 } elseif ($obj->source_type ==
'user') {
874 $objectstaticuser->fetch($obj->source_id);
875 print $objectstaticuser->getNomUrl(1);
876 } elseif ($obj->source_type ==
'thirdparty') {
877 $objectstaticcompany->fetch($obj->source_id);
878 print $objectstaticcompany->getNomUrl(1);
879 } elseif ($obj->source_type ==
'contact') {
880 $objectstaticcontact->fetch($obj->source_id);
881 print $objectstaticcontact->getNomUrl(1);
882 } elseif ($obj->source_type ==
'eventorganizationattendee') {
883 $objectstaticeventorganization->fetch($obj->source_id);
884 print $objectstaticeventorganization->getNomUrl(1);
886 print $obj->source_url;
892 print
'<td class="center nowraponall">';
897 print
'<td class="center nowraponall">';
898 if ($obj->status != $object::STATUS_DRAFT) {
900 print $obj->date_envoi;
905 print
'<td class="nowrap center">';
906 if ($obj->status == $object::STATUS_DRAFT) {
907 print $object::libStatutDest((
int) $obj->status, 2,
'');
909 print $object::libStatutDest((
int) $obj->status, 2, $obj->error_text);
915 print
'<td class="center">';
916 print
'<!-- ID mailing_cibles = '.$obj->rowid.
' -->';
917 if ($obj->status == $object::STATUS_DRAFT) {
918 if ($user->hasRight(
'mailing',
'creer')) {
919 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&rowid='.((int) $obj->rowid).$param.
'">'.
img_delete($langs->trans(
"RemoveRecipient")).
'</a>';
933 if (
$object->status < $object::STATUS_SENTPARTIALY) {
934 print
'<tr><td colspan="9">';
935 print
'<span class="opacitymedium">'.$langs->trans(
"NoTargetYet").
'</span>';
938 print
'<tr><td colspan="9">';
939 print
'<span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span>';
943 print
"</table><br>";
953 print
"\n<!-- Fin liste destinataires selectionnes -->\n";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input=array(), $morecss='', $htmlname='', $forcenojs=0, $moreparam='')
On/off button to change a property status of an object This uses the ajax service objectonoff....
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage members of a foundation.
static getValidAddress($address, $format, $encode=0, $maxnumberofemail=0)
Return a formatted address string for SMTP protocol.
static getArrayAddress($address)
Return a formatted array of address string for SMTP protocol.
Class for ConferenceOrBoothAttendee.
Class to manage emailings module.
Parent class of emailing target selectors modules.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
dol_stringtotime($string, $gm=1)
Convert a string date into a GM Timestamps date Warning: YYYY-MM-DDTHH:MM:SS+02:00 (RFC3339) is not s...
emailing_prepare_head(Mailing $object)
Prepare array with list of tabs.
dolGetModulesDirs($subdir='')
Return list of directories that contain modules.
isValidMailDomain($mail)
Return true if email has a domain name that can be resolved to MX type.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_print_email($email, $cid=0, $socid=0, $addlink=0, $max=64, $showinvalid=1, $withpicto=0)
Show EMail link formatted for HTML output.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
img_error($titlealt='default')
Show error logo.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.