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