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