29 require
'../../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/modules/mailings/modules_mailings.php';
31 require_once DOL_DOCUMENT_ROOT.
'/comm/mailing/class/mailing.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmailing.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/emailing.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
36 require_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');
46 if (empty($page) || $page == -1) {
49 $offset = $limit * $page;
50 $pageprev = $page - 1;
51 $pagenext = $page + 1;
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';
85 if (version_compare(phpversion(),
'7.0',
'>=')) {
86 $listofmethods[
'swiftmailer'] =
'Swift Mailer socket library';
90 if (!$user->hasRight(
'mailing',
'lire') || (!
getDolGlobalString(
'EXTERNAL_USERS_ARE_AUTHORIZED') && $user->socid > 0)) {
100 if ($action ==
'add' && $user->hasRight(
'mailing',
'creer')) {
101 $module =
GETPOST(
"module",
'alpha');
104 foreach ($modulesdir as $dir) {
107 dol_syslog(
"Scan directory ".$dir.
" for modules");
110 $file = $dir.
"/".$module.
".modules.php";
111 $classname =
"mailing_".$module;
113 if (file_exists($file)) {
117 dol_syslog(
"Call add_to_target() on class ".$classname.
" evenunsubscribe=".
$object->evenunsubscribe);
119 if (class_exists($classname)) {
120 $obj =
new $classname($db);
121 $obj->evenunsubscribe =
$object->evenunsubscribe;
123 $result = $obj->add_to_target($id);
125 $sqlmessage = $obj->sql;
134 if (
$object->status == $object::STATUS_SENTCOMPLETELY) {
135 $object->setStatut($object::STATUS_SENTPARTIALY);
145 setEventMessages($langs->trans(
"Error").($obj->error ?
' '.$obj->error :
''),
null,
'errors');
149 if (
GETPOSTINT(
'clearlist') && $user->hasRight(
'mailing',
'creer')) {
152 $obj->clear_target($id);
159 if (
GETPOSTINT(
'exportcsv') && $user->hasRight(
'mailing',
'lire')) {
160 $completefilename =
'targets_emailing'.$object->id.
'_'.
dol_print_date(
dol_now(),
'dayhourlog').
'.csv';
161 header(
'Content-Type: text/csv');
162 header(
'Content-Disposition: attachment;filename='.$completefilename);
165 $sql =
"SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut as status, mc.date_envoi, mc.tms,";
166 $sql .=
" mc.source_id, mc.source_type, mc.error_text";
167 $sql .=
" FROM ".MAIN_DB_PREFIX.
"mailing_cibles as mc";
168 $sql .=
" WHERE mc.fk_mailing = ".((int)
$object->id);
169 $sql .= $db->order($sortfield, $sortorder);
171 $resql = $db->query(
$sql);
173 $num = $db->num_rows($resql);
176 while ($obj = $db->fetch_object($resql)) {
177 print $obj->rowid.$sep;
178 print
'"'.$obj->lastname.
'"'.$sep;
179 print
'"'.$obj->firstname.
'"'.$sep;
180 print $obj->email.$sep;
181 print $obj->other.$sep;
182 print $obj->tms.$sep;
183 print $obj->source_type.$sep;
184 print $obj->source_id.$sep;
185 print $obj->date_envoi.$sep;
186 print $obj->status.$sep;
187 print
'"'.$obj->error_text.
'"'.$sep;
198 if ($action ==
'delete' && $user->hasRight(
'mailing',
'creer')) {
200 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"mailing_cibles WHERE rowid = ".((int) $rowid);
201 $resql = $db->query(
$sql);
205 $obj->update_nb($id);
209 header(
"Location: list.php");
218 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
219 $search_lastname =
'';
220 $search_firstname =
'';
223 $search_dest_status =
'';
227 if ($action ==
'settitle' || $action ==
'setemail_from' || $action ==
'setreplyto' || $action ==
'setemail_errorsto' || $action ==
'setevenunsubscribe') {
230 if ($action ==
'settitle') {
232 } elseif ($action ==
'setemail_from') {
233 $object->email_from = trim(
GETPOST(
'email_from',
'alphawithlgt'));
234 } elseif ($action ==
'setemail_replyto') {
235 $object->email_replyto = trim(
GETPOST(
'email_replyto',
'alphawithlgt'));
236 } elseif ($action ==
'setemail_errorsto') {
237 $object->email_errorsto = trim(
GETPOST(
'email_errorsto',
'alphawithlgt'));
238 } elseif ($action ==
'settitle' && empty(
$object->title)) {
239 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"MailTitle"));
240 } elseif ($action ==
'setfrom' && empty(
$object->email_from)) {
241 $mesg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"MailFrom"));
242 } elseif ($action ==
'setevenunsubscribe') {
247 $result =
$object->update($user);
249 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
264 llxHeader(
'', $langs->trans(
"Mailing"),
'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing');
266 $form =
new Form($db);
269 if (
$object->fetch($id) >= 0) {
274 $linkback =
'<a href="'.DOL_URL_ROOT.
'/comm/mailing/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
276 $morehtmlref =
'<div class="refidno">';
278 $morehtmlref .= $form->editfieldkey(
"",
'title',
$object->title,
$object, 0,
'string',
'', 0, 1);
279 $morehtmlref .= $form->editfieldval(
"",
'title',
$object->title,
$object, 0,
'string',
'',
null,
null,
'', 1);
280 $morehtmlref .=
'</div>';
282 $morehtmlstatus =
'';
284 if (
$object->status == $object::STATUS_SENTPARTIALY ||
$object->status == $object::STATUS_SENTCOMPLETELY) {
285 $nbtry =
$object->countNbOfTargets(
'alreadysent');
286 $nbko =
$object->countNbOfTargets(
'alreadysentko');
287 $nbok = ($nbtry - $nbko);
289 $morehtmlstatus .=
' ('.$nbtry.
'/'.
$object->nbemail;
291 $morehtmlstatus .=
' - '.$nbko.
' '.$langs->trans(
"Error");
293 $morehtmlstatus .=
') ';
296 dol_banner_tab(
$object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref,
'', 0,
'', $morehtmlstatus);
298 print
'<div class="fichecenter">';
299 print
'<div class="fichehalfleft">';
300 print
'<div class="underbanner clearboth"></div>';
302 print
'<table class="border centpercent tableforfield">';
304 print
'<tr><td class="titlefield">'.$langs->trans(
"MailFrom").
'</td><td>';
306 foreach ($emailarray as $email => $name) {
307 if ($name && $name != $email) {
311 $langs->load(
"errors");
312 print
img_warning($langs->trans(
"ErrorBadEMail", $email));
323 if (
$object->messtype !=
'sms') {
324 print
'<tr><td>'.$langs->trans(
"MailErrorsTo").
'</td><td>';
326 foreach ($emailarray as $email => $name) {
327 if ($name != $email) {
331 $langs->load(
"errors");
332 print
img_warning($langs->trans(
"ErrorBadEMail", $email));
345 print
'<div class="fichehalfright">';
346 print
'<div class="underbanner clearboth"></div>';
348 print
'<table class="border centpercent tableforfield">';
352 print $langs->trans(
"TotalNbOfDistinctRecipients");
355 if (is_numeric($nbemail)) {
357 if ((
getDolGlobalString(
'MAILING_LIMIT_SENDBYWEB') && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && (
$object->status == 1 || (
$object->status == 2 && $nbtry < $nbemail))) {
359 $text .= $langs->trans(
'LimitSendingEmailing',
getDolGlobalString(
'MAILING_LIMIT_SENDBYWEB'));
361 $text .= $langs->trans(
'SendingFromWebInterfaceIsNotAllowed');
364 if (empty($nbemail)) {
365 $nbemail .=
' '.img_warning($langs->trans(
'ToAddRecipientsChooseHere'));
369 print $form->textwithpicto($nbemail, $text, 1,
'warning');
377 print $langs->trans(
"MAIN_MAIL_SENDMODE");
384 $text = $listofmethods[
'mail'];
389 print
' <span class="opacitymedium">('.getDolGlobalString(
'MAIN_MAIL_SMTP_SERVER_EMAILING').
')</span>';
392 print
' <span class="opacitymedium">('.getDolGlobalString(
'MAIN_MAIL_SMTP_SERVER').
')</span>';
397 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
403 print
'<div class="clearboth"></div>';
411 $allowaddtarget = (
$object->status == $object::STATUS_DRAFT);
412 if (
GETPOST(
'allowaddtarget')) {
415 if (!$allowaddtarget) {
416 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&allowaddtarget=1',
'', $user->hasRight(
'mailing',
'creer'));
420 if ($allowaddtarget && $user->hasRight(
'mailing',
'creer')) {
421 print
load_fiche_titre($langs->trans(
"ToAddRecipientsChooseHere"), ($user->admin ?
info_admin($langs->trans(
"YouCanAddYourOwnPredefindedListHere"), 1) :
''),
'generic');
423 print
'<div class="div-table-responsive">';
424 print
'<div class="tagtable centpercentwithout1imp liste_titre_bydiv borderbottom" id="tablelines">';
426 print
'<div class="tagtr liste_titre">';
427 print
'<div class="tagtd"></div>';
428 print
'<div class="tagtd">'.$langs->trans(
"RecipientSelectionModules").
'</div>';
429 print
'<div class="tagtd center maxwidth150">';
430 if (
$object->messtype !=
'sms') {
431 print $langs->trans(
"NbOfUniqueEMails");
433 print $langs->trans(
"NbOfUniquePhones");
436 print
'<div class="tagtd left"><div class="inline-block">'.$langs->trans(
"Filters").
'</div>';
437 if (
$object->messtype !=
'sms') {
438 print
' <div class=" inline-block">'.$langs->trans(
"EvenUnsubscribe").
' ';
439 print
ajax_object_onoff(
$object,
'evenunsubscribe',
'evenunsubscribe',
'EvenUnsubscribe:switch_on:warning',
'EvenUnsubscribe', array(),
'small valignmiddle',
'', 1);
443 print
'<div class="tagtd"> </div>';
448 foreach ($modulesdir as $dir) {
449 $modulenames = array();
453 dol_syslog(
"Scan directory ".$dir.
" for modules");
454 $handle = @opendir($dir);
455 if (is_resource($handle)) {
456 while (($file = readdir($handle)) !==
false) {
457 if (substr($file, 0, 1) !=
'.' && substr($file, 0, 3) !=
'CVS') {
459 if (preg_match(
"/(.*)\.modules\.php$/i", $file, $reg)) {
460 if ($reg[1] ==
'example') {
463 $modulenames[] = $reg[1];
476 foreach ($modulenames as $modulename) {
478 $file = $dir.$modulename.
".modules.php";
479 $classname =
"mailing_".$modulename;
482 $obj =
new $classname($db);
485 $qualified = (is_null($obj->enabled) ? 1 : (int)
dol_eval($obj->enabled, 1));
488 foreach ($obj->require_module as $key) {
489 if (empty($conf->$key->enabled) || (empty($user->admin) && $obj->require_admin)) {
500 if ($allowaddtarget) {
501 print
'<form '.$bctag[$var].
' name="'.$modulename.
'" action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&module='.$modulename.
'" method="POST" enctype="multipart/form-data">';
502 print
'<input type="hidden" name="token" value="'.newToken().
'">';
503 print
'<input type="hidden" name="action" value="add">';
504 print
'<input type="hidden" name="page_y" value="'.newToken().
'">';
506 print
'<div '.$bctag[$var].
'>';
509 print
'<div class="tagtd paddingleftimp marginleftonly paddingrightimp marginrightonly valignmiddle center">';
510 if (empty($obj->picto)) {
511 $obj->picto =
'generic';
513 print
img_object($langs->trans(
"EmailingTargetSelector").
': '.get_class($obj), $obj->picto,
'class="valignmiddle width25 size15x"');
515 print
'<div class="tagtd valignmiddle">';
516 print $obj->getDesc();
520 $obj->evenunsubscribe =
$object->evenunsubscribe;
522 $nbofrecipient = $obj->getNbOfRecipients(
'');
527 print
'<div class="tagtd center valignmiddle">';
528 if ($nbofrecipient ===
'' || $nbofrecipient >= 0) {
529 print $nbofrecipient;
531 print $langs->trans(
"Error").
' '.
img_error($obj->error);
535 print
'<div class="tagtd left valignmiddle">';
536 if ($allowaddtarget) {
538 $filter = $obj->formFilter();
545 print $langs->trans(
"None");
550 print
'<div class="tagtd right valignmiddle">';
551 if ($allowaddtarget) {
552 print
'<input type="submit" class="button button-add small reposition" name="button_'.$modulename.
'" value="'.$langs->trans(
"Add").
'">';
554 print
'<input type="submit" class="button small disabled" disabled="disabled" name="button_'.$modulename.
'" value="'.$langs->trans(
"Add").
'">';
560 if ($allowaddtarget) {
569 $parameters = array();
570 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
571 print $hookmanager->resPrint;
578 if ($sqlmessage && $user->admin) {
579 print
info_admin($langs->trans(
"SQLUsedForExport").
':<br> '.$sqlmessage, 0, 0, 1,
'',
'TechnicalInformation');
587 $sql =
"SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut as status, mc.date_envoi, mc.tms,";
588 $sql .=
" mc.source_url, mc.source_id, mc.source_type, mc.error_text,";
589 $sql .=
" COUNT(mu.rowid) as nb";
590 $sql .=
" FROM ".MAIN_DB_PREFIX.
"mailing_cibles as mc";
591 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"mailing_unsubscribe as mu ON mu.email = mc.email";
592 $sql .=
" WHERE mc.fk_mailing=".((int)
$object->id);
593 $asearchcriteriahasbeenset = 0;
594 if ($search_lastname) {
596 $asearchcriteriahasbeenset++;
598 if ($search_firstname) {
600 $asearchcriteriahasbeenset++;
604 $asearchcriteriahasbeenset++;
608 $asearchcriteriahasbeenset++;
610 if ($search_dest_status !=
'' && (
int) $search_dest_status >= -1) {
611 $sql .=
" AND mc.statut = ".((int) $search_dest_status);
612 $asearchcriteriahasbeenset++;
614 $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';
615 $sql .= $db->order($sortfield, $sortorder);
619 $nbtotalofrecords =
'';
621 $result = $db->query(
$sql);
622 $nbtotalofrecords = $db->num_rows($result);
623 if (($page * $limit) > $nbtotalofrecords) {
629 if (empty($asearchcriteriahasbeenset)) {
630 if ($nbtotalofrecords !=
$object->nbemail) {
631 dol_syslog(
"We found a difference in nb of record in target table and the property ->nbemail, we fix ->nbemail");
633 $resultrefresh =
$object->refreshNbOfTargets();
634 if ($resultrefresh < 0) {
642 $sql .= $db->plimit($limit + 1, $offset);
644 $resql = $db->query(
$sql);
646 $num = $db->num_rows($resql);
648 $param =
"&id=".$object->id;
650 if ($limit > 0 && $limit != $conf->liste_limit) {
651 $param .=
'&limit='.((int) $limit);
653 if ($search_lastname) {
654 $param .=
"&search_lastname=".urlencode($search_lastname);
656 if ($search_firstname) {
657 $param .=
"&search_firstname=".urlencode($search_firstname);
660 $param .=
"&search_email=".urlencode($search_email);
663 $param .=
"&search_other=".urlencode($search_other);
666 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
667 print
'<input type="hidden" name="token" value="'.newToken().
'">';
668 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
669 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
670 print
'<input type="hidden" name="page" value="'.$page.
'">';
671 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
672 print
'<input type="hidden" name="page_y" value="">';
674 $morehtmlcenter =
'';
675 if (
$object->status == $object::STATUS_DRAFT) {
676 $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>';
678 $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>';
680 $massactionbutton =
'';
683 print_barre_liste($langs->trans(
"MailSelectedRecipients"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $morehtmlcenter, $num, $nbtotalofrecords,
'generic', 0, $newcardbutton,
'', $limit, 0, 0, 1);
687 print
"\n<!-- Liste destinataires selectionnes -->\n";
688 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
689 print
'<input type="hidden" name="token" value="'.newToken().
'">';
690 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
691 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
692 print
'<input type="hidden" name="page" value="'.$page.
'">';
693 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
694 print
'<input type="hidden" name="limit" value="'.$limit.
'">';
695 print
'<input type="hidden" name="page_y" value="">';
697 print
'<div class="div-table-responsive">';
698 print
'<table class="noborder centpercent">';
701 print
'<tr class="liste_titre_filter">';
705 print
'<td class="liste_titre maxwidthsearch">';
706 $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0,
'checkforselect', 1);
711 print
'<td class="liste_titre">';
712 print
'<input class="flat maxwidth75" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).
'">';
715 print
'<td class="liste_titre">';
716 print
'<input class="flat maxwidth50" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).
'">';
719 print
'<td class="liste_titre">';
720 print
'<input class="flat maxwidth50" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).
'">';
723 print
'<td class="liste_titre">';
724 print
'<input class="flat maxwidth100" type="text" name="search_other" value="'.dol_escape_htmltag($search_other).
'">';
727 print
'<td class="liste_titre">';
732 print
'<td class="liste_titre">';
737 print
'<td class="liste_titre">';
742 print
'<td class="liste_titre center parentonrightofpage">';
743 print $formmailing->selectDestinariesStatus($search_dest_status,
'search_dest_status', 1,
'width100 onrightofpage');
748 print
'<td class="liste_titre maxwidthsearch">';
749 $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0,
'checkforselect', 1);
757 $param .=
"&page=".urlencode((
string) ($page));
760 print
'<tr class="liste_titre">';
766 print_liste_field_titre(
"Lastname", $_SERVER[
"PHP_SELF"],
"mc.lastname", $param,
"",
"", $sortfield, $sortorder);
767 print_liste_field_titre(
"Firstname", $_SERVER[
"PHP_SELF"],
"mc.firstname", $param,
"",
"", $sortfield, $sortorder);
768 print_liste_field_titre(
"OtherInformations", $_SERVER[
"PHP_SELF"],
"", $param,
"",
"", $sortfield, $sortorder);
769 print_liste_field_titre(
"Source", $_SERVER[
"PHP_SELF"],
"", $param,
"",
'', $sortfield, $sortorder,
'center ');
771 print_liste_field_titre(
"DateLastModification", $_SERVER[
"PHP_SELF"],
"mc.tms", $param,
"",
'', $sortfield, $sortorder,
'center ');
773 print_liste_field_titre(
"DateSending", $_SERVER[
"PHP_SELF"],
"mc.date_envoi", $param,
'',
'', $sortfield, $sortorder,
'center ');
774 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"mc.statut", $param,
'',
'', $sortfield, $sortorder,
'center ');
784 include_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
785 include_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
786 include_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
787 include_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
788 include_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
790 $objectstaticmember =
new Adherent($db);
791 $objectstaticuser =
new User($db);
792 $objectstaticcompany =
new Societe($db);
793 $objectstaticcontact =
new Contact($db);
796 while ($i < min($num, $limit)) {
797 $obj = $db->fetch_object($resql);
799 print
'<tr class="oddeven">';
803 print
'<td class="center">';
804 print
'<!-- ID mailing_cibles = '.$obj->rowid.
' -->';
805 if ($obj->status == $object::STATUS_DRAFT) {
806 if ($user->hasRight(
'mailing',
'creer')) {
807 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&rowid='.((int) $obj->rowid).$param.
'">'.
img_delete($langs->trans(
"RemoveRecipient")).
'</a>';
817 print
'<td class="tdoverflowmax150">';
818 print
img_picto($obj->email,
'email',
'class="paddingright"');
820 print
img_warning($langs->trans(
"EmailOptedOut"),
'warning',
'pictofixedwidth');
825 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).
'">'.
dol_escape_htmltag($obj->lastname).
'</td>';
827 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->firstname).
'">'.
dol_escape_htmltag($obj->firstname).
'</td>';
829 print
'<td class="tdoverflowmax300" title="'.dol_escape_htmltag($obj->other).
'"><span class="small">'.
dol_escape_htmltag($obj->other).
'</small></td>';
831 print
'<td class="center tdoverflowmax150">';
832 if (empty($obj->source_id) || empty($obj->source_type)) {
833 print empty($obj->source_url) ?
'' : $obj->source_url;
835 if ($obj->source_type ==
'member') {
836 $objectstaticmember->fetch($obj->source_id);
837 print $objectstaticmember->getNomUrl(1);
838 } elseif ($obj->source_type ==
'user') {
839 $objectstaticuser->fetch($obj->source_id);
840 print $objectstaticuser->getNomUrl(1);
841 } elseif ($obj->source_type ==
'thirdparty') {
842 $objectstaticcompany->fetch($obj->source_id);
843 print $objectstaticcompany->getNomUrl(1);
844 } elseif ($obj->source_type ==
'contact') {
845 $objectstaticcontact->fetch($obj->source_id);
846 print $objectstaticcontact->getNomUrl(1);
847 } elseif ($obj->source_type ==
'eventorganizationattendee') {
848 $objectstaticeventorganization->fetch($obj->source_id);
849 print $objectstaticeventorganization->getNomUrl(1);
851 print $obj->source_url;
857 print
'<td class="center nowraponall">';
862 print
'<td class="center nowraponall">';
863 if ($obj->status != $object::STATUS_DRAFT) {
865 print $obj->date_envoi;
870 print
'<td class="nowrap center">';
871 if ($obj->status == $object::STATUS_DRAFT) {
872 print $object::libStatutDest($obj->status, 2,
'');
874 print $object::libStatutDest($obj->status, 2, $obj->error_text);
880 print
'<td class="center">';
881 print
'<!-- ID mailing_cibles = '.$obj->rowid.
' -->';
882 if ($obj->status == $object::STATUS_DRAFT) {
883 if ($user->hasRight(
'mailing',
'creer')) {
884 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&rowid='.((int) $obj->rowid).$param.
'">'.
img_delete($langs->trans(
"RemoveRecipient")).
'</a>';
898 if (
$object->status < $object::STATUS_SENTPARTIALY) {
899 print
'<tr><td colspan="9">';
900 print
'<span class="opacitymedium">'.$langs->trans(
"NoTargetYet").
'</span>';
903 print
'<tr><td colspan="9">';
904 print
'<span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span>';
908 print
"</table><br>";
918 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)
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 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.
if(isModEnabled('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')) $sql
Social contributions to pay.
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.
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.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information in HTML for admin users or standard users.
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...
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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.