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