dolibarr 25.0.0-alpha
list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2003 Eric Seigne <erics@rycks.com>
4 * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
5 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
6 * Copyright (C) 2017 Open-DSI <support@open-dsi.fr>
7 * Copyright (C) 2018-2026 Frédéric France <frederic.france@free.fr>
8 * Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
9 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
10 * Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <https://www.gnu.org/licenses/>.
24 */
25
32// Load Dolibarr environment
33require '../../main.inc.php';
42require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
43require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
44require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
45require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
46require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
47require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
48
49// Load translation files required by the page
50$langs->loadLangs(array("users", "companies", "agenda", "commercial", "other", "orders", "bills"));
51
52// Get Parameters
53$action = GETPOST('action', 'aZ09');
54$massaction = GETPOST('massaction', 'alpha');
55$confirm = GETPOST('confirm', 'alpha');
56$cancel = GETPOST('cancel', 'alpha');
57$toselect = GETPOST('toselect', 'array:int');
58$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'actioncommlist'; // To manage different context of search
59$optioncss = GETPOST('optioncss', 'alpha');
60$mode = GETPOST('mode', 'aZ09');
61if (empty($mode) && preg_match('/show_/', $action)) {
62 $mode = $action; // For backward compatibility
63}
64
65$disabledefaultvalues = GETPOSTINT('disabledefaultvalues');
66
67$resourceid = GETPOSTINT("search_resourceid") ? GETPOSTINT("search_resourceid") : GETPOSTINT("resourceid");
68$pid = GETPOSTINT("search_projectid", 3) ? GETPOSTINT("search_projectid", 3) : GETPOSTINT("projectid", 3);
69$search_status = (GETPOST("search_status", 'aZ09') != '') ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09');
70$search_import_key = GETPOST("search_import_key");
71$type = GETPOST('search_type', 'alphanohtml') ? GETPOST('search_type', 'alphanohtml') : GETPOST('type', 'alphanohtml');
72$year = GETPOSTINT("year");
73$month = GETPOSTINT("month");
74$day = GETPOSTINT("day");
75// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
76if (GETPOST('search_actioncode', 'array:aZ09')) {
77 $actioncode = GETPOST('search_actioncode', 'array:aZ09', 3);
78 if (!count($actioncode)) {
79 $actioncode = '0';
80 }
81} else {
82 $actioncode = GETPOST("search_actioncode", "alpha", 3) ? GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : ((!getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE') || $disabledefaultvalues) ? '' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE')));
83}
84if (is_array($actioncode)) {
85 // Remove all -1 values
86 $actioncode = array_filter(
87 $actioncode,
92 function ($value) {
93 return ((string) $value !== '-1');
94 }
95 );
96}
97
98// Search Fields
99$search_id = GETPOST('search_id', 'alpha');
100$search_title = GETPOST('search_title', 'alpha');
101$search_note = GETPOST('search_note', 'alpha');
102
103// $dateselect is a day included inside the event range
104$dateselect = dol_mktime(0, 0, 0, GETPOSTINT('dateselectmonth'), GETPOSTINT('dateselectday'), GETPOSTINT('dateselectyear'), 'tzuserrel');
105$datestart_dtstart = dol_mktime(0, 0, 0, GETPOSTINT('datestart_dtstartmonth'), GETPOSTINT('datestart_dtstartday'), GETPOSTINT('datestart_dtstartyear'), 'tzuserrel');
106$datestart_dtend = dol_mktime(23, 59, 59, GETPOSTINT('datestart_dtendmonth'), GETPOSTINT('datestart_dtendday'), GETPOSTINT('datestart_dtendyear'), 'tzuserrel');
107$dateend_dtstart = dol_mktime(0, 0, 0, GETPOSTINT('dateend_dtstartmonth'), GETPOSTINT('dateend_dtstartday'), GETPOSTINT('dateend_dtstartyear'), 'tzuserrel');
108$dateend_dtend = dol_mktime(23, 59, 59, GETPOSTINT('dateend_dtendmonth'), GETPOSTINT('dateend_dtendday'), GETPOSTINT('dateend_dtendyear'), 'tzuserrel');
109if ($search_status == '' && !GETPOSTISSET('search_status')) {
110 $search_status = ((!getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS') || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
111}
112if (empty($mode) && !GETPOSTISSET('mode')) {
113 $mode = getDolGlobalString('AGENDA_DEFAULT_VIEW', 'show_list');
114}
115
116$filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
117$filtert = GETPOST("search_filtert", "intcomma", 3) ? GETPOST("search_filtert", "intcomma", 3) : GETPOST("filtert", "intcomma", 3);
118$usergroup = GETPOSTINT("search_usergroup", 3) ? GETPOSTINT("search_usergroup", 3) : GETPOSTINT("usergroup", 3);
119$showbirthday = empty($conf->use_javascript_ajax) ? (GETPOSTINT("search_showbirthday") ? GETPOSTINT("search_showbirthday") : GETPOSTINT("showbirthday")) : 1;
120$search_categ_cus = GETPOST("search_categ_cus", "intcomma", 3) ? GETPOST("search_categ_cus", "intcomma", 3) : 0;
121
122// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
123$object = new ActionComm($db);
124$hookmanager->initHooks(array('agendalist'));
125
126// fetch optionals attributes and labels
127$extrafields->fetch_name_optionals_label($object->table_element);
128
129$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
130// If not choice done on calendar owner, we filter on user.
131if (empty($filtert) && !getDolGlobalString('AGENDA_ALL_CALENDARS')) {
132 $filtert = (string) $user->id;
133}
134
135// Pagination parameters
136$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
137$sortfield = GETPOST('sortfield', 'aZ09comma');
138$sortorder = GETPOST('sortorder', 'aZ09comma');
139$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
140if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
141 // If $page is not defined, or '' or -1 or if we click on clear filters
142 $page = 0;
143}
144$offset = $limit * $page;
145if (!$sortorder) {
146 $sortorder = "DESC,DESC";
147 if ($search_status == 'todo') {
148 $sortorder = "DESC,DESC";
149 }
150}
151if (!$sortfield) {
152 $sortfield = "a.datep,a.id";
153 if ($search_status == 'todo') {
154 $sortfield = "a.datep,a.id";
155 }
156}
157
158// Security check
159$socid = GETPOSTINT("search_socid") ? GETPOSTINT("search_socid") : GETPOSTINT("socid");
160if ($user->socid) {
161 $socid = $user->socid;
162}
163if ($socid < 0) {
164 $socid = '';
165}
166
167$canedit = 1;
168if (!$user->hasRight('agenda', 'myactions', 'read')) {
170}
171if (!$user->hasRight('agenda', 'allactions', 'read')) {
172 $canedit = 0;
173}
174if (!$user->hasRight('agenda', 'allactions', 'read') || $filter == 'mine') { // If no permission to see all, we show only affected to me
175 $filtert = (string) $user->id;
176}
177
178// Definition of array of fields for columns
179$tableprefix = 'a';
180$arrayfields = array();
181foreach ($object->fields as $key => $val) {
182 // If $val['visible']==0, then we never show the field
183 if (!empty($val['visible'])) {
184 $visible = (int) dol_eval((string) $val['visible'], 1);
185 $arrayfields[$tableprefix.'.'.$key] = array(
186 'label' => $val['label'],
187 'checked' => (($visible < 0) ? '0' : '1'),
188 'enabled' => (string) (int) (abs($visible) != 3 && (bool) dol_eval((string) $val['enabled'], 1)),
189 'position' => $val['position'],
190 'help' => isset($val['help']) ? $val['help'] : ''
191 );
192 }
193}
194
195// Extra fields
196include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
197// Add hook to complete $arrayfield
198$parameters = array('arrayfields' => &$arrayfields);
199$reshook = $hookmanager->executeHooks('completeArrayFields', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
200
201// Complete arrayfields with special fields
202$arrayfields = array_merge($arrayfields, array(
203 'owner' => array('label' => "Owner", 'checked' => '1', 'position' => 46),
204 'c.libelle' => array('label' => "Type", 'checked' => '1', 'position' => 47),
205 's.nom' => array('label' => "ThirdParty", 'checked' => '1', 'position' => 54),
206 'a.fk_element' => array('label' => "LinkedObject", 'checked' => '1', 'position' => 86),
207));
208
209$object->fields = dol_sort_array($object->fields, 'position');
210$arrayfields = dol_sort_array($arrayfields, 'position');
211
212// Security check
213$result = restrictedArea($user, 'agenda', 0, '', 'myactions');
214if ($user->socid && $socid) {
215 $result = restrictedArea($user, 'societe', $socid);
216}
217
218
219/*
220 * Actions
221 */
222
223if (GETPOST('cancel', 'alpha')) {
224 $mode = 'show_list';
225 $massaction = '';
226}
227
228if (GETPOST("viewcal") || GETPOST("viewweek") || GETPOST("viewday")) {
229 $param = '';
230 if (is_array($_POST)) {
231 foreach ($_POST as $key => $val) {
232 $param .= '&'.urlencode($key).'='.urlencode($val);
233 }
234 }
235 //print $param;
236 header("Location: ".DOL_URL_ROOT.'/comm/action/index.php?'.$param);
237 exit;
238}
239
240$parameters = array('id' => $socid);
241$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
242if ($reshook < 0) {
243 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
244}
245
246// Selection of new fields
247include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
248// Purge search criteria
249if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
250 //$actioncode='';
251 $search_id = '';
252 $search_title = '';
253 $search_note = '';
254 $datestart_dtstart = '';
255 $datestart_dtend = '';
256 $dateend_dtstart = '';
257 $dateend_dtend = '';
258 $actioncode = '';
259 $search_status = '';
260 $search_import_key = '';
261 $pid = '';
262 $socid = '';
263 $resourceid = '';
264 $filter = '';
265 $filtert = '';
266 $usergroup = '';
267 $toselect = array();
268 $search_array_options = array();
269}
270
271if (empty($reshook) && !empty($massaction)) {
272 $percent = null;
273
274 switch ($massaction) {
275 case 'set_all_events_to_todo':
276 $percent = ActionComm::EVENT_TODO;
277 break;
278
279 case 'set_all_events_to_in_progress':
281 break;
282
283 case 'set_all_events_to_finished':
285 break;
286 }
287
288 if (isset($percent)) {
289 foreach ($toselect as $toselectid) {
290 $result = $object->updatePercent($toselectid, $percent);
291 if ($result < 0) {
293 break;
294 }
295 }
296 }
297}
298
299// As mass deletion happens with a confirm step, $massaction is not use for the final step (deletion).
300if (empty($reshook)) {
301 $objectclass = 'ActionComm';
302 $objectlabel = 'Events';
303 $uploaddir = true;
304 // Only users that can delete any event can remove records.
305 $permissiontodelete = $user->hasRight('agenda', 'allactions', 'delete');
306 $permissiontoadd = $user->hasRight('agenda', 'myactions', 'create');
307 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
308}
309
310
311/*
312 * View
313 */
314
315$form = new Form($db);
316$userstatic = new User($db);
317$formactions = new FormActions($db);
318
319$actionstatic = new ActionComm($db);
320$societestatic = new Societe($db);
321$contactstatic = new Contact($db);
322
323$nav = '';
324$nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0);
325$nav .= ' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">';
326
327$now = dol_now();
328
329$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&oacute;dulo_Agenda|DE:Modul_Terminplanung';
330$title = $langs->trans("Agenda");
331llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'bodyforlist');
332
333// Define list of all external calendars
334// $listofextcals = array(); Not used yet in lists
335
336$param = '';
337if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
338 $param .= '&contextpage='.urlencode($contextpage);
339}
340if ($limit > 0 && $limit != $conf->liste_limit) {
341 $param .= '&limit='.((int) $limit);
342}
343if ($actioncode != '') {
344 if (is_array($actioncode)) {
345 foreach ($actioncode as $str_action) {
346 $param .= "&search_actioncode[]=".urlencode($str_action);
347 }
348 } else {
349 $param .= "&search_actioncode=".urlencode($actioncode);
350 }
351}
352if ($resourceid > 0) {
353 $param .= "&search_resourceid=".urlencode((string) ($resourceid));
354}
355if ($search_status != '') {
356 $param .= "&search_status=".urlencode($search_status);
357}
358if ($search_import_key != '') {
359 $param .= "&search_import_key=".urlencode($search_import_key);
360}
361if ($filter) {
362 $param .= "&search_filter=".urlencode((string) $filter);
363}
364if ($filtert) {
365 $param .= "&search_filtert=".urlencode((string) $filtert);
366}
367if ($usergroup > 0) {
368 $param .= "&search_usergroup=".urlencode((string) ($usergroup));
369}
370if ($socid > 0) {
371 $param .= "&search_socid=".urlencode((string) ($socid));
372}
373if ($showbirthday) {
374 $param .= "&search_showbirthday=1";
375}
376if ($pid) {
377 $param .= "&search_projectid=".urlencode((string) ($pid));
378}
379if ($type) {
380 $param .= "&search_type=".urlencode($type);
381}
382if ($search_id != '') {
383 $param .= '&search_id='.urlencode($search_id);
384}
385if ($search_title != '') {
386 $param .= '&search_title='.urlencode($search_title);
387}
388if ($search_note != '') {
389 $param .= '&search_note='.urlencode($search_note);
390}
391if (GETPOSTINT('datestart_dtstartday')) {
392 $param .= '&datestart_dtstartday='.GETPOSTINT('datestart_dtstartday');
393}
394if (GETPOSTINT('datestart_dtstartmonth')) {
395 $param .= '&datestart_dtstartmonth='.GETPOSTINT('datestart_dtstartmonth');
396}
397if (GETPOSTINT('datestart_dtstartyear')) {
398 $param .= '&datestart_dtstartyear='.GETPOSTINT('datestart_dtstartyear');
399}
400if (GETPOSTINT('datestart_dtendday')) {
401 $param .= '&datestart_dtendday='.GETPOSTINT('datestart_dtendday');
402}
403if (GETPOSTINT('datestart_dtendmonth')) {
404 $param .= '&datestart_dtendmonth='.GETPOSTINT('datestart_dtendmonth');
405}
406if (GETPOSTINT('datestart_dtendyear')) {
407 $param .= '&datestart_dtendyear='.GETPOSTINT('datestart_dtendyear');
408}
409if (GETPOSTINT('dateend_dtstartday')) {
410 $param .= '&dateend_dtstartday='.GETPOSTINT('dateend_dtstartday');
411}
412if (GETPOSTINT('dateend_dtstartmonth')) {
413 $param .= '&dateend_dtstartmonth='.GETPOSTINT('dateend_dtstartmonth');
414}
415if (GETPOSTINT('dateend_dtstartyear')) {
416 $param .= '&dateend_dtstartyear='.GETPOSTINT('dateend_dtstartyear');
417}
418if (GETPOSTINT('dateend_dtendday')) {
419 $param .= '&dateend_dtendday='.GETPOSTINT('dateend_dtendday');
420}
421if (GETPOSTINT('dateend_dtendmonth')) {
422 $param .= '&dateend_dtendmonth='.GETPOSTINT('dateend_dtendmonth');
423}
424if (GETPOSTINT('dateend_dtendyear')) {
425 $param .= '&dateend_dtendyear='.GETPOSTINT('dateend_dtendyear');
426}
427if ($optioncss != '') {
428 $param .= '&optioncss='.urlencode($optioncss);
429}
430if ($search_categ_cus != 0) {
431 $param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus));
432}
433
434// Add $param from extra fields
435include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
436
437$paramnoactionodate = $param;
438
439// List of mass actions available
440$arrayofmassactions = array(
441 'set_all_events_to_todo' => img_picto('', 'circle', 'class="pictofixedwidth font-status1"').$langs->trans("SetAllEventsToTodo"),
442 'set_all_events_to_in_progress' => img_picto('', 'stop-circle', 'class="pictofixedwidth font-status2"').$langs->trans("SetAllEventsToInProgress"),
443 'set_all_events_to_finished' => img_picto('', 'stop-circle', 'class="pictofixedwidth badge-status5"').$langs->trans("SetAllEventsToFinished"),
444);
445if ($user->hasRight('agenda', 'allactions', 'delete')) {
446 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
447}
448if (isModEnabled('category') && $user->hasRight('agenda', 'myactions', 'create')) {
449 $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
450}
451if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete','preaffecttag'))) {
452 $arrayofmassactions = array();
453}
454$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
455
456$sql = "SELECT";
457$sql .= " a.datep as dp, a.id, a.code, a.label, a.note, a.datep2 as dp2, a.fulldayevent, a.location, a.entity,";
458$sql .= " a.fk_user_author, a.fk_user_action,";
459$sql .= " a.fk_contact, a.note, a.percent as percent,";
460$sql .= " a.fk_element, a.elementtype, a.datec, a.tms as datem,";
461$sql .= " a.recurid, a.recurrule, a.recurdateend, a.import_key,";
462$sql .= " c.code as type_code, c.libelle as type_label, c.color as type_color, c.type as type_type, c.picto as type_picto,";
463$sql .= " s.nom as societe, s.rowid as socid, s.client, s.email as socemail";
464//$sql .= " sp.lastname, sp.firstname, sp.email, sp.phone, sp.address, sp.phone as phone_pro, sp.phone_mobile, sp.phone_perso, sp.fk_pays as country_id";
465
466// Add fields from extrafields
467if (!empty($extrafields->attributes[$object->table_element]['label'])) {
468 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
469 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
470 }
471}
472
473// Add fields from hooks
474$parameters = array();
475$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
476$sql .= $hookmanager->resPrint;
477
478$sqlfields = $sql; // $sql fields to remove for count total
479
480$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
481$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_extrafields as ef ON a.id = ef.fk_object";
482$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
483$sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action";
484// We must filter on resource table
485if ($resourceid > 0) {
486 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."element_resources as r ON r.element_type = 'action' AND r.element_id = a.id";
487}
488// Add table from hooks
489$parameters = array();
490$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
491$sql .= $hookmanager->resPrint;
492
493$sql .= " WHERE a.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda
494// Condition on actioncode
495if (!empty($actioncode)) {
496 if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE')) {
497 if ((is_array($actioncode) && in_array('AC_NON_AUTO', $actioncode)) || $actioncode == 'AC_NON_AUTO') {
498 $sql .= " AND c.type != 'systemauto'";
499 } elseif ((is_array($actioncode) && in_array('AC_ALL_AUTO', $actioncode)) || $actioncode == 'AC_ALL_AUTO') {
500 $sql .= " AND c.type = 'systemauto'";
501 } else {
502 if ((is_array($actioncode) && in_array('AC_OTH', $actioncode)) || $actioncode == 'AC_OTH') {
503 $sql .= " AND c.type != 'systemauto'";
504 }
505 if ((is_array($actioncode) && in_array('AC_OTH_AUTO', $actioncode)) || $actioncode == 'AC_OTH_AUTO') {
506 $sql .= " AND c.type = 'systemauto'";
507 }
508 }
509 } else {
510 if ((is_array($actioncode) && in_array('AC_NON_AUTO', $actioncode)) || $actioncode === 'AC_NON_AUTO') {
511 $sql .= " AND c.type != 'systemauto'";
512 } elseif ((is_array($actioncode) && in_array('AC_ALL_AUTO', $actioncode)) || $actioncode === 'AC_ALL_AUTO') {
513 $sql .= " AND c.type = 'systemauto'";
514 } else {
515 if (is_array($actioncode)) {
516 // Remove all -1 values
517 $actioncode = array_filter(
518 $actioncode,
523 function ($value) {
524 return ((string) $value !== '-1');
525 }
526 );
527 if (count($actioncode)) {
528 $sql .= " AND c.code IN (".$db->sanitize("'".implode("','", $actioncode)."'", 1).")";
529 }
530 } elseif ($actioncode !== '-1') {
531 $sql .= " AND c.code IN (".$db->sanitize("'".implode("','", explode(',', $actioncode))."'", 1).")";
532 }
533 }
534 }
535}
536if ($resourceid > 0) {
537 $sql .= " AND r.resource_id = ".((int) $resourceid);
538}
539if ($pid) {
540 $sql .= " AND a.fk_project=".((int) $pid);
541}
542
543// If the internal user must only see his customers, force searching by him
544$search_sale = 0;
545if (isModEnabled("societe") && !$user->hasRight('societe', 'client', 'voir')) {
546 $search_sale = $user->id;
547}
548// Search on sale representative
549if ($search_sale && $search_sale != '-1') {
550 if ($search_sale == -2) {
551 $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = a.fk_soc)";
552 } elseif ($search_sale > 0) {
553 $sql .= " AND (a.fk_soc IS NULL OR EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = a.fk_soc AND sc.fk_user = ".((int) $search_sale)."))";
554 }
555}
556// Search on socid
557if ($socid > 0) {
558 $sql .= " AND a.fk_soc = ".((int) $socid);
559}
560if ($type) {
561 $sql .= " AND c.id = ".((int) $type);
562}
563if ($search_status == '0') {
564 // To do (not started)
565 $sql .= " AND a.percent = 0";
566}
567if ($search_status == 'na') {
568 // Not applicable
569 $sql .= " AND a.percent = -1";
570}
571if ($search_status == '50') {
572 // Running already started
573 $sql .= " AND (a.percent > 0 AND a.percent < 100)";
574}
575if ($search_status == 'done' || $search_status == '100') {
576 $sql .= " AND (a.percent = 100)";
577}
578if ($search_status == 'todo') {
579 $sql .= " AND (a.percent >= 0 AND a.percent < 100)";
580}
581if ($search_import_key) {
582 $sql .= natural_search("a.import_key", $search_import_key);
583}
584if ($search_id) {
585 $sql .= natural_search("a.id", $search_id, 1);
586}
587if ($search_title) {
588 $sql .= natural_search("a.label", $search_title);
589}
590if ($search_note) {
591 $sql .= natural_search('a.note', $search_note);
592}
593
594// The second or of next test is to take event with no end date (we suppose duration is 1 hour in such case)
595if ($dateselect > 0) {
596 $sql .= " AND ((a.datep2 >= '".$db->idate($dateselect)."' AND a.datep <= '".$db->idate($dateselect + 3600 * 24 - 1)."') OR (a.datep2 IS NULL AND a.datep > '".$db->idate($dateselect - 3600)."' AND a.datep <= '".$db->idate($dateselect + 3600 * 24 - 1)."'))";
597}
598if ($datestart_dtstart > 0) {
599 $sql .= " AND a.datep >= '".$db->idate($datestart_dtstart)."'";
600}
601if ($datestart_dtend > 0) {
602 $sql .= " AND a.datep <= '".$db->idate($datestart_dtend)."'";
603}
604if ($dateend_dtstart > 0) {
605 $sql .= " AND a.datep2 >= '".$db->idate($dateend_dtstart)."'";
606}
607if ($dateend_dtend > 0) {
608 $sql .= " AND a.datep2 <= '".$db->idate($dateend_dtend)."'";
609}
610
611// Search in categories, -1 is all and -2 is no categories
612if ($search_categ_cus != -1) {
613 if ($search_categ_cus == -2) {
614 $sql .= " AND NOT EXISTS (SELECT ca.fk_actioncomm FROM ".MAIN_DB_PREFIX."categorie_actioncomm as ca WHERE ca.fk_actioncomm = a.id)";
615 } elseif ($search_categ_cus > 0) {
616 $sql .= " AND EXISTS (SELECT ca.fk_actioncomm FROM ".MAIN_DB_PREFIX."categorie_actioncomm as ca WHERE ca.fk_actioncomm = a.id AND ca.fk_categorie IN (".$db->sanitize($search_categ_cus)."))";
617 }
618}
619
620// Add where from extra fields
621include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
622
623// Add where from hooks
624$parameters = array();
625$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
626$sql .= $hookmanager->resPrint;
627
628$sql1 = $sql2 = '';
629
630// We must filter on assignment table
631if (($filtert != '-1' && $filtert != '-2') || $usergroup > 0) {
632 if ($filtert != '' && $filtert != '-1' && $filtert != '-2' && $filtert != '-3') {
633 $where1 = "a.fk_user_action = ".((int) $filtert); // For old data compatibility (where owner was not assigned as contact)
634 $where2 = "a.fk_user_action <> ".((int) $filtert)." AND EXISTS (SELECT ar.rowid FROM ".MAIN_DB_PREFIX."actioncomm_resources as ar WHERE ar.fk_actioncomm = a.id AND ar.element_type = 'user' AND ar.fk_element IN (".$db->sanitize($filtert)."))";
635 $sql1 = $sql . " AND " . $where1;
636 $sql2 = $sql . " AND " . $where2;
637 $sql .= " AND ((" . $where1 . ") OR (" . $where2."))";
638 } elseif ($filtert == '-3') {
639 // TODO If a.fk_user_action is in my hierarchy ?
640 $sql .= " AND EXISTS (SELECT ar.rowid FROM ".MAIN_DB_PREFIX."actioncomm_resources as ar WHERE ar.fk_actioncomm = a.id AND ar.element_type = 'user' AND ar.fk_element IN (".$db->sanitize(implode(',', $user->getAllChildIds(1)))."))";
641 } elseif ($usergroup > 0) { // Filter on my hierarchy
642 // TODO If a.fk_user_action is in group ?
643 $sql .= " AND EXISTS (SELECT ar.rowid FROM ".MAIN_DB_PREFIX."actioncomm_resources as ar WHERE ar.fk_actioncomm = a.id AND ar.element_type = 'user' AND ar.fk_element IN (SELECT ugu.fk_user FROM ".MAIN_DB_PREFIX."usergroup_user as ugu WHERE ugu.fk_usergroup = ".((int) $usergroup)."))";
644 }
645}
646//print $sql."<br>".$sql1."<br>".$sql2;
647
648// Count total nb of records
649$nbtotalofrecords = '';
650if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
651 /* The fast and low memory method to get and count full list converts the sql into a sql count */
652 if (empty($sql1) && empty($sql2)) {
653 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
654 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
655 // TODO Add a method $sqlforcount = sqlOptimizeCount($sqlforcount, array('actioncomm_extrafields', 'societe', 'c_actioncomm')) to
656 // remove all LEFT JOIN and INNER JOIN from the $sqlforcount if there is no fields into the WHERE.
657
658 $resql = $db->query($sqlforcount);
659 if ($resql) {
660 $objforcount = $db->fetch_object($resql);
661 $nbtotalofrecords = (int) $objforcount->nbtotalofrecords;
662 } else {
664 }
665
666 $db->free($resql);
667 } else {
668 $sqlforcount1 = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql1);
669 $sqlforcount2 = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql2);
670
671 $resql1 = $db->query($sqlforcount1);
672 $resql2 = $db->query($sqlforcount2);
673 if ($resql1 && $resql2) {
674 $objforcount1 = $db->fetch_object($resql1);
675 $objforcount2 = $db->fetch_object($resql2);
676 $nbtotalofrecords = (int) $objforcount1->nbtotalofrecords + (int) $objforcount2->nbtotalofrecords;
677 } else {
679 }
680
681 $db->free($resql1);
682 $db->free($resql2);
683 }
684
685 if (($page * $limit) > (int) $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
686 $page = 0;
687 $offset = 0;
688 }
689}
690
691// Complete request and execute it with limit
692$sql .= $db->order($sortfield, $sortorder);
693if ($limit) {
694 $sql .= $db->plimit($limit + 1, $offset);
695}
696
697$resql = $db->query($sql);
698if (!$resql) {
700 exit;
701}
702
703$num = $db->num_rows($resql);
704
705$arrayofselected = is_array($toselect) ? $toselect : array();
706
707// Local calendar
708$newtitle = '<div class="nowrap clear inline-block minheight30 hideonsmartphone">';
709$newtitle .= '<input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled><label class="labelcalendar"><span class="check_local_text small"> '.$langs->trans("LocalAgenda").'</span></label> &nbsp; ';
710$newtitle .= '</div>';
711//$newtitle=$langs->trans($title);
712
713$tabactive = 'cardlist';
714
715$head = calendars_prepare_head($param);
716
717print '<form method="POST" id="searchFormList" class="listactionsfilter" action="'.$_SERVER["PHP_SELF"].'">'."\n";
718
719if ($optioncss != '') {
720 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
721}
722print '<input type="hidden" name="token" value="'.newToken().'">';
723print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
724print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
725print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
726print '<input type="hidden" name="type" value="'.$type.'">';
727$nav = '';
728
729if ($filter) {
730 $nav .= '<input type="hidden" name="search_filter" value="'.$filter.'">';
731}
732if ($showbirthday) {
733 $nav .= '<input type="hidden" name="search_showbirthday" value="1">';
734}
735print $nav;
736
737
738$s = $newtitle;
739
740// Calendars from hooks
741$parameters = array();
742$reshook = $hookmanager->executeHooks('addCalendarChoice', $parameters, $object, $action);
743if (empty($reshook)) {
744 $s .= $hookmanager->resPrint;
745} elseif ($reshook > 1) {
746 $s = $hookmanager->resPrint;
747}
748
749$viewyear = is_object($object) ? dol_print_date($object->datep, '%Y') : '';
750$viewmonth = is_object($object) ? dol_print_date($object->datep, '%m') : '';
751$viewday = is_object($object) ? dol_print_date($object->datep, '%d') : '';
752
753$viewmode = '<div class="navmode inline-block">';
754
755$viewmode .= '<a class="btnTitle'.(($mode == 'list' || $mode == 'show_list') ? ' btnTitleSelected' : '').' btnTitleSelected reposition" href="'.DOL_URL_ROOT.'/comm/action/list.php?mode=show_list&restore_lastsearch_values=1'.$paramnoactionodate.'">';
756//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
757$viewmode .= img_picto($langs->trans("List"), 'object_calendarlist', 'class="imgforviewmode pictoactionview block"');
758//$viewmode .= '</span>';
759$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans("ViewList").'</span></a>';
760
761$viewmode .= '<a class="btnTitle'.($mode == 'show_month' ? ' btnTitleSelected' : '').' reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_month&year='.$viewyear.'&month='.$viewmonth.'&day='.$viewday.$paramnoactionodate.'">';
762//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
763$viewmode .= img_picto($langs->trans("ViewCal"), 'object_calendarmonth', 'class="pictoactionview block"');
764//$viewmode .= '</span>';
765$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans("ViewCal").'</span></a>';
766
767$viewmode .= '<a class="btnTitle'.($mode == 'show_week' ? ' btnTitleSelected' : '').' reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_week&year='.$viewyear.'&month='.$viewmonth.'&day='.$viewday.$paramnoactionodate.'">';
768//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
769$viewmode .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview block"');
770//$viewmode .= '</span>';
771$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans("ViewWeek").'</span></a>';
772
773$viewmode .= '<a class="btnTitle'.($mode == 'show_day' ? ' btnTitleSelected' : '').' reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_day&year='.$viewyear.'&month='.$viewmonth.'&day='.$viewday.$paramnoactionodate.'">';
774//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
775$viewmode .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview block"');
776//$viewmode .= '</span>';
777$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans("ViewDay").'</span></a>';
778
779$viewmode .= '<a class="btnTitle'.($mode == 'show_peruser' ? ' btnTitleSelected' : '').' reposition marginrightonly" href="'.DOL_URL_ROOT.'/comm/action/peruser.php?mode=show_peruser&year='.$viewyear.'&month='.$viewmonth.'&day='.$viewday.$paramnoactionodate.'">';
780//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
781$viewmode .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview block"');
782//$viewmode .= '</span>';
783$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow" title="'.dolPrintHTML($langs->trans("ViewPerUser")).'">'.$langs->trans("ViewPerUser").'</span></a>';
784
785// Add more views from hooks
786$parameters = array();
787$reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action);
788if (empty($reshook)) {
789 $viewmode .= $hookmanager->resPrint;
790} elseif ($reshook > 1) {
791 $viewmode = $hookmanager->resPrint;
792}
793
794$viewmode .= '</div>';
795
796$viewmode .= '<span class="marginrightonly"></span>';
797
798$tmpforcreatebutton = dol_getdate(dol_now('tzuserrel'), true);
799
800$newparam = '?month='.str_pad((string) $month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year'];
801
802$url = DOL_URL_ROOT.'/comm/action/card.php?action=create';
803$url .= '&apyear='.$tmpforcreatebutton['year'].'&apmonth='.$tmpforcreatebutton['mon'].'&apday='.$tmpforcreatebutton['mday'];
804$url .= '&aphour='.$tmpforcreatebutton['hours'].'&apmin='.$tmpforcreatebutton['minutes'];
805$url .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].$newparam);
806
807$newcardbutton = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, '', (int) ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')));
808
809$param .= '&mode='.urlencode($mode);
810
811// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
812print_barre_liste($langs->trans("Agenda"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_action', 0, $nav.$newcardbutton, '', $limit, 0, 0, 1, $viewmode);
813
814print $s;
815
816$objecttmp = new ActionComm($db);
817include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
818
819$moreforfilter = '';
820
821$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
822$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields
823if ($massactionbutton) {
824 $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
825}
826$i = 0;
827
828print '<div class="liste_titre liste_titre_bydiv centpercent">';
829print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, '', $filtert, '', $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid, $search_categ_cus, $search_import_key);
830print '</div>';
831
832$moreforfilter = 1;
833
834print '<div class="div-table-responsive">';
835print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
836
837print '<tr class="liste_titre_filter">';
838// Action column
839if ($conf->main_checkbox_left_column) {
840 print '<td class="liste_titre" align="middle">';
841 $searchpicto = $form->showFilterButtons('left');
842 print $searchpicto;
843 print '</td>';
844}
845if (!empty($arrayfields['a.id']['checked'])) {
846 print '<td class="liste_titre"><input type="text" class="maxwidth50" name="search_id" value="'.$search_id.'"></td>';
847}
848if (!empty($arrayfields['a.datep']['checked'])) {
849 print '<td class="liste_titre nowraponall center">';
850 print '<div class="nowrap">';
851 print $form->selectDate($datestart_dtstart, 'datestart_dtstart', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'), 'tzuserrel');
852 print '</div>';
853 print '<div class="nowrap">';
854 print $form->selectDate($datestart_dtend, 'datestart_dtend', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('To'), 'tzuserrel');
855 print '</div>';
856 print '</td>';
857}
858if (!empty($arrayfields['a.datep2']['checked'])) {
859 print '<td class="liste_titre nowraponall center">';
860 print '<div class="nowrap">';
861 print $form->selectDate($dateend_dtstart, 'dateend_dtstart', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'), 'tzuserrel');
862 print '</div>';
863 print '<div class="nowrap">';
864 print $form->selectDate($dateend_dtend, 'dateend_dtend', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('To'), 'tzuserrel');
865 print '</div>';
866 print '</td>';
867}
868if (!empty($arrayfields['owner']['checked'])) {
869 print '<td class="liste_titre"></td>';
870}
871if (!empty($arrayfields['c.libelle']['checked'])) {
872 print '<td class="liste_titre"></td>';
873}
874if (!empty($arrayfields['a.label']['checked'])) {
875 print '<td class="liste_titre"><input type="text" class="maxwidth125" name="search_title" value="'.$search_title.'"></td>';
876}
877if (!empty($arrayfields['a.note']['checked'])) {
878 print '<td class="liste_titre"><input type="text" class="maxwidth75" name="search_note" value="'.$search_note.'"></td>';
879}
880if (!empty($arrayfields['s.nom']['checked'])) {
881 print '<td class="liste_titre"></td>';
882}
883if (!empty($arrayfields['a.fk_contact']['checked'])) {
884 print '<td class="liste_titre"></td>';
885}
886if (!empty($arrayfields['a.fk_element']['checked'])) {
887 print '<td class="liste_titre"></td>';
888}
889
890// Extra fields
891include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
892
893// Fields from hook
894$parameters = array('arrayfields' => $arrayfields);
895$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
896print $hookmanager->resPrint;
897
898if (!empty($arrayfields['a.datec']['checked'])) {
899 print '<td class="liste_titre"></td>';
900}
901if (!empty($arrayfields['a.tms']['checked'])) {
902 print '<td class="liste_titre"></td>';
903}
904if (!empty($arrayfields['a.import_key']['checked'])) {
905 print '<td class="liste_titre center"><input type="text" class="maxwidth75" name="search_import_key" value="'.$search_import_key.'"></td>';
906 print '</td>';
907}
908if (!empty($arrayfields['a.percent']['checked'])) {
909 print '<td class="liste_titre center parentonrightofpage">';
910 $formactions->form_select_status_action('formaction', $search_status, 1, 'search_status', 1, 2, 'search_status width100 onrightofpage');
911 print '</td>';
912}
913// Action column
914if (!$conf->main_checkbox_left_column) {
915 print '<td class="liste_titre center">';
916 $searchpicto = $form->showFilterButtons();
917 print $searchpicto;
918 print '</td>';
919}
920print '</tr>'."\n";
921
922$totalarray = array();
923$totalarray['nbfield'] = 0;
924
925// Fields title label
926// --------------------------------------------------------------------
927print '<tr class="liste_titre">';
928if ($conf->main_checkbox_left_column) {
929 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
930 $totalarray['nbfield']++;
931}
932if (!empty($arrayfields['a.id']['checked'])) {
933 // @phan-suppress-next-line PhanTypeInvalidDimOffset
934 print_liste_field_titre($arrayfields['a.id']['label'], $_SERVER["PHP_SELF"], "a.id", "", $param, "", $sortfield, $sortorder);
935 $totalarray['nbfield']++;
936}
937if (!empty($arrayfields['a.datep']['checked'])) {
938 print_liste_field_titre($arrayfields['a.datep']['label'], $_SERVER["PHP_SELF"], "a.datep,a.id", "", $param, '', $sortfield, $sortorder, 'center ');
939 $totalarray['nbfield']++;
940}
941if (!empty($arrayfields['a.datep2']['checked'])) {
942 print_liste_field_titre($arrayfields['a.datep2']['label'], $_SERVER["PHP_SELF"], "a.datep2", "", $param, '', $sortfield, $sortorder, 'center ');
943 $totalarray['nbfield']++;
944}
945if (!empty($arrayfields['owner']['checked'])) {
946 print_liste_field_titre($arrayfields['owner']['label'], $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
947 $totalarray['nbfield']++;
948}
949if (!empty($arrayfields['c.libelle']['checked'])) {
950 print_liste_field_titre($arrayfields['c.libelle']['label'], $_SERVER["PHP_SELF"], "c.libelle", "", $param, "", $sortfield, $sortorder);
951 $totalarray['nbfield']++;
952}
953if (!empty($arrayfields['a.label']['checked'])) {
954 print_liste_field_titre($arrayfields['a.label']['label'], $_SERVER["PHP_SELF"], "a.label", "", $param, "", $sortfield, $sortorder);
955 $totalarray['nbfield']++;
956}
957if (!empty($arrayfields['a.note']['checked'])) {
958 print_liste_field_titre($arrayfields['a.note']['label'], $_SERVER["PHP_SELF"], "a.note", "", $param, "", $sortfield, $sortorder);
959 $totalarray['nbfield']++;
960}
961if (!empty($arrayfields['s.nom']['checked'])) {
962 print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder);
963 $totalarray['nbfield']++;
964}
965if (!empty($arrayfields['a.fk_contact']['checked'])) {
966 print_liste_field_titre($arrayfields['a.fk_contact']['label'], $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
967 $totalarray['nbfield']++;
968}
969if (!empty($arrayfields['a.fk_element']['checked'])) {
970 print_liste_field_titre($arrayfields['a.fk_element']['label'], $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
971 $totalarray['nbfield']++;
972}
973// Extra fields
974include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
975// Hook fields
976$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
977$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
978print $hookmanager->resPrint;
979
980if (!empty($arrayfields['a.datec']['checked'])) {
981 print_liste_field_titre($arrayfields['a.datec']['label'], $_SERVER["PHP_SELF"], "a.datec,a.id", "", $param, '', $sortfield, $sortorder, 'center ');
982 $totalarray['nbfield']++;
983}
984if (!empty($arrayfields['a.tms']['checked'])) {
985 print_liste_field_titre($arrayfields['a.tms']['label'], $_SERVER["PHP_SELF"], "a.tms,a.id", "", $param, '', $sortfield, $sortorder, 'center ');
986 $totalarray['nbfield']++;
987}
988// Import ID
989if (!empty($arrayfields['a.import_key']['checked'])) {
990 print_liste_field_titre("ImportId", $_SERVER["PHP_SELF"], "a.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
991 $totalarray['nbfield']++;
992}
993// Status
994if (!empty($arrayfields['a.percent']['checked'])) {
995 print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "a.percent", "", $param, '', $sortfield, $sortorder, 'center ');
996 $totalarray['nbfield']++;
997}
998if (!$conf->main_checkbox_left_column) {
999 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ');
1000 $totalarray['nbfield']++;
1001}
1002print "</tr>\n";
1003
1004$now = dol_now();
1005$delay_warning = getDolGlobalInt('MAIN_DELAY_ACTIONS_TODO') * 24 * 60 * 60;
1006$today_start_time = dol_mktime(0, 0, 0, (int) date('m', $now), (int) date('d', $now), (int) date('Y', $now));
1007
1008require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
1009$caction = new CActionComm($db);
1010$arraylist = $caction->liste_array(1, 'code', '', (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') ? 1 : 0), '', 1);
1011$contactListCache = array();
1012$elementlinkcache = array();
1013
1014// Loop on record
1015// --------------------------------------------------------------------
1016$i = 0;
1017//$savnbfield = $totalarray['nbfield'];
1018//$totalarray['nbfield'] = 0;
1019$imaxinloop = ($limit ? min($num, $limit) : $num);
1020$cache_user_list = array();
1021while ($i < $imaxinloop) {
1022 $obj = $db->fetch_object($resql);
1023 if (empty($obj)) {
1024 break; // Should not happen
1025 }
1026
1027 // Store properties in $object
1028 $object->setVarsFromFetchObj($obj);
1029
1030 // Discard auto action if option is on
1031 if (getDolGlobalString('AGENDA_ALWAYS_HIDE_AUTO') && $obj->type_code == 'AC_OTH_AUTO') {
1032 $i++;
1033 continue;
1034 }
1035
1036 $actionstatic->id = $obj->id;
1037 $actionstatic->ref = $obj->id;
1038 $actionstatic->code = $obj->code;
1039 $actionstatic->label = $obj->label;
1040 $actionstatic->location = $obj->location;
1041 $actionstatic->note_private = dol_htmlentitiesbr($obj->note);
1042 $actionstatic->datep = $db->jdate($obj->dp);
1043 $actionstatic->percentage = $obj->percent;
1044 $actionstatic->authorid = $obj->fk_user_author;
1045 $actionstatic->userownerid = $obj->fk_user_action;
1046 $actionstatic->recurid = $obj->recurid;
1047 $actionstatic->recurrule = $obj->recurrule;
1048 $actionstatic->recurdateend = $db->jdate($obj->recurdateend);
1049 // From type of action table
1050 $actionstatic->type = $obj->type_type;
1051 $actionstatic->type_code = $obj->type_code;
1052 $actionstatic->type_label = $obj->type_label;
1053 $actionstatic->type_picto = $obj->type_picto;
1054 $actionstatic->type_color = $obj->type_color;
1055
1056
1057 // Initialize $this->userassigned && this->socpeopleassigned array && this->userownerid
1058 // but only if we need it
1059 if (!empty($arrayfields['a.fk_contact']['checked'])) {
1060 $actionstatic->fetchResources();
1061 }
1062
1063 // cache of user list (owners)
1064 if ($obj->fk_user_action > 0 && !isset($cache_user_list[$obj->fk_user_action])) {
1065 $userstatic = new User($db);
1066 $res = $userstatic->fetch($obj->fk_user_action);
1067 if ($res > 0) {
1068 $cache_user_list[$obj->fk_user_action] = $userstatic;
1069 }
1070 }
1071
1072 // get event style for user owner
1073 $event_owner_style = '';
1074 // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event)
1075 if ($obj->fk_user_action > 0 && $cache_user_list[$obj->fk_user_action]->color != '') {
1076 $event_owner_style .= 'border-left: #' . $cache_user_list[$obj->fk_user_action]->color . ' 5px solid;';
1077 }
1078
1079 // get event style for start and end date
1080 $event_more_class = '';
1081 $event_start_date_css = '';
1082 $event_end_date_css = '';
1083 $event_start_date_time = $actionstatic->datep;
1084 if ($event_start_date_time > $now) {
1085 // future event
1086 $event_more_class = 'event-future';
1087 $event_start_date_css = $event_end_date_css = $event_more_class;
1088 } else {
1089 if ($obj->fulldayevent == 1) {
1090 $today_start_date_time = $today_start_time;
1091 } else {
1092 $today_start_date_time = $now;
1093 }
1094
1095 // check event end date
1096 $event_end_date_time = $db->jdate($obj->dp2);
1097 if ($event_end_date_time != null && $event_end_date_time < $today_start_date_time) {
1098 // past event
1099 $event_more_class = 'event-past';
1100 } elseif ($event_end_date_time == null && $event_start_date_time < $today_start_date_time) {
1101 // past event
1102 $event_more_class = 'event-past';
1103 } else {
1104 // current event
1105 $event_more_class = 'event-current';
1106 }
1107 $event_start_date_css = $event_end_date_css = $event_more_class;
1108 }
1109 $event_start_date_css = $event_end_date_css = $event_more_class;
1110
1111 print '<tr class="oddeven row-with-select ' . ($event_more_class != '' ? ' '.$event_more_class : '') . '">';
1112
1113 // Action column
1114 if ($conf->main_checkbox_left_column) {
1115 print '<td class="nowrap center">';
1116 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1117 $selected = 0;
1118 if (in_array($obj->id, $arrayofselected)) {
1119 $selected = 1;
1120 }
1121 print '<input id="cb'.$obj->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.'"'.($selected ? ' checked="checked"' : '').'>';
1122 }
1123 print '</td>';
1124 }
1125 // Ref
1126 if (!empty($arrayfields['a.id']['checked'])) {
1127 print '<td class="nowraponall">';
1128 print $actionstatic->getNomUrl(1, -1);
1129 print '</td>';
1130 }
1131
1132 // Start date
1133 if (!empty($arrayfields['a.datep']['checked'])) {
1134 print '<td class="center nowraponall'.($event_start_date_css ? ' '.$event_start_date_css.'x' : '').'"><span>';
1135 if (empty($obj->fulldayevent)) {
1136 print '<div class="center inline-block lineheightsmall">';
1137 print dol_print_date($db->jdate($obj->dp), 'dayreduceformat', 'tzuserrel');
1138 print '<br><span class="opacitymedium hourspan">';
1139 print dol_print_date($db->jdate($obj->dp), 'hourreduceformat', 'tzuserrel');
1140 print '</span>';
1141 print '</div>';
1142 } else {
1143 $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
1144 print '<div class="center inline-block lineheightsmall">';
1145 print dol_print_date($db->jdate($obj->dp), 'day', ($tzforfullday ? $tzforfullday : 'tzuserrel'));
1146 print '<br><span class="opacitymedium hourspan">';
1147 print dol_print_date(0, 'hourreduceformat', 'gmt');
1148 print '</span>';
1149 print '</div>';
1150 }
1151 print '</span>';
1152 $late = 0;
1153 if ($actionstatic->hasDelay() && $actionstatic->percentage >= 0 && $actionstatic->percentage < 100) {
1154 $late = 1;
1155 }
1156 if ($late) {
1157 print img_warning($langs->trans("Late")).' ';
1158 }
1159 print '</td>';
1160 }
1161
1162 // End date
1163 if (!empty($arrayfields['a.datep2']['checked'])) {
1164 print '<td class="center nowraponall'.($event_end_date_css ? ' '.$event_end_date_css.'x' : '').'"><span>';
1165 if (empty($obj->fulldayevent)) {
1166 print '<div class="center inline-block lineheightsmall">';
1167 print dol_print_date($db->jdate($obj->dp2), 'dayreduceformat', 'tzuserrel');
1168 print '<br><span class="opacitymedium hourspan">';
1169 print dol_print_date($db->jdate($obj->dp2), 'hourreduceformat', 'tzuserrel');
1170 print '</span>';
1171 print '</div>';
1172 } else {
1173 $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
1174 print '<div class="center inline-block lineheightsmall">';
1175 print dol_print_date($db->jdate($obj->dp2), 'day', ($tzforfullday ? $tzforfullday : 'tzuserrel'));
1176 print '<br><span class="opacitymedium hourspan">';
1177 print dol_print_date(23*60*60+59*60+59, 'hourreduceformat', 'gmt');
1178 print '</span>';
1179 print '</div>';
1180 }
1181 print '</span>';
1182 print '</td>';
1183 }
1184
1185 // User owner
1186 if (!empty($arrayfields['owner']['checked'])) {
1187 print '<td class="tdoverflowmax125">';
1188 if ($obj->fk_user_action > 0 && !isset($cache_user_list[$obj->fk_user_action])) {
1189 $userstatic = new User($db);
1190 $res = $userstatic->fetch($obj->fk_user_action);
1191 if ($res > 0) {
1192 $cache_user_list[$obj->fk_user_action] = $userstatic;
1193 }
1194 }
1195 if (isset($cache_user_list[$obj->fk_user_action])) {
1196 print $cache_user_list[$obj->fk_user_action]->getNomUrl(-1, '', 0, 0, 16, 0, 'firstelselast', '');
1197 }
1198 print '</td>';
1199 }
1200
1201 // Type
1202 if (!empty($arrayfields['c.libelle']['checked'])) {
1203 print '<td class="tdoverflowmax125 nowraponall">';
1204 // Example $actionstatic->code = AC_COMPANY_MODIFY and $actionstatic->type_code = AC_OTH_AUTO
1205 print $actionstatic->getTypePicto();
1206 $labeltype = $obj->type_code;
1207 if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') && empty($arraylist[$labeltype])) {
1208 $labeltype = 'AC_OTH';
1209 }
1210 if (!empty($actionstatic->code) && preg_match('/^TICKET_MSG/', $actionstatic->code)) {
1211 $labeltype = $langs->trans("Message");
1212 } else {
1213 if (!empty($arraylist[$labeltype])) {
1214 $labeltype = $arraylist[$labeltype];
1215 }
1216 if ($obj->type_code == 'AC_OTH_AUTO' && ($obj->type_code != $obj->code) && $labeltype && !empty($arraylist[$obj->code])) {
1217 $labeltype .= ' - '.$arraylist[$obj->code]; // Use code in priority on type_code
1218 }
1219 }
1220 print dol_trunc($labeltype, 28);
1221 print '</td>';
1222 }
1223
1224 // Label
1225 if (!empty($arrayfields['a.label']['checked'])) {
1226 print '<td class="tdoverflowmax300" title="'.dolPrintHTMLForAttribute($actionstatic->label).'">';
1227 print dolPrintHTML($actionstatic->label);
1228 print '</td>';
1229 }
1230
1231 // Description
1232 if (!empty($arrayfields['a.note']['checked'])) {
1233 $text = dolGetFirstLineOfText(dol_string_nohtmltag($actionstatic->note_private, 1));
1234 print '<td class="minwidth150">';
1235 print '<div class="small twolinesmax lineheightsmall minwidth150 maxwidth250 classfortooltip" title="'.dolPrintHTMLForAttribute($actionstatic->note_private).'">';
1236 //print $form->textwithtooltip(dol_trunc($text, 48), $actionstatic->note_private);
1237 print dolPrintHTML($text);
1238 print '</div>';
1239 print '</td>';
1240 }
1241
1242 // Third party
1243 if (!empty($arrayfields['s.nom']['checked'])) {
1244 print '<td class="tdoverflowmax150">';
1245 if ($obj->socid > 0) {
1246 $societestatic->id = $obj->socid;
1247 $societestatic->client = (int) $obj->client;
1248 $societestatic->name = (string) $obj->societe;
1249 $societestatic->email = $obj->socemail;
1250
1251 print $societestatic->getNomUrl(1, '', 28);
1252 }
1253 print '</td>';
1254 }
1255
1256 // Contact
1257 if (!empty($arrayfields['a.fk_contact']['checked'])) {
1258 print '<td class="tdoverflowmax100">';
1259 if (!empty($actionstatic->socpeopleassigned)) { // $actionstatic->socpeopleassigned is loaded by $actionstatic->fetchResources() if property contact visible
1260 $contactList = array();
1261 foreach ($actionstatic->socpeopleassigned as $socpeopleassigned) {
1262 if (!isset($contactListCache[$socpeopleassigned['id']])) {
1263 // if no cache found we fetch it
1264 $contact = new Contact($db);
1265 if ($contact->fetch($socpeopleassigned['id']) > 0) {
1266 $contactListCache[$socpeopleassigned['id']] = $contact->getNomUrl(1, '', 0);
1267 $contactList[] = $contact->getNomUrl(1, '', 0);
1268 }
1269 } else {
1270 // use cache
1271 $contactList[] = $contactListCache[$socpeopleassigned['id']];
1272 }
1273 }
1274 if (!empty($contactList)) {
1275 print implode(', ', $contactList);
1276 }
1277 } elseif ($obj->fk_contact > 0) { // keep for retrocompatibility with faraway events (no more used)
1278 $tmpcontact = new Contact($db); // TODO Add a cache
1279 $tmpcontact->fetch($obj->fk_contact);
1280
1281 print $contactstatic->getNomUrl(1, '', 0);
1282 }
1283 print '</td>';
1284 }
1285
1286 // Linked object
1287 if (!empty($arrayfields['a.fk_element']['checked'])) {
1288 print '<td class="tdoverflowmax150 nowraponall">';
1289 if (isset($obj->elementtype) && !empty($obj->fk_element)) {
1290 if (isset($elementlinkcache[$obj->elementtype]) && isset($elementlinkcache[$obj->elementtype][$obj->fk_element])) {
1291 $link = $elementlinkcache[$obj->elementtype][$obj->fk_element];
1292 } else {
1293 if (!isset($elementlinkcache[$obj->elementtype])) {
1294 $elementlinkcache[$obj->elementtype] = array();
1295 }
1296 $link = dolGetElementUrl((int) $obj->fk_element, $obj->elementtype, 1);
1297 $elementlinkcache[$obj->elementtype][$obj->fk_element] = $link;
1298 }
1299 print $link;
1300 }
1301 print '</td>';
1302 }
1303
1304 // Extra fields
1305 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1306 // Fields from hook
1307 $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
1308 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
1309 print $hookmanager->resPrint;
1310
1311 // Date creation
1312 if (!empty($arrayfields['a.datec']['checked'])) {
1313 // Status/Percent
1314 print '<td class="center nowrap">'.dol_print_date($db->jdate($obj->datec), 'dayhour', 'tzuserrel').'</td>';
1315 }
1316 // Date update
1317 if (!empty($arrayfields['a.tms']['checked'])) {
1318 print '<td class="center nowrap">'.dol_print_date($db->jdate($obj->datem), 'dayhour', 'tzuserrel').'</td>';
1319 }
1320 // Import key
1321 if (!empty($arrayfields['a.import_key']['checked'])) {
1322 print '<td class="center nowrap">'.dolPrintHTML($obj->import_key).'</td>';
1323 }
1324 // Status/Percent
1325 if (!empty($arrayfields['a.percent']['checked'])) {
1326 $datep = $db->jdate($obj->dp);
1327 print '<td class="center nowrap">'.$actionstatic->LibStatut($obj->percent, 5, 0, $datep).'</td>';
1328 }
1329 // Action column
1330 if (!$conf->main_checkbox_left_column) {
1331 print '<td class="nowrap center">';
1332 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1333 $selected = 0;
1334 if (in_array($obj->id, $arrayofselected)) {
1335 $selected = 1;
1336 }
1337 print '<input id="cb'.$obj->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.'"'.($selected ? ' checked="checked"' : '').'>';
1338 }
1339 print '</td>';
1340 }
1341
1342 print '</tr>'."\n";
1343
1344 $i++;
1345}
1346// If no record found
1347if ($num == 0) {
1348 print '<tr><td colspan="'.$totalarray['nbfield'].'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1349}
1350
1351
1352print '</table>'."\n";
1353print '</div>'."\n";
1354
1355print '</form>'."\n";
1356
1357$db->free($resql);
1358
1359// End of page
1360llxFooter();
1361$db->close();
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
$totalarray
Definition list.php:501
print_actions_filter( $form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filtered, $pid, $socid, $action, $showextcals=array(), $actioncode='', $usergroupid=0, $excludetype='', $resourceid=0, $search_categ_cus=0, $search_import_key='')
Show filter form in agenda view.
calendars_prepare_head($param)
Define head array for tabs of agenda setup pages.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to manage agenda events (actions)
const EVENT_FINISHED
Typical value for a event that is in a finished state.
const EVENT_IN_PROGRESS
Typical value for a event that is in a progress state.
const EVENT_TODO
Typical value for a event that is in a todo state.
Class to manage different types of events.
Class to manage contact/addresses.
Class to manage building of HTML components.
Class to manage generation of HTML components Only common components must be here.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dolGetElementUrl($objectid, $objecttype, $withpicto=0, $option='')
Return link url to an object.
dol_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '...' if string larger than length.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dolPrintHTML($s, $allowiframe=0, $moreallowedtags=array())
Return a string (that can be on several lines) ready to be output on a HTML page.
Definition html.lib.php:73
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.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
print $langs trans('Date')." left Ref Label right Qty right Price right TotalHT right TotalTTC right right right right right right right right right centpercent right TotalHT right n right VAT right n right TotalVAT right n No sujeto a RE IRPF right TotalLT1 right n right TotalLT2 right n right TotalTTC right n takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency right TotalTTC takeposcustomercurrency right takeposcustomercurrency n right Paid right PaymentTypeShortLIQ right SELECT p pos_change as p datep as date
Definition receipt.php:487
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.