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