dolibarr  9.0.0
cibles.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2005-2016 Laurent Destailleur <eldy@uers.sourceforge.net>
4  * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
5  * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
27 require '../../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
29 require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmailing.class.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/emailing.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
34 
35 // Load translation files required by the page
36 $langs->load("mails");
37 
38 // Security check
39 if (! $user->rights->mailing->lire || $user->societe_id > 0) accessforbidden();
40 
41 
42 // Load variable for pagination
43 $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
44 $sortfield = GETPOST('sortfield','alpha');
45 $sortorder = GETPOST('sortorder','alpha');
46 $page = GETPOST('page','int');
47 if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
48 $offset = $limit * $page;
49 $pageprev = $page - 1;
50 $pagenext = $page + 1;
51 if (! $sortfield) $sortfield="email";
52 if (! $sortorder) $sortorder="ASC";
53 
54 $id=GETPOST('id','int');
55 $rowid=GETPOST('rowid','int');
56 $action=GETPOST('action','aZ09');
57 $search_lastname=GETPOST("search_lastname");
58 $search_firstname=GETPOST("search_firstname");
59 $search_email=GETPOST("search_email");
60 $search_other=GETPOST("search_other");
61 $search_dest_status=GETPOST('search_dest_status');
62 
63 // Search modules dirs
64 $modulesdir = dolGetModulesDirs('/mailings');
65 
66 $object = new Mailing($db);
67 
68 
69 /*
70  * Actions
71  */
72 
73 if ($action == 'add')
74 {
75  $module=GETPOST("module");
76  $result=-1;
77 
78  foreach ($modulesdir as $dir)
79  {
80  // Load modules attributes in arrays (name, numero, orders) from dir directory
81  //print $dir."\n<br>";
82  dol_syslog("Scan directory ".$dir." for modules");
83 
84  // Loading Class
85  $file = $dir."/".$module.".modules.php";
86  $classname = "mailing_".$module;
87 
88  if (file_exists($file))
89  {
90  require_once $file;
91 
92  // We fill $filtersarray. Using this variable is now deprecated. Kept for backward compatibility.
93  $filtersarray=array();
94  if (isset($_POST["filter"])) $filtersarray[0]=$_POST["filter"];
95 
96  // Add targets into database
97  $obj = new $classname($db);
98  dol_syslog("Call add_to_target on class ".$classname);
99  $result=$obj->add_to_target($id,$filtersarray);
100  }
101  }
102  if ($result > 0)
103  {
104  setEventMessages($langs->trans("XTargetsAdded",$result), null, 'mesgs');
105 
106  header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
107  exit;
108  }
109  if ($result == 0)
110  {
111  setEventMessages($langs->trans("WarningNoEMailsAdded"), null, 'warnings');
112  }
113  if ($result < 0)
114  {
115  setEventMessages($langs->trans("Error").($obj->error?' '.$obj->error:''), null, 'errors');
116  }
117 }
118 
119 if (GETPOST('clearlist'))
120 {
121  // Loading Class
122  $obj = new MailingTargets($db);
123  $obj->clear_target($id);
124  /* Avoid this to allow reposition
125  header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
126  exit;
127  */
128 }
129 
130 if ($action == 'delete')
131 {
132  // Ici, rowid indique le destinataire et id le mailing
133  $sql="DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE rowid=".$rowid;
134  $resql=$db->query($sql);
135  if ($resql)
136  {
137  if (!empty($id))
138  {
139  $obj = new MailingTargets($db);
140  $obj->update_nb($id);
141 
142  header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
143  exit;
144  }
145  else
146  {
147  header("Location: list.php");
148  exit;
149  }
150  }
151  else
152  {
153  dol_print_error($db);
154  }
155 }
156 
157 // Purge search criteria
158 if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
159 {
160  $search_lastname='';
161  $search_firstname='';
162  $search_email='';
163  $search_other='';
164  $search_dest_status='';
165 }
166 
167 
168 
169 /*
170  * View
171  */
172 
173 llxHeader('',$langs->trans("Mailing"),'EN:Module_EMailing|FR:Module_Mailing|ES:M&oacute;dulo_Mailing');
174 
175 $form = new Form($db);
176 $formmailing = new FormMailing($db);
177 
178 if ($object->fetch($id) >= 0)
179 {
180  $head = emailing_prepare_head($object);
181 
182  dol_fiche_head($head, 'targets', $langs->trans("Mailing"), -1, 'email');
183 
184  $linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';
185 
186  $morehtmlright='';
187  $nbtry = $nbok = 0;
188  if ($object->statut == 2 || $object->statut == 3)
189  {
190  $nbtry = $object->countNbOfTargets('alreadysent');
191  $nbko = $object->countNbOfTargets('alreadysentko');
192 
193  $morehtmlright.=' ('.$nbtry.'/'.$object->nbemail;
194  if ($nbko) $morehtmlright.=' - '.$nbko.' '.$langs->trans("Error");
195  $morehtmlright.=') &nbsp; ';
196  }
197 
198  dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
199 
200  print '<div class="fichecenter">';
201  print '<div class="underbanner clearboth"></div>';
202 
203  print '<table class="border" width="100%">';
204 
205  print '<tr><td class="titlefield">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->titre.'</td></tr>';
206 
207  print '<tr><td>'.$langs->trans("MailFrom").'</td><td colspan="3">'.dol_print_email($object->email_from,0,0,0,0,1).'</td></tr>';
208 
209  // Errors to
210  print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td colspan="3">'.dol_print_email($object->email_errorsto,0,0,0,0,1);
211  print '</td></tr>';
212 
213  // Nb of distinct emails
214  print '<tr><td>';
215  print $langs->trans("TotalNbOfDistinctRecipients");
216  print '</td><td colspan="3">';
217  $nbemail = ($object->nbemail?$object->nbemail:0);
218  if (is_numeric($nbemail))
219  {
220  $text='';
221  if ((! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || ($object->statut == 2 && $nbtry < $nbemail)))
222  {
223  if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0)
224  {
225  $text.=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
226  }
227  else
228  {
229  $text.=$langs->trans('SendingFromWebInterfaceIsNotAllowed');
230  }
231  }
232  if (empty($nbemail)) $nbemail.=' '.img_warning('').' <font class="warning">'.$langs->trans("NoTargetYet").'</font>';
233  if ($text)
234  {
235  print $form->textwithpicto($nbemail,$text,1,'warning');
236  }
237  else
238  {
239  print $nbemail;
240  }
241  }
242  print '</td></tr>';
243 
244  print '</table>';
245 
246  print "</div>";
247 
248  dol_fiche_end();
249 
250  print '<br>';
251 
252 
253  $allowaddtarget=($object->statut == 0);
254 
255  // Show email selectors
256  if ($allowaddtarget && $user->rights->mailing->creer)
257  {
258  print load_fiche_titre($langs->trans("ToAddRecipientsChooseHere"), ($user->admin?info_admin($langs->trans("YouCanAddYourOwnPredefindedListHere"),1):''), 'title_generic');
259 
260  //print '<table class="noborder" width="100%">';
261  print '<div class="tagtable centpercent liste_titre_bydiv borderbottom" id="tablelines">';
262 
263  //print '<tr class="liste_titre">';
264  print '<div class="tagtr liste_titre">';
265  //print '<td class="liste_titre">'.$langs->trans("RecipientSelectionModules").'</td>';
266  print '<div class="tagtd">'.$langs->trans("RecipientSelectionModules").'</div>';
267  //print '<td class="liste_titre" align="center">'.$langs->trans("NbOfUniqueEMails").'</td>';
268  print '<div class="tagtd" align="center">'.$langs->trans("NbOfUniqueEMails").'</div>';
269  //print '<td class="liste_titre" align="left">'.$langs->trans("Filter").'</td>';
270  print '<div class="tagtd" align="left">'.$langs->trans("Filter").'</div>';
271  //print '<td class="liste_titre" align="center">&nbsp;</td>';
272  print '<div class="tagtd">&nbsp;</div>';
273  //print "</tr>\n";
274  print '</div>';
275 
276  clearstatcache();
277 
278  foreach ($modulesdir as $dir)
279  {
280  $modulenames=array();
281 
282  // Load modules attributes in arrays (name, numero, orders) from dir directory
283  //print $dir."\n<br>";
284  dol_syslog("Scan directory ".$dir." for modules");
285  $handle=@opendir($dir);
286  if (is_resource($handle))
287  {
288  while (($file = readdir($handle))!==false)
289  {
290  if (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
291  {
292  if (preg_match("/(.*)\.modules\.php$/i",$file,$reg))
293  {
294  if ($reg[1] == 'example') continue;
295  $modulenames[]=$reg[1];
296  }
297  }
298  }
299  closedir($handle);
300  }
301 
302  // Sort $modulenames
303  sort($modulenames);
304 
305  $var = true;
306 
307  // Loop on each submodule
308  foreach($modulenames as $modulename)
309  {
310  // Loading Class
311  $file = $dir.$modulename.".modules.php";
312  $classname = "mailing_".$modulename;
313  require_once $file;
314 
315  $obj = new $classname($db);
316 
317  // Check dependencies
318  $qualified=(isset($obj->enabled)?$obj->enabled:1);
319  foreach ($obj->require_module as $key)
320  {
321  if (! $conf->$key->enabled || (! $user->admin && $obj->require_admin))
322  {
323  $qualified=0;
324  //print "Les prerequis d'activation du module mailing ne sont pas respectes. Il ne sera pas actif";
325  break;
326  }
327  }
328 
329  // Si le module mailing est qualifie
330  if ($qualified)
331  {
332  $var = ! $var;
333 
334  if ($allowaddtarget)
335  {
336  print '<form '.$bctag[$var].' name="'.$modulename.'" action="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'&module='.$modulename.'" method="POST" enctype="multipart/form-data">';
337  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
338  }
339  else
340  {
341  print '<div '.$bctag[$var].'>';
342  }
343 
344  print '<div class="tagtd">';
345  if (empty($obj->picto)) $obj->picto='generic';
346  print img_object($langs->trans("EmailingTargetSelector").': '.get_class($obj),$obj->picto);
347  print ' ';
348  print $obj->getDesc();
349  print '</div>';
350 
351  try {
352  $nbofrecipient=$obj->getNbOfRecipients('');
353  }
354  catch(Exception $e)
355  {
356  dol_syslog($e->getMessage(), LOG_ERR);
357  }
358 
359  print '<div class="tagtd center">';
360  if ($nbofrecipient >= 0)
361  {
362  print $nbofrecipient;
363  }
364  else
365  {
366  print $langs->trans("Error").' '.img_error($obj->error);
367  }
368  print '</div>';
369 
370  print '<div class="tagtd" align="left">';
371  if ($allowaddtarget)
372  {
373  try {
374  $filter=$obj->formFilter();
375  }
376  catch(Exception $e)
377  {
378  dol_syslog($e->getMessage(), LOG_ERR);
379  }
380  if ($filter) print $filter;
381  else print $langs->trans("None");
382  }
383  print '</div>';
384 
385  print '<div class="tagtd" align="right">';
386  if ($allowaddtarget)
387  {
388  print '<input type="submit" class="button" name="button_'.$modulename.'" value="'.$langs->trans("Add").'">';
389  }
390  else
391  {
392  print '<input type="submit" class="button disabled" disabled="disabled" name="button_'.$modulename.'" value="'.$langs->trans("Add").'">';
393  //print $langs->trans("MailNoChangePossible");
394  print "&nbsp;";
395  }
396  print '</div>';
397 
398  if ($allowaddtarget) print '</form>';
399  else print '</div>';
400  }
401  }
402  } // End foreach dir
403 
404  print '</div>';
405 
406  print '<br><br>';
407  }
408 
409  // List of selected targets
410  $sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.source_url, mc.source_id, mc.source_type, mc.error_text";
411  $sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
412  $sql .= " WHERE mc.fk_mailing=".$object->id;
413  if ($search_lastname) $sql.= natural_search("mc.lastname", $search_lastname);
414  if ($search_firstname) $sql.= natural_search("mc.firstname", $search_firstname);
415  if ($search_email) $sql.= natural_search("mc.email", $search_email);
416  if ($search_other) $sql.= natural_search("mc.other", $search_other);
417  if ($search_dest_status != '' && $search_dest_status >= -1) $sql.= " AND mc.statut=".$db->escape($search_dest_status)." ";
418  $sql .= $db->order($sortfield,$sortorder);
419 
420  // Count total nb of records
421  $nbtotalofrecords = '';
422  if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
423  {
424  $result = $db->query($sql);
425  $nbtotalofrecords = $db->num_rows($result);
426  if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
427  {
428  $page = 0;
429  $offset = 0;
430  }
431  }
432 
433  //$nbtotalofrecords=$object->nbemail; // nbemail is a denormalized field storing nb of targets
434  $sql .= $db->plimit($limit+1, $offset);
435 
436  $resql=$db->query($sql);
437  if ($resql)
438  {
439 
440  $num = $db->num_rows($resql);
441 
442  $param = "&amp;id=".$object->id;
443  //if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
444  if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
445  if ($search_lastname) $param.= "&amp;search_lastname=".urlencode($search_lastname);
446  if ($search_firstname) $param.= "&amp;search_firstname=".urlencode($search_firstname);
447  if ($search_email) $param.= "&amp;search_email=".urlencode($search_email);
448  if ($search_other) $param.= "&amp;search_other=".urlencode($search_other);
449 
450  print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
451  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
452  print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
453  print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
454  print '<input type="hidden" name="page" value="'.$page.'">';
455  print '<input type="hidden" name="id" value="'.$object->id.'">';
456 
457  $cleartext='';
458  if ($allowaddtarget) {
459  $cleartext=$langs->trans("ToClearAllRecipientsClickHere").' '.'<a href="'.$_SERVER["PHP_SELF"].'?clearlist=1&id='.$object->id.'" class="button reposition">'.$langs->trans("TargetsReset").'</a>';
460  }
461  print_barre_liste($langs->trans("MailSelectedRecipients"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$cleartext,$num,$nbtotalofrecords,'title_generic',0,'','', $limit);
462 
463  print '</form>';
464 
465  print "\n<!-- Liste destinataires selectionnes -->\n";
466  print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
467  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
468  print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
469  print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
470  print '<input type="hidden" name="page" value="'.$page.'">';
471  print '<input type="hidden" name="id" value="'.$object->id.'">';
472  print '<input type="hidden" name="limit" value="'.$limit.'">';
473 
474 
475  if ($page) $param.= "&amp;page=".$page;
476 
477  print '<div class="div-table-responsive">';
478  print '<table class="noborder" width="100%">';
479 
480  // Ligne des champs de filtres
481  print '<tr class="liste_titre_filter">';
482  // EMail
483  print '<td class="liste_titre">';
484  print '<input class="flat maxwidth100" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'">';
485  print '</td>';
486  // Name
487  print '<td class="liste_titre">';
488  print '<input class="flat maxwidth100" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'">';
489  print '</td>';
490  // Firstname
491  print '<td class="liste_titre">';
492  print '<input class="flat maxwidth100" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'">';
493  print '</td>';
494  // Other
495  print '<td class="liste_titre">';
496  print '<input class="flat maxwidth100" type="text" name="search_other" value="'.dol_escape_htmltag($search_other).'">';
497  print '</td>';
498  // Source
499  print '<td class="liste_titre">';
500  print '&nbsp';
501  print '</td>';
502 
503  // Date sending
504  print '<td class="liste_titre">';
505  print '&nbsp';
506  print '</td>';
507  //Statut
508  print '<td class="liste_titre" align="right">';
509  print $formmailing->selectDestinariesStatus($search_dest_status,'search_dest_status',1);
510  print '</td>';
511  // Action column
512  print '<td class="liste_titre" align="right">';
513  $searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
514  print $searchpicto;
515  print '</td>';
516  print '</tr>';
517 
518  print '<tr class="liste_titre">';
519  print_liste_field_titre("EMail",$_SERVER["PHP_SELF"],"mc.email",$param,"","",$sortfield,$sortorder);
520  print_liste_field_titre("Lastname",$_SERVER["PHP_SELF"],"mc.lastname",$param,"","",$sortfield,$sortorder);
521  print_liste_field_titre("Firstname",$_SERVER["PHP_SELF"],"mc.firstname",$param,"","",$sortfield,$sortorder);
522  print_liste_field_titre("OtherInformations",$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
523  print_liste_field_titre("Source",$_SERVER["PHP_SELF"],"",$param,"",'align="center"',$sortfield,$sortorder);
524  // Date sending
525  if ($object->statut < 2)
526  {
528  }
529  else
530  {
531  print_liste_field_titre("DateSending",$_SERVER["PHP_SELF"],"mc.date_envoi",$param,'','align="center"',$sortfield,$sortorder);
532  }
533  print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder);
534  print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
535  print '</tr>';
536 
537  $i = 0;
538 
539  if ($num)
540  {
541  while ($i < min($num,$limit))
542  {
543  $obj = $db->fetch_object($resql);
544 
545  print '<tr class="oddeven">';
546  print '<td>'.$obj->email.'</td>';
547  print '<td>'.$obj->lastname.'</td>';
548  print '<td>'.$obj->firstname.'</td>';
549  print '<td>'.$obj->other.'</td>';
550  print '<td align="center">';
551  if (empty($obj->source_id) || empty($obj->source_type))
552  {
553  print empty($obj->source_url)?'':$obj->source_url; // For backward compatibility
554  }
555  else
556  {
557  if ($obj->source_type == 'member')
558  {
559  include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
560  $objectstatic=new Adherent($db);
561  $objectstatic->fetch($obj->source_id);
562  print $objectstatic->getNomUrl(1);
563  }
564  else if ($obj->source_type == 'user')
565  {
566  include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
567  $objectstatic=new User($db);
568  $objectstatic->fetch($obj->source_id);
569  $objectstatic->id=$obj->source_id;
570  print $objectstatic->getNomUrl(1);
571  }
572  else if ($obj->source_type == 'thirdparty')
573  {
574  include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
575  $objectstatic=new Societe($db);
576  $objectstatic->fetch($obj->source_id);
577  print $objectstatic->getNomUrl(1);
578  }
579  else if ($obj->source_type == 'contact')
580  {
581  include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
582  $objectstatic=new Contact($db);
583  $objectstatic->fetch($obj->source_id);
584  print $objectstatic->getNomUrl(1);
585  }
586  else
587  {
588  print $obj->source_url;
589  }
590  }
591  print '</td>';
592 
593  // Status of recipient sending email (Warning != status of emailing)
594  if ($obj->statut == 0)
595  {
596  print '<td align="center">&nbsp;</td>';
597  print '<td align="right" class="nowrap">'.$langs->trans("MailingStatusNotSent");
598  print '</td>';
599  }
600  else
601  {
602  print '<td align="center">'.$obj->date_envoi.'</td>';
603  print '<td align="right" class="nowrap">';
604  print $object::libStatutDest($obj->statut, 2, $obj->error_text);
605  print '</td>';
606  }
607 
608  // Search Icon
609  print '<td align="right">';
610  if ($obj->statut == 0) // Not sent yet
611  {
612  if ($user->rights->mailing->creer && $allowaddtarget) {
613  print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$obj->rowid.$param.'">'.img_delete($langs->trans("RemoveRecipient")).'</a>';
614  }
615  }
616  /*if ($obj->statut == -1) // Sent with error
617  {
618  print '<a href="'.$_SERVER['PHP_SELF'].'?action=retry&rowid='.$obj->rowid.$param.'">'.$langs->trans("Retry").'</a>';
619  }*/
620  print '</td>';
621  print '</tr>';
622 
623  $i++;
624  }
625  }
626  else
627  {
628  if ($object->statut < 2)
629  {
630  print '<tr><td colspan="8" class="opacitymedium">';
631  print $langs->trans("NoTargetYet");
632  print '</td></tr>';
633  }
634  }
635  print "</table><br>";
636  print '</div>';
637 
638  print '</form>';
639 
640  $db->free($resql);
641  }
642  else
643  {
644  dol_print_error($db);
645  }
646 
647  print "\n<!-- Fin liste destinataires selectionnes -->\n";
648 }
649 
650 // End of page
651 llxFooter();
652 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:56
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
img_error($titlealt='default')
Show error logo.
print
Draft customers invoices.
Definition: index.php:91
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
if(! empty($conf->facture->enabled) && $user->rights->facture->lire) if(! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) if(! empty($conf->don->enabled) && $user->rights->societe->lire) if(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) if(! empty($conf->facture->enabled) &&! empty($conf->commande->enabled) && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(! empty($conf->facture->enabled) && $user->rights->facture->lire) if(! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1053
Class to manage contact/addresses.
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.
Class to manage Dolibarr users.
Definition: user.class.php:41
dolGetModulesDirs($subdir='')
Return list of modules directories.
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
Class to offer components to list and upload files.
img_delete($titlealt='default', $other='class="pictodelete"')
Show delete logo.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Class to manage generation of HTML components Only common components must be here.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='title_generic.png', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0)
Print a title with navigation controls for pagination.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='')
Write log message into outputs.
Class to manage third parties objects (customers, suppliers, prospects...)
emailing_prepare_head(Mailing $object)
Prepare array with list of tabs.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='')
Show information for admin users or standard users.
dol_fiche_end($notab=0)
Show tab footer of a card.
Class to manage members of a foundation.
llxHeader()
Empty header.
Definition: wrapper.php:44
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...
Class to manage emailings module.
dol_print_email($email, $cid=0, $socid=0, $addlink=0, $max=64, $showinvalid=1, $withpicto=0)
Show EMail link.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="")
Show title line of an array.
dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='')
Show tab header of a card.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
Parent class of emailing target selectors modules.