28 require
'../../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/modules/mailings/modules_mailings.php';
30 require_once DOL_DOCUMENT_ROOT.
'/comm/mailing/class/mailing.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmailing.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/emailing.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/ajax.lib.php';
38 $langs->loadLangs(array(
"mails",
"admin"));
41 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
42 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
43 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
45 if (empty($page) || $page == -1) {
48 $offset = $limit * $page;
49 $pageprev = $page - 1;
50 $pagenext = $page + 1;
52 $sortfield =
"mc.statut,email";
55 $sortorder =
"DESC,ASC";
59 $rowid =
GETPOST(
'rowid',
'int');
60 $action =
GETPOST(
'action',
'aZ09');
61 $search_lastname =
GETPOST(
"search_lastname",
'alphanohtml');
62 $search_firstname =
GETPOST(
"search_firstname",
'alphanohtml');
63 $search_email =
GETPOST(
"search_email",
'alphanohtml');
64 $search_other =
GETPOST(
"search_other",
'alphanohtml');
65 $search_dest_status =
GETPOST(
'search_dest_status',
'int');
71 $result = $object->fetch($id);
74 $hookmanager->initHooks(array(
'ciblescard',
'globalcard'));
79 $listofmethods = array();
81 $listofmethods[
'mail'] =
'PHP mail function';
83 $listofmethods[
'smtps'] =
'SMTP/SMTPS socket library';
84 if (version_compare(phpversion(),
'7.0',
'>=')) {
85 $listofmethods[
'swiftmailer'] =
'Swift Mailer socket library';
89 if (!$user->hasRight(
'mailing',
'lire') || (empty($conf->global->EXTERNAL_USERS_ARE_AUTHORIZED) && $user->socid > 0)) {
99 if ($action ==
'add' && $user->hasRight(
'mailing',
'creer')) {
100 $module =
GETPOST(
"module",
'alpha');
103 foreach ($modulesdir as $dir) {
106 dol_syslog(
"Scan directory ".$dir.
" for modules");
109 $file = $dir.
"/".$module.
".modules.php";
110 $classname =
"mailing_".$module;
112 if (file_exists($file)) {
116 dol_syslog(
"Call add_to_target() on class ".$classname.
" evenunsubscribe=".$object->evenunsubscribe);
118 if (class_exists($classname)) {
119 $obj =
new $classname($db);
120 $obj->evenunsubscribe = $object->evenunsubscribe;
122 $result = $obj->add_to_target($id);
124 $sqlmessage = $obj->sql;
139 setEventMessages($langs->trans(
"Error").($obj->error ?
' '.$obj->error :
''),
null,
'errors');
143 if (
GETPOST(
'clearlist',
'int') && $user->hasRight(
'mailing',
'creer')) {
146 $obj->clear_target($id);
153 if (
GETPOST(
'exportcsv',
'int') && $user->hasRight(
'mailing',
'lire')) {
154 $completefilename =
'targets_emailing'.$object->id.
'_'.
dol_print_date(
dol_now(),
'dayhourlog').
'.csv';
155 header(
'Content-Type: text/csv');
156 header(
'Content-Disposition: attachment;filename='.$completefilename);
159 $sql =
"SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut as status, mc.date_envoi, mc.tms,";
160 $sql .=
" mc.source_id, mc.source_type, mc.error_text";
161 $sql .=
" FROM ".MAIN_DB_PREFIX.
"mailing_cibles as mc";
162 $sql .=
" WHERE mc.fk_mailing = ".((int) $object->id);
163 $sql .= $db->order($sortfield, $sortorder);
165 $resql = $db->query(
$sql);
167 $num = $db->num_rows($resql);
170 while ($obj = $db->fetch_object($resql)) {
171 print $obj->rowid.$sep;
172 print
'"'.$obj->lastname.
'"'.$sep;
173 print
'"'.$obj->firstname.
'"'.$sep;
174 print $obj->email.$sep;
175 print $obj->other.$sep;
176 print $obj->tms.$sep;
177 print $obj->source_type.$sep;
178 print $obj->source_id.$sep;
179 print $obj->date_envoi.$sep;
180 print $obj->status.$sep;
181 print
'"'.$obj->error_text.
'"'.$sep;
192 if ($action ==
'delete' && $user->hasRight(
'mailing',
'creer')) {
194 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"mailing_cibles WHERE rowid = ".((int) $rowid);
195 $resql = $db->query(
$sql);
199 $obj->update_nb($id);
203 header(
"Location: list.php");
212 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
213 $search_lastname =
'';
214 $search_firstname =
'';
217 $search_dest_status =
'';
221 if ($action ==
'settitle' || $action ==
'setemail_from' || $action ==
'setreplyto' || $action ==
'setemail_errorsto' || $action ==
'setevenunsubscribe') {
222 $upload_dir = $conf->mailing->dir_output.
"/".
get_exdir($object->id, 2, 0, 1, $object,
'mailing');
224 if ($action ==
'settitle') {
225 $object->title = trim(
GETPOST(
'title',
'alpha'));
226 } elseif ($action ==
'setemail_from') {
227 $object->email_from = trim(
GETPOST(
'email_from',
'alphawithlgt'));
228 } elseif ($action ==
'setemail_replyto') {
229 $object->email_replyto = trim(
GETPOST(
'email_replyto',
'alphawithlgt'));
230 } elseif ($action ==
'setemail_errorsto') {
231 $object->email_errorsto = trim(
GETPOST(
'email_errorsto',
'alphawithlgt'));
232 } elseif ($action ==
'settitle' && empty($object->title)) {
233 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"MailTitle"));
234 } elseif ($action ==
'setfrom' && empty($object->email_from)) {
235 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"MailFrom"));
236 } elseif ($action ==
'setevenunsubscribe') {
237 $object->evenunsubscribe = (
GETPOST(
'evenunsubscribe') ? 1 : 0);
241 $result = $object->update($user);
243 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
246 $mesg = $object->error;
258 llxHeader(
'', $langs->trans(
"Mailing"),
'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing');
263 if ($object->fetch($id) >= 0) {
268 $linkback =
'<a href="'.DOL_URL_ROOT.
'/comm/mailing/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
270 $morehtmlref =
'<div class="refidno">';
272 $morehtmlref .=
$form->editfieldkey(
"",
'title', $object->title, $object, 0,
'string',
'', 0, 1);
273 $morehtmlref .=
$form->editfieldval(
"",
'title', $object->title, $object, 0,
'string',
'',
null,
null,
'', 1);
274 $morehtmlref .=
'</div>';
278 if ($object->statut == $object::STATUS_SENTPARTIALY || $object->statut == $object::STATUS_SENTCOMPLETELY) {
279 $nbtry = $object->countNbOfTargets(
'alreadysent');
280 $nbko = $object->countNbOfTargets(
'alreadysentko');
281 $nbok = ($nbtry - $nbko);
283 $morehtmlright .=
' ('.$nbtry.
'/'.$object->nbemail;
285 $morehtmlright .=
' - '.$nbko.
' '.$langs->trans(
"Error");
287 $morehtmlright .=
') ';
290 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref,
'', 0,
'', $morehtmlright);
292 print
'<div class="fichecenter">';
293 print
'<div class="fichehalfleft">';
294 print
'<div class="underbanner clearboth"></div>';
296 print
'<table class="border centpercent tableforfield">';
298 print
'<tr><td class="titlefield">'.$langs->trans(
"MailFrom").
'</td><td>';
300 foreach ($emailarray as $email => $name) {
301 if ($name && $name != $email) {
305 $langs->load(
"errors");
306 print
img_warning($langs->trans(
"ErrorBadEMail", $email));
317 print
'<tr><td>'.$langs->trans(
"MailErrorsTo").
'</td><td>';
319 foreach ($emailarray as $email => $name) {
320 if ($name != $email) {
324 $langs->load(
"errors");
325 print
img_warning($langs->trans(
"ErrorBadEMail", $email));
337 print
'<div class="fichehalfright">';
338 print
'<div class="underbanner clearboth"></div>';
340 print
'<table class="border centpercent tableforfield">';
343 print
'<tr><td class="titlefield">';
344 print $langs->trans(
"TotalNbOfDistinctRecipients");
346 $nbemail = ($object->nbemail ? $object->nbemail : 0);
347 if (is_numeric($nbemail)) {
349 if ((!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || ($object->statut == 2 && $nbtry < $nbemail))) {
350 if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0) {
351 $text .= $langs->trans(
'LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB);
353 $text .= $langs->trans(
'SendingFromWebInterfaceIsNotAllowed');
356 if (empty($nbemail)) {
357 $nbemail .=
' '.img_warning($langs->trans(
'ToAddRecipientsChooseHere'));
360 print
$form->textwithpicto($nbemail, $text, 1,
'warning');
368 print $langs->trans(
"MAIN_MAIL_SENDMODE");
375 $text = $listofmethods[
'mail'];
380 print
' <span class="opacitymedium">('.getDolGlobalString(
'MAIN_MAIL_SMTP_SERVER_EMAILING').
')</span>';
383 print
' <span class="opacitymedium">('.getDolGlobalString(
'MAIN_MAIL_SMTP_SERVER').
')</span>';
388 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
394 print
'<div class="clearboth"></div>';
401 $allowaddtarget = ($object->statut == $object::STATUS_DRAFT);
404 if ($allowaddtarget && $user->rights->mailing->creer) {
405 print
load_fiche_titre($langs->trans(
"ToAddRecipientsChooseHere"), ($user->admin ?
info_admin($langs->trans(
"YouCanAddYourOwnPredefindedListHere"), 1) :
''),
'generic');
407 print
'<div class="div-table-responsive">';
408 print
'<div class="tagtable centpercentwithout1imp liste_titre_bydiv borderbottom" id="tablelines">';
410 print
'<div class="tagtr liste_titre">';
411 print
'<div class="tagtd"></div>';
412 print
'<div class="tagtd">'.$langs->trans(
"RecipientSelectionModules").
'</div>';
413 print
'<div class="tagtd center maxwidth150">'.$langs->trans(
"NbOfUniqueEMails").
'</div>';
414 print
'<div class="tagtd left"><div class="inline-block">'.$langs->trans(
"Filters").
'</div>';
415 print
' <div class=" inline-block">'.$langs->trans(
"EvenUnsubscribe").
' ';
416 print
ajax_object_onoff($object,
'evenunsubscribe',
'evenunsubscribe',
'EvenUnsubscribe:switch_on:warning',
'EvenUnsubscribe', array(),
'small valignmiddle',
'', 1);
419 print
'<div class="tagtd"> </div>';
424 foreach ($modulesdir as $dir) {
425 $modulenames = array();
429 dol_syslog(
"Scan directory ".$dir.
" for modules");
430 $handle = @opendir($dir);
431 if (is_resource($handle)) {
432 while (($file = readdir($handle)) !==
false) {
433 if (substr($file, 0, 1) <>
'.' && substr($file, 0, 3) <>
'CVS') {
435 if (preg_match(
"/(.*)\.modules\.php$/i", $file, $reg)) {
436 if ($reg[1] ==
'example') {
439 $modulenames[] = $reg[1];
452 foreach ($modulenames as $modulename) {
454 $file = $dir.$modulename.
".modules.php";
455 $classname =
"mailing_".$modulename;
458 $obj =
new $classname($db);
461 $qualified = (is_null($obj->enabled) ? 1 :
dol_eval($obj->enabled, 1));
464 foreach ($obj->require_module as $key) {
465 if (empty($conf->$key->enabled) || (empty($user->admin) && $obj->require_admin)) {
476 if ($allowaddtarget) {
477 print
'<form '.$bctag[$var].
' name="'.$modulename.
'" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&module='.$modulename.
'" method="POST" enctype="multipart/form-data">';
478 print
'<input type="hidden" name="token" value="'.newToken().
'">';
479 print
'<input type="hidden" name="action" value="add">';
480 print
'<input type="hidden" name="page_y" value="'.newToken().
'">';
482 print
'<div '.$bctag[$var].
'>';
485 print
'<div class="tagtd paddingleftimp marginleftonly paddingrightimp marginrightonly valignmiddle center">';
486 if (empty($obj->picto)) {
487 $obj->picto =
'generic';
489 print
img_object($langs->trans(
"EmailingTargetSelector").
': '.get_class($obj), $obj->picto,
'class="valignmiddle width25 size15x"');
491 print
'<div class="tagtd valignmiddle">';
492 print $obj->getDesc();
496 $obj->evenunsubscribe = $object->evenunsubscribe;
498 $nbofrecipient = $obj->getNbOfRecipients(
'');
503 print
'<div class="tagtd center valignmiddle">';
504 if ($nbofrecipient ===
'' || $nbofrecipient >= 0) {
505 print $nbofrecipient;
507 print $langs->trans(
"Error").
' '.
img_error($obj->error);
511 print
'<div class="tagtd left valignmiddle">';
512 if ($allowaddtarget) {
514 $filter = $obj->formFilter();
521 print $langs->trans(
"None");
526 print
'<div class="tagtd right valignmiddle">';
527 if ($allowaddtarget) {
528 print
'<input type="submit" class="button button-add small reposition" name="button_'.$modulename.
'" value="'.$langs->trans(
"Add").
'">';
530 print
'<input type="submit" class="button small disabled" disabled="disabled" name="button_'.$modulename.
'" value="'.$langs->trans(
"Add").
'">';
536 if ($allowaddtarget) {
545 $parameters = array();
546 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
547 print $hookmanager->resPrint;
554 if ($sqlmessage && $user->admin) {
555 print
info_admin($langs->trans(
"SQLUsedForExport").
':<br> '.$sqlmessage, 0, 0, 1,
'',
'TechnicalInformation');
563 $sql =
"SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.tms,";
564 $sql .=
" mc.source_url, mc.source_id, mc.source_type, mc.error_text,";
565 $sql .=
" COUNT(mu.rowid) as nb";
566 $sql .=
" FROM ".MAIN_DB_PREFIX.
"mailing_cibles as mc";
567 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"mailing_unsubscribe as mu ON mu.email = mc.email";
568 $sql .=
" WHERE mc.fk_mailing=".((int) $object->id);
569 $asearchcriteriahasbeenset = 0;
570 if ($search_lastname) {
572 $asearchcriteriahasbeenset++;
574 if ($search_firstname) {
576 $asearchcriteriahasbeenset++;
580 $asearchcriteriahasbeenset++;
584 $asearchcriteriahasbeenset++;
586 if ($search_dest_status !=
'' && $search_dest_status >= -1) {
587 $sql .=
" AND mc.statut = ".((int) $search_dest_status);
588 $asearchcriteriahasbeenset++;
590 $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';
591 $sql .= $db->order($sortfield, $sortorder);
595 $nbtotalofrecords =
'';
597 $result = $db->query(
$sql);
598 $nbtotalofrecords = $db->num_rows($result);
599 if (($page * $limit) > $nbtotalofrecords) {
605 if (empty($asearchcriteriahasbeenset)) {
606 if ($nbtotalofrecords != $object->nbemail) {
607 dol_syslog(
"We found a difference in nb of record in target table and the property ->nbemail, we fix ->nbemail");
609 $resultrefresh = $object->refreshNbOfTargets();
610 if ($resultrefresh < 0) {
618 $sql .= $db->plimit($limit + 1, $offset);
620 $resql = $db->query(
$sql);
622 $num = $db->num_rows($resql);
624 $param =
"&id=".$object->id;
626 if ($limit > 0 && $limit != $conf->liste_limit) {
627 $param .=
'&limit='.((int) $limit);
629 if ($search_lastname) {
630 $param .=
"&search_lastname=".urlencode($search_lastname);
632 if ($search_firstname) {
633 $param .=
"&search_firstname=".urlencode($search_firstname);
636 $param .=
"&search_email=".urlencode($search_email);
639 $param .=
"&search_other=".urlencode($search_other);
642 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
643 print
'<input type="hidden" name="token" value="'.newToken().
'">';
644 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
645 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
646 print
'<input type="hidden" name="page" value="'.$page.
'">';
647 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
649 $morehtmlcenter =
'';
650 if ($allowaddtarget) {
651 $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>';
653 $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>';
655 $massactionbutton =
'';
657 print_barre_liste($langs->trans(
"MailSelectedRecipients"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $morehtmlcenter, $num, $nbtotalofrecords,
'generic', 0,
'',
'', $limit, 0, 0, 1);
661 print
"\n<!-- Liste destinataires selectionnes -->\n";
662 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
663 print
'<input type="hidden" name="token" value="'.newToken().
'">';
664 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
665 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
666 print
'<input type="hidden" name="page" value="'.$page.
'">';
667 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
668 print
'<input type="hidden" name="limit" value="'.$limit.
'">';
669 print
'<input type="hidden" name="page_y" value="">';
671 print
'<div class="div-table-responsive">';
672 print
'<table class="noborder centpercent">';
675 print
'<tr class="liste_titre_filter">';
679 print
'<td class="liste_titre maxwidthsearch">';
680 $searchpicto =
$form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0,
'checkforselect', 1);
685 print
'<td class="liste_titre">';
686 print
'<input class="flat maxwidth75" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).
'">';
689 print
'<td class="liste_titre">';
690 print
'<input class="flat maxwidth50" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).
'">';
693 print
'<td class="liste_titre">';
694 print
'<input class="flat maxwidth50" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).
'">';
697 print
'<td class="liste_titre">';
698 print
'<input class="flat maxwidth100" type="text" name="search_other" value="'.dol_escape_htmltag($search_other).
'">';
701 print
'<td class="liste_titre">';
706 print
'<td class="liste_titre">';
711 print
'<td class="liste_titre">';
716 print
'<td class="liste_titre right">';
717 print $formmailing->selectDestinariesStatus($search_dest_status,
'search_dest_status', 1);
721 print
'<td class="liste_titre maxwidthsearch">';
722 $searchpicto =
$form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0,
'checkforselect', 1);
730 $param .=
"&page=".urlencode($page);
733 print
'<tr class="liste_titre">';
739 print_liste_field_titre(
"Lastname", $_SERVER[
"PHP_SELF"],
"mc.lastname", $param,
"",
"", $sortfield, $sortorder);
740 print_liste_field_titre(
"Firstname", $_SERVER[
"PHP_SELF"],
"mc.firstname", $param,
"",
"", $sortfield, $sortorder);
741 print_liste_field_titre(
"OtherInformations", $_SERVER[
"PHP_SELF"],
"", $param,
"",
"", $sortfield, $sortorder);
742 print_liste_field_titre(
"Source", $_SERVER[
"PHP_SELF"],
"", $param,
"",
'align="center"', $sortfield, $sortorder);
744 print_liste_field_titre(
"DateLastModification", $_SERVER[
"PHP_SELF"],
"mc.tms", $param,
"",
'align="center"', $sortfield, $sortorder);
746 print_liste_field_titre(
"DateSending", $_SERVER[
"PHP_SELF"],
"mc.date_envoi", $param,
'',
'align="center"', $sortfield, $sortorder);
747 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"mc.statut", $param,
'',
'class="right"', $sortfield, $sortorder);
757 include_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
758 include_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
759 include_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
760 include_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
761 include_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
762 $objectstaticmember =
new Adherent($db);
763 $objectstaticuser =
new User($db);
764 $objectstaticcompany =
new Societe($db);
765 $objectstaticcontact =
new Contact($db);
768 while ($i < min($num, $limit)) {
769 $obj = $db->fetch_object($resql);
771 print
'<tr class="oddeven">';
775 print
'<td class="center">';
776 print
'<!-- ID mailing_cibles = '.$obj->rowid.
' -->';
777 if ($obj->statut == $object::STATUS_DRAFT) {
778 if (!empty($user->rights->mailing->creer)) {
779 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&rowid='.((int) $obj->rowid).$param.
'">'.
img_delete($langs->trans(
"RemoveRecipient")).
'</a>';
789 print
'<td class="tdoverflowmax150">';
790 print
img_picto($obj->email,
'email',
'class="paddingright"');
792 print
img_warning($langs->trans(
"EmailOptedOut"),
'warning',
'pictofixedwidth');
797 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).
'">'.
dol_escape_htmltag($obj->lastname).
'</td>';
799 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->firstname).
'">'.
dol_escape_htmltag($obj->firstname).
'</td>';
801 print
'<td><span class="small">'.dol_escape_htmltag($obj->other).
'</small></td>';
803 print
'<td class="center tdoverflowmax150">';
804 if (empty($obj->source_id) || empty($obj->source_type)) {
805 print empty($obj->source_url) ?
'' : $obj->source_url;
807 if ($obj->source_type ==
'member') {
808 $objectstaticmember->fetch($obj->source_id);
809 print $objectstaticmember->getNomUrl(1);
810 } elseif ($obj->source_type ==
'user') {
811 $objectstaticuser->fetch($obj->source_id);
812 print $objectstaticuser->getNomUrl(1);
813 } elseif ($obj->source_type ==
'thirdparty') {
814 $objectstaticcompany->fetch($obj->source_id);
815 print $objectstaticcompany->getNomUrl(1);
816 } elseif ($obj->source_type ==
'contact') {
817 $objectstaticcontact->fetch($obj->source_id);
818 print $objectstaticcontact->getNomUrl(1);
819 } elseif ($obj->source_type ==
'eventorganizationattendee') {
820 $objectstaticeventorganization->fetch($obj->source_id);
821 print $objectstaticeventorganization->getNomUrl(1);
823 print $obj->source_url;
829 print
'<td class="center nowraponall">';
834 if ($obj->statut == $object::STATUS_DRAFT) {
836 print
'<td align="center"></td>';
838 print
'<td class="nowrap right">';
839 print $object::libStatutDest($obj->statut, 2,
'');
843 print
'<td class="center nowraponall">'.$obj->date_envoi.
'</td>';
845 print
'<td class="nowrap right">';
846 print $object::libStatutDest($obj->statut, 2, $obj->error_text);
852 print
'<td class="center">';
853 print
'<!-- ID mailing_cibles = '.$obj->rowid.
' -->';
854 if ($obj->statut == $object::STATUS_DRAFT) {
855 if (!empty($user->rights->mailing->creer)) {
856 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&rowid='.((int) $obj->rowid).$param.
'">'.
img_delete($langs->trans(
"RemoveRecipient")).
'</a>';
870 if ($object->statut < $object::STATUS_SENTPARTIALY) {
871 print
'<tr><td colspan="9">';
872 print
'<span class="opacitymedium">'.$langs->trans(
"NoTargetYet").
'</span>';
875 print
'<tr><td colspan="9">';
876 print
'<span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span>';
880 print
"</table><br>";
890 print
"\n<!-- Fin liste destinataires selectionnes -->\n";