28require 
'../../main.inc.php';
 
   29require_once DOL_DOCUMENT_ROOT.
'/core/modules/mailings/modules_mailings.php';
 
   30require_once DOL_DOCUMENT_ROOT.
'/comm/mailing/class/mailing.class.php';
 
   31require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmailing.class.php';
 
   32require_once DOL_DOCUMENT_ROOT.
'/core/lib/emailing.lib.php';
 
   33require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
 
   34require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
 
   35require_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');
 
   44$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) : 
GETPOST(
"page", 
'int');
 
   45if (empty($page) || $page == -1) {
 
   48$offset = $limit * $page;
 
   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';
 
   84if (version_compare(phpversion(), 
'7.0', 
'>=')) {
 
   85  $listofmethods[
'swiftmailer'] = 
'Swift Mailer socket library';
 
   89if (!$user->hasRight(
'mailing', 
'lire') || (!
getDolGlobalString(
'EXTERNAL_USERS_ARE_AUTHORIZED') && $user->socid > 0)) {
 
   99if ($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');
 
  143if (
GETPOST(
'clearlist', 
'int') && $user->hasRight(
'mailing', 
'creer')) {
 
  146  $obj->clear_target($id);
 
  153if (
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;
 
  192if ($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");
 
  212if (
GETPOST(
'button_removefilter_x', 
'alpha') || 
GETPOST(
'button_removefilter.x', 
'alpha') || 
GETPOST(
'button_removefilter', 
'alpha')) { 
 
  213  $search_lastname = 
'';
 
  214  $search_firstname = 
'';
 
  217  $search_dest_status = 
'';
 
  221if ($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;
 
  258llxHeader(
'', $langs->trans(
"Mailing"), 
'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing');
 
  260$form = 
new Form($db);
 
  263if ($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 ((
getDolGlobalString(
'MAILING_LIMIT_SENDBYWEB') && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || ($object->statut == 2 && $nbtry < $nbemail))) {
 
  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->hasRight(
'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.
'">';
 
  648    print 
'<input type="hidden" name="page_y" value="">';
 
  650    $morehtmlcenter = 
'';
 
  651    if ($allowaddtarget) {
 
  652      $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>';
 
  654    $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>';
 
  656    $massactionbutton = 
'';
 
  658    print_barre_liste($langs->trans(
"MailSelectedRecipients"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $morehtmlcenter, $num, $nbtotalofrecords, 
'generic', 0, 
'', 
'', $limit, 0, 0, 1);
 
  662    print 
"\n<!-- Liste destinataires selectionnes -->\n";
 
  663    print 
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
 
  664    print 
'<input type="hidden" name="token" value="'.newToken().
'">';
 
  665    print 
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
 
  666    print 
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
 
  667    print 
'<input type="hidden" name="page" value="'.$page.
'">';
 
  668    print 
'<input type="hidden" name="id" value="'.$object->id.
'">';
 
  669    print 
'<input type="hidden" name="limit" value="'.$limit.
'">';
 
  670    print 
'<input type="hidden" name="page_y" value="">';
 
  672    print 
'<div class="div-table-responsive">';
 
  673    print 
'<table class="noborder centpercent">';
 
  676    print 
'<tr class="liste_titre_filter">';
 
  680      print 
'<td class="liste_titre maxwidthsearch">';
 
  681      $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 
'checkforselect', 1);
 
  686    print 
'<td class="liste_titre">';
 
  687    print 
'<input class="flat maxwidth75" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).
'">';
 
  690    print 
'<td class="liste_titre">';
 
  691    print 
'<input class="flat maxwidth50" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).
'">';
 
  694    print 
'<td class="liste_titre">';
 
  695    print 
'<input class="flat maxwidth50" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).
'">';
 
  698    print 
'<td class="liste_titre">';
 
  699    print 
'<input class="flat maxwidth100" type="text" name="search_other" value="'.dol_escape_htmltag($search_other).
'">';
 
  702    print 
'<td class="liste_titre">';
 
  707    print 
'<td class="liste_titre">';
 
  712    print 
'<td class="liste_titre">';
 
  717    print 
'<td class="liste_titre center parentonrightofpage">';
 
  718    print $formmailing->selectDestinariesStatus($search_dest_status, 
'search_dest_status', 1, 
'width100 onrightofpage');
 
  723      print 
'<td class="liste_titre maxwidthsearch">';
 
  724      $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 
'checkforselect', 1);
 
  732      $param .= 
"&page=".urlencode($page);
 
  735    print 
'<tr class="liste_titre">';
 
  741    print_liste_field_titre(
"Lastname", $_SERVER[
"PHP_SELF"], 
"mc.lastname", $param, 
"", 
"", $sortfield, $sortorder);
 
  742    print_liste_field_titre(
"Firstname", $_SERVER[
"PHP_SELF"], 
"mc.firstname", $param, 
"", 
"", $sortfield, $sortorder);
 
  743    print_liste_field_titre(
"OtherInformations", $_SERVER[
"PHP_SELF"], 
"", $param, 
"", 
"", $sortfield, $sortorder);
 
  744    print_liste_field_titre(
"Source", $_SERVER[
"PHP_SELF"], 
"", $param, 
"", 
'', $sortfield, $sortorder, 
'center ');
 
  746    print_liste_field_titre(
"DateLastModification", $_SERVER[
"PHP_SELF"], 
"mc.tms", $param, 
"", 
'', $sortfield, $sortorder, 
'center ');
 
  748    print_liste_field_titre(
"DateSending", $_SERVER[
"PHP_SELF"], 
"mc.date_envoi", $param, 
'', 
'', $sortfield, $sortorder, 
'center ');
 
  749    print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"], 
"mc.statut", $param, 
'', 
'', $sortfield, $sortorder, 
'center ');
 
  759      include_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
 
  760      include_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
 
  761      include_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
 
  762      include_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
 
  763      include_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
 
  764      $objectstaticmember = 
new Adherent($db);
 
  765      $objectstaticuser = 
new User($db);
 
  766      $objectstaticcompany = 
new Societe($db);
 
  767      $objectstaticcontact = 
new Contact($db);
 
  770      while ($i < min($num, $limit)) {
 
  771        $obj = $db->fetch_object($resql);
 
  773        print 
'<tr class="oddeven">';
 
  777          print 
'<td class="center">';
 
  778          print 
'<!-- ID mailing_cibles = '.$obj->rowid.
' -->';
 
  779          if ($obj->statut == $object::STATUS_DRAFT) {  
 
  780            if ($user->hasRight(
'mailing', 
'creer')) {
 
  781              print 
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=delete&token='.newToken().
'&rowid='.((int) $obj->rowid).$param.
'">'.
img_delete($langs->trans(
"RemoveRecipient")).
'</a>';
 
  791        print 
'<td class="tdoverflowmax150">';
 
  792        print 
img_picto($obj->email, 
'email', 
'class="paddingright"');
 
  794          print 
img_warning($langs->trans(
"EmailOptedOut"), 
'warning', 
'pictofixedwidth');
 
  799        print 
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).
'">'.
dol_escape_htmltag($obj->lastname).
'</td>';
 
  801        print 
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->firstname).
'">'.
dol_escape_htmltag($obj->firstname).
'</td>';
 
  803        print 
'<td><span class="small">'.dol_escape_htmltag($obj->other).
'</small></td>';
 
  805        print 
'<td class="center tdoverflowmax150">';
 
  806        if (empty($obj->source_id) || empty($obj->source_type)) {
 
  807          print empty($obj->source_url) ? 
'' : $obj->source_url; 
 
  809          if ($obj->source_type == 
'member') {
 
  810            $objectstaticmember->fetch($obj->source_id);
 
  811            print $objectstaticmember->getNomUrl(1);
 
  812          } elseif ($obj->source_type == 
'user') {
 
  813            $objectstaticuser->fetch($obj->source_id);
 
  814            print $objectstaticuser->getNomUrl(1);
 
  815          } elseif ($obj->source_type == 
'thirdparty') {
 
  816            $objectstaticcompany->fetch($obj->source_id);
 
  817            print $objectstaticcompany->getNomUrl(1);
 
  818          } elseif ($obj->source_type == 
'contact') {
 
  819            $objectstaticcontact->fetch($obj->source_id);
 
  820            print $objectstaticcontact->getNomUrl(1);
 
  821          } elseif ($obj->source_type == 
'eventorganizationattendee') {
 
  822            $objectstaticeventorganization->fetch($obj->source_id);
 
  823            print $objectstaticeventorganization->getNomUrl(1);
 
  825            print $obj->source_url;
 
  831        print 
'<td class="center nowraponall">';
 
  836        print 
'<td class="center nowraponall">';
 
  837        if ($obj->statut != $object::STATUS_DRAFT) {
 
  839          print $obj->date_envoi;
 
  844        print 
'<td class="nowrap center">';
 
  845        if ($obj->statut == $object::STATUS_DRAFT) {
 
  846          print $object::libStatutDest($obj->statut, 2, 
'');
 
  848          print $object::libStatutDest($obj->statut, 2, $obj->error_text);
 
  854          print 
'<td class="center">';
 
  855          print 
'<!-- ID mailing_cibles = '.$obj->rowid.
' -->';
 
  856          if ($obj->statut == $object::STATUS_DRAFT) {  
 
  857            if ($user->hasRight(
'mailing', 
'creer')) {
 
  858              print 
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=delete&token='.newToken().
'&rowid='.((int) $obj->rowid).$param.
'">'.
img_delete($langs->trans(
"RemoveRecipient")).
'</a>';
 
  872      if ($object->statut < $object::STATUS_SENTPARTIALY) {
 
  873        print 
'<tr><td colspan="9">';
 
  874        print 
'<span class="opacitymedium">'.$langs->trans(
"NoTargetYet").
'</span>';
 
  877        print 
'<tr><td colspan="9">';
 
  878        print 
'<span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span>';
 
  882    print 
"</table><br>";
 
  892  print 
"\n<!-- Fin liste destinataires selectionnes -->\n";
 
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.
 
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 modules directories.
 
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
 
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
 
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
 
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
 
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.
 
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
 
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
 
dol_get_fiche_end($notab=0)
Return tab footer of a card.
 
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_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
 
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.
 
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
 
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
 
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
 
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 for admin users or standard users.
 
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
 
print_barre_liste($titre, $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.
 
img_error($titlealt='default')
Show error logo.
 
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.