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