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