dolibarr  21.0.0-alpha
list.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2005-2023 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
4  * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <https://www.gnu.org/licenses/>.
18  */
19 
26 // Load Dolibarr environment
27 require '../../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php';
29 
30 // Load translation files required by the page
31 $langs->load('mails');
32 
33 // Get Parameters
34 $action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ...
35 $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
36 $show_files = GETPOSTINT('show_files'); // Show files area generated by bulk actions ?
37 $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
38 $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
39 $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
40 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
41 $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
42 $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
43 $mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
44 
45 // Load variable for pagination
46 $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
47 $sortfield = GETPOST('sortfield', 'aZ09comma');
48 $sortorder = GETPOST('sortorder', 'aZ09comma');
49 $page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
50 if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
51  // If $page is not defined, or '' or -1 or if we click on clear filters
52  $page = 0;
53 }
54 $offset = $limit * $page;
55 $pageprev = $page - 1;
56 $pagenext = $page + 1;
57 
58 // Search Fields
59 $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
60 $search_ref = GETPOST("search_ref", "alpha") ? GETPOST("search_ref", "alpha") : GETPOST("sref", "alpha");
61 $search_messtype = GETPOST("search_messtype", "alpha");
62 $filteremail = GETPOST('filteremail', 'alpha');
63 
64 // Initialize a technical objects
65 $object = new Mailing($db);
66 $extrafields = new ExtraFields($db);
67 $hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes
68 
69 // Fetch optionals attributes and labels
70 $extrafields->fetch_name_optionals_label($object->table_element);
71 
72 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
73 
74 // Default sort order (if not yet defined by previous GETPOST)
75 if (!$sortorder) {
76  $sortorder = "DESC";
77 }
78 if (!$sortfield) {
79  $sortfield = "m.date_creat";
80 }
81 
82 // List of fields to search into when doing a "search in all"
83 $fieldstosearchall = array(
84  'm.titre' => 'Ref',
85 );
86 
87 $permissiontoread = $user->hasRight('mailing', 'lire');
88 $permissiontoadd = $user->hasRight('mailing', 'creer');
89 $permissiontodelete = $user->hasRight('mailing', 'delete');
90 
91 // Security check
92 if (!$user->hasRight('mailing', 'lire') || (!getDolGlobalString('EXTERNAL_USERS_ARE_AUTHORIZED') && $user->socid > 0)) {
94 }
95 //$result = restrictedArea($user, 'mailing');
96 
97 
98 /*
99  * Actions
100  */
101 
102 if (GETPOST('cancel', 'alpha')) {
103  $action = 'list';
104  $massaction = '';
105 }
106 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
107  $massaction = '';
108 }
109 
110 $parameters = array();
111 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
112 if ($reshook < 0) {
113  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
114 }
115 
116 if (empty($reshook)) {
117  // Selection of new fields
118  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
119 
120  // Purge search criteria
121  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
122  /*foreach($object->fields as $key => $val)
123  {
124  $search[$key]='';
125  }*/
126  $search_ref = '';
127  $search_messtype = '';
128  $search_all = '';
129  $toselect = array();
130  $search_array_options = array();
131  }
132  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
133  || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
134  $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
135  }
136 
137  // Mass actions
138  $objectclass = 'Mailing';
139  $objectlabel = 'Mailing';
140  $uploaddir = $conf->mailing->dir_output;
141  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
142 }
143 
144 
145 /*
146  * View
147  */
148 
149 $form = new Form($db);
150 
151 $now = dol_now();
152 
153 $help_url = 'EN:Module_EMailing|FR:Module_Mailing|ES:M&oacute;dulo_Mailing';
154 $title = $langs->trans("Mailing");
155 $morejs = array();
156 $morecss = array();
157 
158 // Build and execute select
159 // --------------------------------------------------------------------
160 if ($filteremail) {
161  $sql = "SELECT m.rowid, m.messtype, m.titre as title, m.nbemail, m.statut as status, m.date_creat as datec, m.date_envoi as date_envoi,";
162  $sql .= " mc.statut as sendstatut";
163 
164  $sqlfields = $sql; // $sql fields to remove for count total
165 
166  $sql .= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc";
167  $sql .= " WHERE m.rowid = mc.fk_mailing AND m.entity = ".$conf->entity;
168  $sql .= " AND mc.email = '".$db->escape($filteremail)."'";
169  if ($search_ref) {
170  $sql .= " AND m.rowid = '".$db->escape($search_ref)."'";
171  }
172  if ($search_messtype) {
173  $sql .= " AND m.messtype LIKE '".$db->escape($search_messtype)."'";
174  }
175  if ($search_all) {
176  $sql .= " AND (m.titre LIKE '%".$db->escape($search_all)."%' OR m.sujet LIKE '%".$db->escape($search_all)."%' OR m.body LIKE '%".$db->escape($search_all)."%')";
177  }
178  if (!$sortorder) {
179  $sortorder = "ASC";
180  }
181  if (!$sortfield) {
182  $sortfield = "m.rowid";
183  }
184 } else {
185  $sql = "SELECT m.rowid, m.messtype, m.titre as title, m.nbemail, m.statut as status, m.date_creat as datec, m.date_envoi as date_envoi";
186 
187  $sqlfields = $sql; // $sql fields to remove for count total
188 
189  $sql .= " FROM ".MAIN_DB_PREFIX."mailing as m";
190  $sql .= " WHERE m.entity = ".((int) $conf->entity);
191  if ($search_ref) {
192  $sql .= " AND m.rowid = '".$db->escape($search_ref)."'";
193  }
194  if ($search_messtype) {
195  $sql .= " AND m.messtype LIKE '".$db->escape($search_messtype)."'";
196  }
197  if ($search_all) {
198  $sql .= " AND (m.titre LIKE '%".$db->escape($search_all)."%' OR m.sujet LIKE '%".$db->escape($search_all)."%' OR m.body LIKE '%".$db->escape($search_all)."%')";
199  }
200  if (!$sortorder) {
201  $sortorder = "ASC";
202  }
203  if (!$sortfield) {
204  $sortfield = "m.rowid";
205  }
206 }
207 if ($search_all) {
208  $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
209 }
210 //$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
211 // Add where from extra fields
212 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
213 // Add where from hooks
214 $parameters = array();
215 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
216 $sql .= $hookmanager->resPrint;
217 
218 // Count total nb of records
219 $nbtotalofrecords = '';
220 if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
221  /* The fast and low memory method to get and count full list converts the sql into a sql count */
222  $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
223  $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
224  $resql = $db->query($sqlforcount);
225  if ($resql) {
226  $objforcount = $db->fetch_object($resql);
227  $nbtotalofrecords = $objforcount->nbtotalofrecords;
228  } else {
229  dol_print_error($db);
230  }
231 
232  if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
233  $page = 0;
234  $offset = 0;
235  }
236  $db->free($resql);
237 }
238 
239 // Complete request and execute it with limit
240 $sql .= $db->order($sortfield, $sortorder);
241 if ($limit) {
242  $sql .= $db->plimit($limit + 1, $offset);
243 }
244 
245 $resql = $db->query($sql);
246 if (!$resql) {
247  dol_print_error($db);
248  exit;
249 }
250 
251 $num = $db->num_rows($resql);
252 
253 
254 // Direct jump if only one record found
255 if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
256  $obj = $db->fetch_object($resql);
257  $id = $obj->rowid;
258  header("Location: ".dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.$id);
259  exit;
260 }
261 
262 
263 // Output page
264 // --------------------------------------------------------------------
265 
266 $title = $langs->trans("EMailings");
267 if ($filteremail) {
268  $title .= ' ('.$langs->trans("SentTo", $filteremail).')';
269 }
270 
271 llxHeader('', $title, $help_url);
272 
273 $arrayofselected = is_array($toselect) ? $toselect : array();
274 
275 $param = "&search_all=".urlencode($search_all);
276 if (!empty($mode)) {
277  $param .= '&mode='.urlencode($mode);
278 }
279 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
280  $param .= '&contextpage='.urlencode($contextpage);
281 }
282 if ($limit > 0 && $limit != $conf->liste_limit) {
283  $param .= '&limit='.((int) $limit);
284 }
285 if ($optioncss != '') {
286  $param .= '&optioncss='.urlencode($optioncss);
287 }
288 if ($search_ref != '') {
289  $param .= '&search_ref='.urlencode($search_ref);
290 }
291 if ($search_messtype != '') {
292  $param .= '&search_type='.urlencode($search_messtype);
293 }
294 if ($optioncss != '') {
295  $param .= '&optioncss='.urlencode($optioncss);
296 }
297 
298 if ($filteremail) {
299  $param .= '&filteremail='.urlencode($filteremail);
300 }
301 // Add $param from extra fields
302 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
303 // Add $param from hooks
304 $parameters = array('param' => &$param);
305 $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
306 $param .= $hookmanager->resPrint;
307 
308 // List of mass actions available
309 $arrayofmassactions = array(
310  //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
311  //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
312  //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
313  //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
314 );
315 if (!empty($permissiontodelete)) {
316  $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
317 }
318 if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) {
319  $arrayofmassactions = array();
320 }
321 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
322 
323 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
324 if ($optioncss != '') {
325  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
326 }
327 print '<input type="hidden" name="token" value="'.newToken().'">';
328 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
329 print '<input type="hidden" name="action" value="list">';
330 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
331 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
332 print '<input type="hidden" name="page" value="'.$page.'">';
333 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
334 print '<input type="hidden" name="page_y" value="">';
335 print '<input type="hidden" name="mode" value="'.$mode.'">';
336 
337 $newcardbutton = '';
338 if ($user->hasRight('mailing', 'creer')) {
339  $newcardbutton .= dolGetButtonTitle($langs->trans('NewMailing'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/mailing/card.php?action=create');
340 }
341 
342 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_email', 0, $newcardbutton, '', $limit, 0, 0, 1);
343 
344 // Add code for pre mass action (confirmation or email presend form)
345 $topicmail = "SendMailingRef";
346 $modelmail = "mailing";
347 $objecttmp = new Mailing($db);
348 $trackid = 'mailing'.$object->id;
349 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
350 
351 if ($search_all) {
352  $setupstring = '';
353  foreach ($fieldstosearchall as $key => $val) {
354  $fieldstosearchall[$key] = $langs->trans($val);
355  $setupstring .= $key."=".$val.";";
356  }
357  print '<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
358  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>'."\n";
359 }
360 
361 $moreforfilter = '';
362 
363 $parameters = array();
364 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
365 if (empty($reshook)) {
366  $moreforfilter .= $hookmanager->resPrint;
367 } else {
368  $moreforfilter = $hookmanager->resPrint;
369 }
370 
371 if (!empty($moreforfilter)) {
372  print '<div class="liste_titre liste_titre_bydiv centpercent">';
373  print $moreforfilter;
374  $parameters = array('type' => $type);
375  $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
376  print $hookmanager->resPrint;
377  print '</div>';
378 }
379 
380 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
381 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields
382 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
383 
384 print '<div class="div-table-responsive">';
385 print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
386 
387 // Fields title search
388 // --------------------------------------------------------------------
389 print '<tr class="liste_titre_filter">';
390 // Action column
391 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
392  print '<td class="liste_titre maxwidthsearch center">';
393  $searchpicto = $form->showFilterButtons('left');
394  print $searchpicto;
395  print '</td>';
396 }
397 print '<td class="liste_titre">';
398 print '<input type="text" class="flat maxwidth50" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
399 print '</td>';
400 // Message type
401 if (getDolGlobalInt('EMAILINGS_SUPPORT_ALSO_SMS')) {
402  print '<td class="liste_titre">';
403  print '<input type="text" class="flat maxwidth50" name="search_messtype" value="'.dol_escape_htmltag($search_messtype).'">';
404  print '</td>';
405 }
406 // Title
407 print '<td class="liste_titre">';
408 print '<input type="text" class="flat maxwidth100 maxwidth50onsmartphone" name="search_all" value="'.dol_escape_htmltag($search_all).'">';
409 print '</td>';
410 print '<td class="liste_titre">&nbsp;</td>';
411 if (!$filteremail) {
412  print '<td class="liste_titre">&nbsp;</td>';
413 }
414 print '<td class="liste_titre">&nbsp;</td>';
415 print '<td class="liste_titre">&nbsp;</td>';
416 // Extra fields
417 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
418 // Fields from hook
419 $parameters = array('arrayfields' => $arrayfields);
420 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
421 print $hookmanager->resPrint;
422 // Action column
423 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
424  print '<td class="liste_titre center maxwidthsearch">';
425  $searchpicto = $form->showFilterButtons();
426  print $searchpicto;
427  print '</td>';
428 }
429 print '</tr>'."\n";
430 
431 $totalarray = array();
432 $totalarray['nbfield'] = 0;
433 
434 // Fields title label
435 // --------------------------------------------------------------------
436 print '<tr class="liste_titre">';
437 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
438  print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
439  $totalarray['nbfield']++;
440 }
441 print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "m.rowid", $param, "", "", $sortfield, $sortorder);
442 $totalarray['nbfield']++;
443 // Message type
444 if (getDolGlobalInt('EMAILINGS_SUPPORT_ALSO_SMS')) {
445  print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "m.messtype", $param, "", "", $sortfield, $sortorder);
446  $totalarray['nbfield']++;
447 }
448 print_liste_field_titre("Title", $_SERVER["PHP_SELF"], "m.titre", $param, "", "", $sortfield, $sortorder);
449 $totalarray['nbfield']++;
450 print_liste_field_titre("DateCreation", $_SERVER["PHP_SELF"], "m.date_creat", $param, "", '', $sortfield, $sortorder, 'center ');
451 $totalarray['nbfield']++;
452 if (!$filteremail) {
453  $title = $langs->trans("NbOfEMails");
454  if (getDolGlobalInt('EMAILINGS_SUPPORT_ALSO_SMS')) {
455  $title .= ' | '.$langs->trans("SMS");
456  }
457  print_liste_field_titre($title, $_SERVER["PHP_SELF"], "m.nbemail", $param, "", '', $sortfield, $sortorder, 'center ');
458  $totalarray['nbfield']++;
459 }
460 if (!$filteremail) {
461  print_liste_field_titre("DateLastSend", $_SERVER["PHP_SELF"], "m.date_envoi", $param, "", '', $sortfield, $sortorder, 'center ');
462  $totalarray['nbfield']++;
463 } else {
464  print_liste_field_titre("DateSending", $_SERVER["PHP_SELF"], "mc.date_envoi", $param, "", '', $sortfield, $sortorder, 'center ');
465  $totalarray['nbfield']++;
466 }
467 // Extra fields
468 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
469 // Hook fields
470 $parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
471 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
472 print $hookmanager->resPrint;
473 print_liste_field_titre("Status", $_SERVER["PHP_SELF"], ($filteremail ? "mc.statut" : "m.statut"), $param, "", '', $sortfield, $sortorder, 'center ');
474 $totalarray['nbfield']++;
475 // Action column
476 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
477  print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
478  $totalarray['nbfield']++;
479 }
480 print '</tr>'."\n";
481 
482 $totalarray = array();
483 $totalarray['nbfield'] = 0;
484 
485 
486 // Loop on record
487 // --------------------------------------------------------------------
488 $i = 0;
489 $savnbfield = $totalarray['nbfield'];
490 $totalarray = array();
491 $totalarray['nbfield'] = 0;
492 $imaxinloop = ($limit ? min($num, $limit) : $num);
493 while ($i < $imaxinloop) {
494  $obj = $db->fetch_object($resql);
495  if (empty($obj)) {
496  break; // Should not happen
497  }
498 
499  $object->id = $obj->rowid;
500  $object->ref = $obj->rowid;
501 
502  // Show here line of result
503  $j = 0;
504  print '<tr data-rowid="'.$object->id.'" class="oddeven">';
505  // Action column
506  if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
507  print '<td class="nowrap center">';
508  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
509  $selected = 0;
510  if (in_array($object->id, $arrayofselected)) {
511  $selected = 1;
512  }
513  print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
514  }
515  print '</td>';
516  if (!$i) {
517  $totalarray['nbfield']++;
518  }
519  }
520 
521  // Ref
522  print '<td>';
523  print $object->getNomUrl(1);
524  print '</td>';
525 
526  // Message type
527  if (getDolGlobalInt('EMAILINGS_SUPPORT_ALSO_SMS')) {
528  print '<td>';
529  print dol_escape_htmltag($obj->messtype);
530  print '</td>';
531  }
532 
533  // Title
534  print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->title).'">'.dol_escape_htmltag($obj->title).'</td>';
535 
536  // Date creation
537  print '<td class="center">';
538  print dol_print_date($db->jdate($obj->datec), 'day');
539  print '</td>';
540 
541  // Nb of email
542  if (!$filteremail) {
543  print '<td class="center nowraponall">';
544  $nbemail = $obj->nbemail;
545  /*if ($obj->status != 3 && !empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail)
546  {
547  $text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
548  print $form->textwithpicto($nbemail,$text,1,'warning');
549  }
550  else
551  {
552  print $nbemail;
553  }*/
554  print $nbemail;
555  print '</td>';
556  }
557 
558  // Last send
559  print '<td class="nowrap center">'.dol_print_date($db->jdate($obj->date_envoi), 'day').'</td>';
560  print '</td>';
561 
562  // Status
563  print '<td class="nowrap center">';
564  if ($filteremail) {
565  print $object::libStatutDest($obj->sendstatut, 2);
566  } else {
567  print $object->LibStatut($obj->status, 5);
568  }
569  print '</td>';
570 
571  // Action column
572  if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
573  print '<td class="nowrap center">';
574  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
575  $selected = 0;
576  if (in_array($object->id, $arrayofselected)) {
577  $selected = 1;
578  }
579  print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
580  }
581  print '</td>';
582  if (!$i) {
583  $totalarray['nbfield']++;
584  }
585  }
586 
587  print '</tr>'."\n";
588 
589  $i++;
590 }
591 
592 // Show total line
593 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
594 
595 // If no record found
596 if (empty($num)) {
597  $colspan = 6;
598  if (!$filteremail) {
599  $colspan++;
600  }
601  print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
602 }
603 
604 
605 $db->free($resql);
606 
607 $parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
608 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
609 print $hookmanager->resPrint;
610 
611 print '</table>'."\n";
612 print '</div>'."\n";
613 
614 print '</form>'."\n";
615 
616 // End of page
617 llxFooter();
618 $db->close();
if($user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition: card.php:58
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:55
llxFooter()
Empty footer.
Definition: wrapper.php:69
Class to manage standard extra fields.
Class to manage generation of HTML components Only common components must be here.
Class to manage emailings module.
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.
Definition: index.php:751
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.
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.
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_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).
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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.