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 print '</div>';
376}
377
378$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
379$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields
380$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
381
382print '<div class="div-table-responsive">';
383print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
384
385// Fields title search
386// --------------------------------------------------------------------
387print '<tr class="liste_titre_filter">';
388// Action column
389if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
390 print '<td class="liste_titre maxwidthsearch center">';
391 $searchpicto = $form->showFilterButtons('left');
392 print $searchpicto;
393 print '</td>';
394}
395print '<td class="liste_titre">';
396print '<input type="text" class="flat maxwidth50" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
397print '</td>';
398// Message type
399if (getDolGlobalInt('EMAILINGS_SUPPORT_ALSO_SMS')) {
400 print '<td class="liste_titre">';
401 print '<input type="text" class="flat maxwidth50" name="search_messtype" value="'.dol_escape_htmltag($search_messtype).'">';
402 print '</td>';
403}
404// Title
405print '<td class="liste_titre">';
406print '<input type="text" class="flat maxwidth100 maxwidth50onsmartphone" name="search_all" value="'.dol_escape_htmltag($search_all).'">';
407print '</td>';
408print '<td class="liste_titre">&nbsp;</td>';
409if (!$filteremail) {
410 print '<td class="liste_titre">&nbsp;</td>';
411}
412print '<td class="liste_titre">&nbsp;</td>';
413print '<td class="liste_titre">&nbsp;</td>';
414// Extra fields
415include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
416// Fields from hook
417$parameters = array('arrayfields' => $arrayfields);
418$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
419print $hookmanager->resPrint;
420// Action column
421if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
422 print '<td class="liste_titre center maxwidthsearch">';
423 $searchpicto = $form->showFilterButtons();
424 print $searchpicto;
425 print '</td>';
426}
427print '</tr>'."\n";
428
429$totalarray = array();
430$totalarray['nbfield'] = 0;
431
432// Fields title label
433// --------------------------------------------------------------------
434print '<tr class="liste_titre">';
435if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
436 print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
437 $totalarray['nbfield']++;
438}
439print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "m.rowid", $param, "", "", $sortfield, $sortorder);
440$totalarray['nbfield']++;
441// Message type
442if (getDolGlobalInt('EMAILINGS_SUPPORT_ALSO_SMS')) {
443 print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "m.messtype", $param, "", "", $sortfield, $sortorder);
444 $totalarray['nbfield']++;
445}
446print_liste_field_titre("Title", $_SERVER["PHP_SELF"], "m.titre", $param, "", "", $sortfield, $sortorder);
447$totalarray['nbfield']++;
448print_liste_field_titre("DateCreation", $_SERVER["PHP_SELF"], "m.date_creat", $param, "", '', $sortfield, $sortorder, 'center ');
449$totalarray['nbfield']++;
450if (!$filteremail) {
451 $title = $langs->trans("NbOfEMails");
452 if (getDolGlobalInt('EMAILINGS_SUPPORT_ALSO_SMS')) {
453 $title .= ' | '.$langs->trans("SMS");
454 }
455 print_liste_field_titre($title, $_SERVER["PHP_SELF"], "m.nbemail", $param, "", '', $sortfield, $sortorder, 'center ');
456 $totalarray['nbfield']++;
457}
458if (!$filteremail) {
459 print_liste_field_titre("DateLastSend", $_SERVER["PHP_SELF"], "m.date_envoi", $param, "", '', $sortfield, $sortorder, 'center ');
460 $totalarray['nbfield']++;
461} else {
462 print_liste_field_titre("DateSending", $_SERVER["PHP_SELF"], "mc.date_envoi", $param, "", '', $sortfield, $sortorder, 'center ');
463 $totalarray['nbfield']++;
464}
465// Extra fields
466include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
467// Hook fields
468$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
469$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
470print $hookmanager->resPrint;
471print_liste_field_titre("Status", $_SERVER["PHP_SELF"], ($filteremail ? "mc.statut" : "m.statut"), $param, "", '', $sortfield, $sortorder, 'center ');
472$totalarray['nbfield']++;
473// Action column
474if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
475 print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
476 $totalarray['nbfield']++;
477}
478print '</tr>'."\n";
479
480$totalarray = array();
481$totalarray['nbfield'] = 0;
482
483
484// Loop on record
485// --------------------------------------------------------------------
486$i = 0;
487$savnbfield = $totalarray['nbfield'];
488$totalarray = array();
489$totalarray['nbfield'] = 0;
490$imaxinloop = ($limit ? min($num, $limit) : $num);
491while ($i < $imaxinloop) {
492 $obj = $db->fetch_object($resql);
493 if (empty($obj)) {
494 break; // Should not happen
495 }
496
497 $object->id = $obj->rowid;
498 $object->ref = $obj->rowid;
499
500 // Show here line of result
501 $j = 0;
502 print '<tr data-rowid="'.$object->id.'" class="oddeven">';
503 // Action column
504 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
505 print '<td class="nowrap center">';
506 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
507 $selected = 0;
508 if (in_array($object->id, $arrayofselected)) {
509 $selected = 1;
510 }
511 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
512 }
513 print '</td>';
514 if (!$i) {
515 $totalarray['nbfield']++;
516 }
517 }
518
519 // Ref
520 print '<td>';
521 print $object->getNomUrl(1);
522 print '</td>';
523
524 // Message type
525 if (getDolGlobalInt('EMAILINGS_SUPPORT_ALSO_SMS')) {
526 print '<td>';
527 print dol_escape_htmltag($obj->messtype);
528 print '</td>';
529 }
530
531 // Title
532 print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->title).'">'.dol_escape_htmltag($obj->title).'</td>';
533
534 // Date creation
535 print '<td class="center">';
536 print dol_print_date($db->jdate($obj->datec), 'day');
537 print '</td>';
538
539 // Nb of email
540 if (!$filteremail) {
541 print '<td class="center nowraponall">';
542 $nbemail = $obj->nbemail;
543 /*if ($obj->status != 3 && !empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail)
544 {
545 $text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
546 print $form->textwithpicto($nbemail,$text,1,'warning');
547 }
548 else
549 {
550 print $nbemail;
551 }*/
552 print $nbemail;
553 print '</td>';
554 }
555
556 // Last send
557 print '<td class="nowrap center">'.dol_print_date($db->jdate($obj->date_envoi), 'day').'</td>';
558 print '</td>';
559
560 // Status
561 print '<td class="nowrap center">';
562 if ($filteremail) {
563 print $object::libStatutDest($obj->sendstatut, 2);
564 } else {
565 print $object->LibStatut($obj->status, 5);
566 }
567 print '</td>';
568
569 // Action column
570 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
571 print '<td class="nowrap center">';
572 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
573 $selected = 0;
574 if (in_array($object->id, $arrayofselected)) {
575 $selected = 1;
576 }
577 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
578 }
579 print '</td>';
580 if (!$i) {
581 $totalarray['nbfield']++;
582 }
583 }
584
585 print '</tr>'."\n";
586
587 $i++;
588}
589
590// Show total line
591include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
592
593// If no record found
594if (empty($num)) {
595 $colspan = 6;
596 if (!$filteremail) {
597 $colspan++;
598 }
599 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
600}
601
602
603$db->free($resql);
604
605$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
606$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
607print $hookmanager->resPrint;
608
609print '</table>'."\n";
610print '</div>'."\n";
611
612print '</form>'."\n";
613
614// End of page
615llxFooter();
616$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.