dolibarr  13.0.2
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 Frédéric France <frederic.france@netlogic.fr>
8  * Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <https://www.gnu.org/licenses/>.
22  */
23 
30 if (!defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1);
31 
32 require '../../main.inc.php';
33 require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
34 require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
36 require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
37 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
38 require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
39 
40 // Load translation files required by the page
41 $langs->loadLangs(array("users", "companies", "agenda", "commercial", "other", "orders", "bills"));
42 
43 $action = GETPOST('action', 'aZ09');
44 $massaction = GETPOST('massaction', 'alpha');
45 $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'actioncommlist'; // To manage different context of search
46 $resourceid = GETPOST("search_resourceid", "int") ?GETPOST("search_resourceid", "int") : GETPOST("resourceid", "int");
47 $pid = GETPOST("search_projectid", 'int', 3) ?GETPOST("search_projectid", 'int', 3) : GETPOST("projectid", 'int', 3);
48 $search_status = (GETPOST("search_status", 'alpha') != '') ?GETPOST("search_status", 'alpha') : GETPOST("status", 'alpha');
49 $type = GETPOST('search_type', 'alphanohtml') ?GETPOST('search_type', 'alphanohtml') : GETPOST('type', 'alphanohtml');
50 $optioncss = GETPOST('optioncss', 'alpha');
51 $year = GETPOST("year", 'int');
52 $month = GETPOST("month", 'int');
53 $day = GETPOST("day", 'int');
54 $toselect = GETPOST('toselect', 'array');
55 $confirm = GETPOST('confirm', 'alpha');
56 
57 // Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
58 if (GETPOST('search_actioncode', 'array'))
59 {
60  $actioncode = GETPOST('search_actioncode', 'array', 3);
61  if (!count($actioncode)) $actioncode = '0';
62 } else {
63  $actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
64 }
65 if ($actioncode == '' && empty($actioncodearray)) $actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE);
66 $search_id = GETPOST('search_id', 'alpha');
67 $search_title = GETPOST('search_title', 'alpha');
68 $search_note = GETPOST('search_note', 'alpha');
69 
70 $dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int'), 'tzuserrel');
71 $datestart = dol_mktime(0, 0, 0, GETPOST('datestartmonth', 'int'), GETPOST('datestartday', 'int'), GETPOST('datestartyear', 'int'), 'tzuserrel');
72 $dateend = dol_mktime(0, 0, 0, GETPOST('dateendmonth', 'int'), GETPOST('dateendday', 'int'), GETPOST('dateendyear', 'int'), 'tzuserrel');
73 if ($search_status == '' && !GETPOSTISSET('search_status')) $search_status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
74 if (empty($action) && !GETPOSTISSET('action')) $action = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
75 
76 $filter = GETPOST("search_filter", 'alpha', 3) ?GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
77 $filtert = GETPOST("search_filtert", "int", 3) ?GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3);
78 $usergroup = GETPOST("search_usergroup", "int", 3) ?GETPOST("search_usergroup", "int", 3) : GETPOST("usergroup", "int", 3);
79 $showbirthday = empty($conf->use_javascript_ajax) ? (GETPOST("search_showbirthday", "int") ?GETPOST("search_showbirthday", "int") : GETPOST("showbirthday", "int")) : 1;
80 
81 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
82 $object = new ActionComm($db);
83 $hookmanager->initHooks(array('agendalist'));
84 
85 $extrafields = new ExtraFields($db);
86 
87 // fetch optionals attributes and labels
88 $extrafields->fetch_name_optionals_label($object->table_element);
89 
90 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
91 // If not choice done on calendar owner, we filter on user.
92 if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS))
93 {
94  $filtert = $user->id;
95 }
96 
97 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
98 $sortfield = GETPOST("sortfield", 'alpha');
99 $sortorder = GETPOST("sortorder", 'alpha');
100 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
101 if ($page == -1 || $page == null) { $page = 0; }
102 $offset = $limit * $page;
103 if (!$sortorder)
104 {
105  $sortorder = "DESC,DESC";
106  if ($search_status == 'todo') $sortorder = "DESC,DESC";
107 }
108 if (!$sortfield)
109 {
110  $sortfield = "a.datep,a.id";
111  if ($search_status == 'todo') $sortfield = "a.datep,a.id";
112 }
113 
114 // Security check
115 $socid = GETPOST("search_socid", 'int') ?GETPOST("search_socid", 'int') : GETPOST("socid", 'int');
116 if ($user->socid) $socid = $user->socid;
117 $result = restrictedArea($user, 'agenda', 0, '', 'myactions');
118 if ($socid < 0) $socid = '';
119 
120 $canedit = 1;
121 if (!$user->rights->agenda->myactions->read) accessforbidden();
122 if (!$user->rights->agenda->allactions->read) $canedit = 0;
123 if (!$user->rights->agenda->allactions->read || $filter == 'mine') // If no permission to see all, we show only affected to me
124 {
125  $filtert = $user->id;
126 }
127 
128 $arrayfields = array(
129  'a.id'=>array('label'=>"Ref", 'checked'=>1),
130  'owner'=>array('label'=>"Owner", 'checked'=>1),
131  'c.libelle'=>array('label'=>"Type", 'checked'=>1),
132  'a.label'=>array('label'=>"Title", 'checked'=>1),
133  'a.note'=>array('label'=>'Description', 'checked'=>0),
134  'a.datep'=>array('label'=>"DateStart", 'checked'=>1),
135  'a.datep2'=>array('label'=>"DateEnd", 'checked'=>1),
136  's.nom'=>array('label'=>"ThirdParty", 'checked'=>1),
137  'a.fk_contact'=>array('label'=>"Contact", 'checked'=>0),
138  'a.fk_element'=>array('label'=>"LinkedObject", 'checked'=>1, 'enabled'=>(!empty($conf->global->AGENDA_SHOW_LINKED_OBJECT))),
139  'a.datec'=>array('label'=>'DateCreation', 'checked'=>0, 'position'=>510),
140  'a.tms'=>array('label'=>'DateModification', 'checked'=>0, 'position'=>520),
141  'a.percent'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000)
142 );
143 // Extra fields
144 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
145 
146 $object->fields = dol_sort_array($object->fields, 'position');
147 $arrayfields = dol_sort_array($arrayfields, 'position');
148 
149 //var_dump($_POST);exit;
150 
151 /*
152  * Actions
153  */
154 
155 if (GETPOST('cancel', 'alpha'))
156 {
157  $action = 'list'; $massaction = '';
158 }
159 
160 if (GETPOST("viewcal") || GETPOST("viewweek") || GETPOST("viewday"))
161 {
162  $param = '';
163  if (is_array($_POST))
164  {
165  foreach ($_POST as $key => $val)
166  {
167  $param .= '&'.$key.'='.urlencode($val);
168  }
169  }
170  //print $param;
171  header("Location: ".DOL_URL_ROOT.'/comm/action/index.php?'.$param);
172  exit;
173 }
174 
175 $parameters = array('id'=>$socid);
176 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
177 if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
178 
179 // Selection of new fields
180 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
181 // Purge search criteria
182 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
183 {
184  //$actioncode='';
185  $search_id = '';
186  $search_title = '';
187  $search_note = '';
188  $datestart = '';
189  $dateend = '';
190  $search_status = '';
191  $toselect = '';
192  $search_array_options = array();
193 }
194 
195 if (empty($reshook) && !empty($massaction))
196 {
197  unset($percent);
198 
199  switch ($massaction)
200  {
201  case 'set_all_events_to_todo':
202  $percent = ActionComm::EVENT_TODO;
203  break;
204 
205  case 'set_all_events_to_in_progress':
207  break;
208 
209  case 'set_all_events_to_finished':
210  $percent = ActionComm::EVENT_FINISHED;
211  break;
212  }
213 
214  if (isset($percent))
215  {
216  foreach ($toselect as $toselectid)
217  {
218  $result = $object->updatePercent($toselectid, $percent);
219  if ($result < 0)
220  {
221  dol_print_error($db);
222  break;
223  }
224  }
225  }
226 }
227 
228 // As mass deletion happens with a confirm step, $massaction is not use for the final step (deletion).
229 if (empty($reshook))
230 {
231  $objectclass = 'ActionComm';
232  $objectlabel = 'Events';
233  $uploaddir = true;
234  // Only users that can delete any event can remove records.
235  $permissiontodelete = $user->rights->agenda->allactions->delete;
236  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
237 }
238 
239 /*
240  * View
241  */
242 
243 $form = new Form($db);
244 $userstatic = new User($db);
245 $formactions = new FormActions($db);
246 
247 $nav = '';
248 $nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0);
249 $nav .= ' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">';
250 
251 $now = dol_now();
252 
253 $help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
254 llxHeader('', $langs->trans("Agenda"), $help_url);
255 
256 // Define list of all external calendars
257 $listofextcals = array();
258 
259 $param = '';
260 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
261 if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
262 if ($actioncode != '') {
263  if (is_array($actioncode)) {
264  foreach ($actioncode as $str_action) $param .= "&search_actioncode[]=".urlencode($str_action);
265  } else $param .= "&search_actioncode=".urlencode($actioncode);
266 }
267 if ($resourceid > 0) $param .= "&search_resourceid=".urlencode($resourceid);
268 if ($search_status != '' && $search_status > -1) $param .= "&search_status=".urlencode($search_status);
269 if ($filter) $param .= "&search_filter=".urlencode($filter);
270 if ($filtert) $param .= "&search_filtert=".urlencode($filtert);
271 if ($socid) $param .= "&search_socid=".urlencode($socid);
272 if ($showbirthday) $param .= "&search_showbirthday=1";
273 if ($pid) $param .= "&search_projectid=".urlencode($pid);
274 if ($type) $param .= "&search_type=".urlencode($type);
275 if ($usergroup) $param .= "&search_usergroup=".urlencode($usergroup);
276 if ($search_id != '') $param .= '&search_title='.urlencode($search_id);
277 if ($search_title != '') $param .= '&search_title='.urlencode($search_title);
278 if ($search_note != '') $param .= '&search_note='.$search_note;
279 if (GETPOST('datestartday', 'int')) $param .= '&datestartday='.GETPOST('datestartday', 'int');
280 if (GETPOST('datestartmonth', 'int')) $param .= '&datestartmonth='.GETPOST('datestartmonth', 'int');
281 if (GETPOST('datestartyear', 'int')) $param .= '&datestartyear='.GETPOST('datestartyear', 'int');
282 if (GETPOST('dateendday', 'int')) $param .= '&dateendday='.GETPOST('dateendday', 'int');
283 if (GETPOST('dateendmonth', 'int')) $param .= '&dateendmonth='.GETPOST('dateendmonth', 'int');
284 if (GETPOST('dateendyear', 'int')) $param .= '&dateendyear='.GETPOST('dateendyear', 'int');
285 if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
286 // Add $param from extra fields
287 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
288 
289 // List of mass actions available
290 $arrayofmassactions = array(
291  'set_all_events_to_todo' => $langs->trans("SetAllEventsToTodo"),
292  'set_all_events_to_in_progress' => $langs->trans("SetAllEventsToInProgress"),
293  'set_all_events_to_finished' => $langs->trans("SetAllEventsToFinished"),
294 );
295 if ($user->rights->agenda->allactions->delete)
296 {
297  $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
298 }
299 if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
300 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
301 
302 $sql = "SELECT";
303 if ($usergroup > 0) $sql .= " DISTINCT";
304 $sql .= " s.nom as societe, s.rowid as socid, s.client, s.email as socemail,";
305 $sql .= " a.id, a.code, a.label, a.note, a.datep as dp, a.datep2 as dp2, a.fulldayevent, a.location,";
306 $sql .= ' a.fk_user_author,a.fk_user_action,';
307 $sql .= " a.fk_contact, a.note, a.percent as percent,";
308 $sql .= " a.fk_element, a.elementtype, a.datec, a.tms as datem,";
309 $sql .= " c.code as type_code, c.libelle as type_label,";
310 $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";
311 
312 // Add fields from extrafields
313 if (!empty($extrafields->attributes[$object->table_element]['label'])) {
314  foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
315 }
316 
317 // Add fields from hooks
318 $parameters = array();
319 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
320 $sql .= $hookmanager->resPrint;
321 
322 $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
323 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_extrafields as ef ON (a.id = ef.fk_object) ";
324 if (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
325 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
326 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
327 $sql .= " ,".MAIN_DB_PREFIX."c_actioncomm as c";
328 // We must filter on resource table
329 if ($resourceid > 0) $sql .= ", ".MAIN_DB_PREFIX."element_resources as r";
330 // We must filter on assignement table
331 if ($filtert > 0 || $usergroup > 0) $sql .= ", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
332 if ($usergroup > 0) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
333 $sql .= " WHERE c.id = a.fk_action";
334 $sql .= ' AND a.entity IN ('.getEntity('agenda').')';
335 // Condition on actioncode
336 if (!empty($actioncode))
337 {
338  if (empty($conf->global->AGENDA_USE_EVENT_TYPE))
339  {
340  if ($actioncode == 'AC_NON_AUTO') $sql .= " AND c.type != 'systemauto'";
341  elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " AND c.type = 'systemauto'";
342  else {
343  if ($actioncode == 'AC_OTH') $sql .= " AND c.type != 'systemauto'";
344  if ($actioncode == 'AC_OTH_AUTO') $sql .= " AND c.type = 'systemauto'";
345  }
346  } else {
347  if ($actioncode == 'AC_NON_AUTO') $sql .= " AND c.type != 'systemauto'";
348  elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " AND c.type = 'systemauto'";
349  else {
350  if (is_array($actioncode))
351  {
352  $sql .= " AND c.code IN ('".implode("','", $actioncode)."')";
353  } else {
354  $sql .= " AND c.code IN ('".implode("','", explode(',', $actioncode))."')";
355  }
356  }
357  }
358 }
359 if ($resourceid > 0) $sql .= " AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid);
360 if ($pid) $sql .= " AND a.fk_project=".$db->escape($pid);
361 if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = ".$user->id.")";
362 if ($socid > 0) $sql .= " AND s.rowid = ".$socid;
363 // We must filter on assignement table
364 if ($filtert > 0 || $usergroup > 0) $sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
365 if ($type) $sql .= " AND c.id = ".(int) $type;
366 if ($search_status == '0') { $sql .= " AND a.percent = 0"; }
367 if ($search_status == '-1') { $sql .= " AND a.percent = -1"; } // Not applicable
368 if ($search_status == '50') { $sql .= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started
369 if ($search_status == '100') { $sql .= " AND a.percent = 100"; }
370 if ($search_status == 'done') { $sql .= " AND (a.percent = 100)"; }
371 if ($search_status == 'todo') { $sql .= " AND (a.percent >= 0 AND a.percent < 100)"; }
372 if ($search_id) $sql .= natural_search("a.id", $search_id, 1);
373 if ($search_title) $sql .= natural_search("a.label", $search_title);
374 if ($search_note) $sql .= natural_search('a.note', $search_note);
375 // We must filter on assignement table
376 if ($filtert > 0 || $usergroup > 0)
377 {
378  $sql .= " AND (";
379  if ($filtert > 0) $sql .= "(ar.fk_element = ".$filtert." OR (ar.fk_element IS NULL AND a.fk_user_action=".$filtert."))"; // The OR is for backward compatibility
380  if ($usergroup > 0) $sql .= ($filtert > 0 ? " OR " : "")." ugu.fk_usergroup = ".$usergroup;
381  $sql .= ")";
382 }
383 
384 // The second or of next test is to take event with no end date (we suppose duration is 1 hour in such case)
385 if ($dateselect > 0) $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)."'))";
386 if ($datestart > 0) $sql .= " AND a.datep BETWEEN '".$db->idate($datestart)."' AND '".$db->idate($datestart + 3600 * 24 - 1)."'";
387 if ($dateend > 0) $sql .= " AND a.datep2 BETWEEN '".$db->idate($dateend)."' AND '".$db->idate($dateend + 3600 * 24 - 1)."'";
388 
389 // Add where from extra fields
390 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
391 
392 // Add where from hooks
393 $parameters = array();
394 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
395 $sql .= $hookmanager->resPrint;
396 
397 $sql .= $db->order($sortfield, $sortorder);
398 
399 $nbtotalofrecords = '';
400 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
401 {
402  $result = $db->query($sql);
403  $nbtotalofrecords = $db->num_rows($result);
404  if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
405  {
406  $page = 0;
407  $offset = 0;
408  }
409 }
410 
411 $sql .= $db->plimit($limit + 1, $offset);
412 //print $sql;
413 
414 dol_syslog("comm/action/list.php", LOG_DEBUG);
415 $resql = $db->query($sql);
416 if ($resql)
417 {
418  $actionstatic = new ActionComm($db);
419  $societestatic = new Societe($db);
420 
421  $num = $db->num_rows($resql);
422 
423  $arrayofselected = is_array($toselect) ? $toselect : array();
424 
425  // Local calendar
426  $newtitle = '<div class="nowrap clear inline-block minheight30 margintoponly">';
427  $newtitle .= '<input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> '.$langs->trans("LocalAgenda").' &nbsp; ';
428  $newtitle .= '</div>';
429  //$newtitle=$langs->trans($title);
430 
431  $tabactive = 'cardlist';
432 
433  $head = calendars_prepare_head($param);
434 
435  print '<form method="POST" id="searchFormList" class="listactionsfilter" action="'.$_SERVER["PHP_SELF"].'">'."\n";
436 
437  if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
438  print '<input type="hidden" name="token" value="'.newToken().'">';
439  print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
440  print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
441  print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
442  print '<input type="hidden" name="type" value="'.$type.'">';
443  $nav = '';
444 
445  if ($filter) $nav .= '<input type="hidden" name="search_filter" value="'.$filter.'">';
446  if ($showbirthday) $nav .= '<input type="hidden" name="search_showbirthday" value="1">';
447  print $nav;
448 
449  //print dol_get_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
450  //print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid);
451  //print dol_get_fiche_end();
452 
453  // Add link to show birthdays
454  $link = '';
455  /*
456  if (empty($conf->use_javascript_ajax))
457  {
458  $newparam=$param; // newparam is for birthday links
459  $newparam=preg_replace('/showbirthday=[0-1]/i','showbirthday='.(empty($showbirthday)?1:0),$newparam);
460  if (! preg_match('/showbirthday=/i',$newparam)) $newparam.='&showbirthday=1';
461  $link='<a href="'.$_SERVER['PHP_SELF'];
462  $link.='?'.$newparam;
463  $link.='">';
464  if (empty($showbirthday)) $link.=$langs->trans("AgendaShowBirthdayEvents");
465  else $link.=$langs->trans("AgendaHideBirthdayEvents");
466  $link.='</a>';
467  }
468  */
469 
470  $s = $newtitle;
471 
472  // Calendars from hooks
473  $parameters = array(); $object = null;
474  $reshook = $hookmanager->executeHooks('addCalendarChoice', $parameters, $object, $action);
475  if (empty($reshook)) {
476  $s .= $hookmanager->resPrint;
477  } elseif ($reshook > 1) {
478  $s = $hookmanager->resPrint;
479  }
480 
481  $viewmode = '';
482  $viewmode .= '<a class="btnTitle btnTitleSelected reposition" href="'.DOL_URL_ROOT.'/comm/action/list.php?action=show_list&restore_lastsearch_values=1">';
483  //$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
484  $viewmode .= img_picto($langs->trans("List"), 'object_list-alt', 'class="pictoactionview block"');
485  //$viewmode .= '</span>';
486  $viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewList").'</span></a>';
487 
488  $viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
489  //$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
490  $viewmode .= img_picto($langs->trans("ViewCal"), 'object_calendar', 'class="pictoactionview block"');
491  //$viewmode .= '</span>';
492  $viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewCal").'</span></a>';
493 
494  $viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
495  //$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
496  $viewmode .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview block"');
497  //$viewmode .= '</span>';
498  $viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewWeek").'</span></a>';
499 
500  $viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
501  //$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
502  $viewmode .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview block"');
503  //$viewmode .= '</span>';
504  $viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewDay").'</span></a>';
505 
506  $viewmode .= '<a class="btnTitle reposition marginrightonly" href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
507  //$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
508  $viewmode .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview block"');
509  //$viewmode .= '</span>';
510  $viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewPerUser").'</span></a>';
511 
512  $viewmode .= '<span class="marginrightonly"></span>';
513 
514  // Add more views from hooks
515  $parameters = array(); $object = null;
516  $reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action);
517  if (empty($reshook)) {
518  $viewmode .= $hookmanager->resPrint;
519  } elseif ($reshook > 1) {
520  $viewmode = $hookmanager->resPrint;
521  }
522 
523  $tmpforcreatebutton = dol_getdate(dol_now(), true);
524 
525  $newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year'];
526 
527  //$param='month='.$monthshown.'&year='.$year;
528  $hourminsec = '100000';
529 
530  $url = DOL_URL_ROOT.'/comm/action/card.php?action=create';
531  $url .= '&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec;
532  $url .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : ''));
533 
534  $newcardbutton = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, '', $user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create);
535 
536  $param .= '&action='.$action;
537 
538  print_barre_liste($langs->trans("Agenda"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, -1 * $nbtotalofrecords, 'object_action', 0, $nav.$newcardbutton, '', $limit, 0, 0, 1, $viewmode);
539 
540  print $s;
541 
542  include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
543 
544  $moreforfilter = '';
545 
546  $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
547  $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
548  if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
549  $i = 0;
550 
551  print '<div class="liste_titre liste_titre_bydiv centpercent">';
552  print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid);
553  print '</div>';
554 
555  print '<div class="div-table-responsive">';
556  print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
557 
558  print '<tr class="liste_titre_filter">';
559  if (!empty($arrayfields['a.id']['checked'])) print '<td class="liste_titre"><input type="text" class="maxwidth50" name="search_id" value="'.$search_id.'"></td>';
560  if (!empty($arrayfields['owner']['checked'])) print '<td class="liste_titre"></td>';
561  if (!empty($arrayfields['c.libelle']['checked'])) print '<td class="liste_titre"></td>';
562  if (!empty($arrayfields['a.label']['checked'])) print '<td class="liste_titre"><input type="text" class="maxwidth75" name="search_title" value="'.$search_title.'"></td>';
563  if (!empty($arrayfields['a.note']['checked'])) print '<td class="liste_titre"><input type="text" class="maxwidth75" name="search_note" value="'.$search_note.'"></td>';
564  if (!empty($arrayfields['a.datep']['checked'])) {
565  print '<td class="liste_titre nowraponall" align="center">';
566  print $form->selectDate($datestart, 'datestart', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
567  print '</td>';
568  }
569  if (!empty($arrayfields['a.datep2']['checked'])) {
570  print '<td class="liste_titre nowraponall" align="center">';
571  print $form->selectDate($dateend, 'dateend', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
572  print '</td>';
573  }
574  if (!empty($arrayfields['s.nom']['checked'])) {
575  print '<td class="liste_titre"></td>';
576  }
577  if (!empty($arrayfields['a.fk_contact']['checked'])) print '<td class="liste_titre"></td>';
578  if (!empty($arrayfields['a.fk_element']['checked'])) print '<td class="liste_titre"></td>';
579 
580  // Extra fields
581  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
582 
583  // Fields from hook
584  $parameters = array('arrayfields'=>$arrayfields);
585  $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
586  print $hookmanager->resPrint;
587 
588  if (!empty($arrayfields['a.datec']['checked'])) print '<td class="liste_titre"></td>';
589  if (!empty($arrayfields['a.tms']['checked'])) print '<td class="liste_titre"></td>';
590  if (!empty($arrayfields['a.percent']['checked'])) {
591  print '<td class="liste_titre center">';
592  $formactions->form_select_status_action('formaction', $search_status, 1, 'search_status', 1, 2, 'minwidth100imp maxwidth125');
593  print ajax_combobox('selectsearch_status');
594  print '</td>';
595  }
596  // Action column
597  print '<td class="liste_titre" align="middle">';
598  $searchpicto = $form->showFilterButtons();
599  print $searchpicto;
600  print '</td>';
601  print "</tr>\n";
602 
603  print '<tr class="liste_titre">';
604  if (!empty($arrayfields['a.id']['checked'])) print_liste_field_titre($arrayfields['a.id']['label'], $_SERVER["PHP_SELF"], "a.id", $param, "", "", $sortfield, $sortorder);
605  if (!empty($arrayfields['owner']['checked'])) print_liste_field_titre($arrayfields['owner']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder);
606  if (!empty($arrayfields['c.libelle']['checked'])) print_liste_field_titre($arrayfields['c.libelle']['label'], $_SERVER["PHP_SELF"], "c.libelle", $param, "", "", $sortfield, $sortorder);
607  if (!empty($arrayfields['a.label']['checked'])) print_liste_field_titre($arrayfields['a.label']['label'], $_SERVER["PHP_SELF"], "a.label", $param, "", "", $sortfield, $sortorder);
608  if (!empty($arrayfields['a.note']['checked'])) print_liste_field_titre($arrayfields['a.note']['label'], $_SERVER["PHP_SELF"], "a.note", $param, "", "", $sortfield, $sortorder);
609  //if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
610  if (!empty($arrayfields['a.datep']['checked'])) print_liste_field_titre($arrayfields['a.datep']['label'], $_SERVER["PHP_SELF"], "a.datep,a.id", $param, '', 'align="center"', $sortfield, $sortorder);
611  if (!empty($arrayfields['a.datep2']['checked'])) print_liste_field_titre($arrayfields['a.datep2']['label'], $_SERVER["PHP_SELF"], "a.datep2", $param, '', 'align="center"', $sortfield, $sortorder);
612  if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", $param, "", "", $sortfield, $sortorder);
613  if (!empty($arrayfields['a.fk_contact']['checked'])) print_liste_field_titre($arrayfields['a.fk_contact']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder);
614  if (!empty($arrayfields['a.fk_element']['checked'])) print_liste_field_titre($arrayfields['a.fk_element']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder);
615 
616  // Extra fields
617  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
618 
619  // Hook fields
620  $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
621  $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
622  print $hookmanager->resPrint;
623 
624  if (!empty($arrayfields['a.datec']['checked'])) print_liste_field_titre($arrayfields['a.datec']['label'], $_SERVER["PHP_SELF"], "a.datec,a.id", $param, "", 'align="center"', $sortfield, $sortorder);
625  if (!empty($arrayfields['a.tms']['checked'])) print_liste_field_titre($arrayfields['a.tms']['label'], $_SERVER["PHP_SELF"], "a.tms,a.id", $param, "", 'align="center"', $sortfield, $sortorder);
626 
627  if (!empty($arrayfields['a.percent']['checked']))print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "a.percent", $param, "", 'align="center"', $sortfield, $sortorder);
628  print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
629  print "</tr>\n";
630 
631  $contactstatic = new Contact($db);
632  $now = dol_now();
633  $delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60;
634 
635  require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
636  $caction = new CActionComm($db);
637  $arraylist = $caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0), '', 1);
638  $contactListCache = array();
639 
640  while ($i < min($num, $limit))
641  {
642  $obj = $db->fetch_object($resql);
643 
644  // Discard auto action if option is on
645  if (!empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->type_code == 'AC_OTH_AUTO')
646  {
647  $i++;
648  continue;
649  }
650 
651  $actionstatic->id = $obj->id;
652  $actionstatic->ref = $obj->id;
653  $actionstatic->code = $obj->code;
654  $actionstatic->type_code = $obj->type_code;
655  $actionstatic->type_label = $obj->type_label;
656  $actionstatic->type_picto = $obj->type_picto;
657  $actionstatic->label = $obj->label;
658  $actionstatic->location = $obj->location;
659  $actionstatic->note_private = dol_htmlentitiesbr($obj->note);
660 
661  $actionstatic->fetchResources();
662 
663  print '<tr class="oddeven">';
664 
665  // Ref
666  if (!empty($arrayfields['a.id']['checked'])) {
667  print '<td>';
668  print $actionstatic->getNomUrl(1, -1);
669  print '</td>';
670  }
671 
672  // User owner
673  if (!empty($arrayfields['owner']['checked']))
674  {
675  print '<td class="tdoverflowmax150">'; // With edge and chrome the td overflow is not supported correctly when content is not full text.
676  if ($obj->fk_user_action > 0)
677  {
678  $userstatic->fetch($obj->fk_user_action);
679  print $userstatic->getNomUrl(-1);
680  } else print '&nbsp;';
681  print '</td>';
682  }
683 
684  // Type
685  if (!empty($arrayfields['c.libelle']['checked']))
686  {
687  print '<td class="nowraponall">';
688  $actioncomm = $actionstatic;
689  // TODO Code common with code into showactions
690  $imgpicto = '';
691  if (!empty($conf->global->AGENDA_USE_EVENT_TYPE))
692  {
693  if ($actioncomm->type_picto) {
694  $imgpicto = img_picto('', $actioncomm->type_picto);
695  } else {
696  if ($actioncomm->type_code == 'AC_RDV') $imgpicto = img_picto('', 'object_group', '', false, 0, 0, '', 'paddingright').' ';
697  elseif ($actioncomm->type_code == 'AC_TEL') $imgpicto = img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright').' ';
698  elseif ($actioncomm->type_code == 'AC_FAX') $imgpicto = img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright').' ';
699  elseif ($actioncomm->type_code == 'AC_EMAIL' || $actioncomm->type_code == 'AC_EMAIL_IN') $imgpicto = img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright').' ';
700  elseif ($actioncomm->type_code == 'AC_INT') $imgpicto = img_picto('', 'object_intervention', '', false, 0, 0, '', 'paddingright').' ';
701  elseif ($actioncomm->type_code == 'AC_OTH' && $actioncomm->code == 'TICKET_MSG') $imgpicto = img_picto('', 'object_conversation', '', false, 0, 0, '', 'paddingright').' ';
702  elseif (!preg_match('/_AUTO/', $actioncomm->type_code)) $imgpicto = img_picto('', 'object_other', '', false, 0, 0, '', 'paddingright').' ';
703  }
704  }
705  print $imgpicto;
706 
707  $labeltype = $obj->type_code;
708  if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) $labeltype = 'AC_OTH';
709  if ($actioncomm->type_code == 'AC_OTH' && $actioncomm->code == 'TICKET_MSG') {
710  $labeltype = $langs->trans("Message");
711  } else {
712  if (!empty($arraylist[$labeltype])) $labeltype = $arraylist[$labeltype];
713  if ($obj->type_code == 'AC_OTH_AUTO' && ($obj->type_code != $obj->code) && $labeltype && !empty($arraylist[$obj->code])) $labeltype .= ' - '.$arraylist[$obj->code]; // Use code in priority on type_code
714  }
715  print dol_trunc($labeltype, 28);
716  print '</td>';
717  }
718 
719  // Label
720  if (!empty($arrayfields['a.label']['checked'])) {
721  print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($actionstatic->label).'">';
722  print $actionstatic->label;
723  print '</td>';
724  }
725 
726  // Description
727  if (!empty($arrayfields['a.note']['checked'])) {
728  print '<td class="tdoverflowonsmartphone">';
729  $text = dolGetFirstLineOfText(dol_string_nohtmltag($actionstatic->note_private, 0));
730  print $form->textwithtooltip(dol_trunc($text, 40), $actionstatic->note_private);
731  print '</td>';
732  }
733 
734  $formatToUse = $obj->fulldayevent ? 'day' : 'dayhour';
735 
736  // Start date
737  if (!empty($arrayfields['a.datep']['checked'])) {
738  print '<td class="center nowraponall">';
739  print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuser');
740  $late = 0;
741  if ($obj->percent == 0 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) $late = 1;
742  if ($obj->percent == 0 && !$obj->dp && $obj->dp2 && $db->jdate($obj->dp) < ($now - $delay_warning)) $late = 1;
743  if ($obj->percent > 0 && $obj->percent < 100 && $obj->dp2 && $db->jdate($obj->dp2) < ($now - $delay_warning)) $late = 1;
744  if ($obj->percent > 0 && $obj->percent < 100 && !$obj->dp2 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) $late = 1;
745  if ($late) print img_warning($langs->trans("Late")).' ';
746  print '</td>';
747  }
748 
749  // End date
750  if (!empty($arrayfields['a.datep2']['checked'])) {
751  print '<td class="center nowraponall">';
752  print dol_print_date($db->jdate($obj->dp2), $formatToUse, 'tzuser');
753  print '</td>';
754  }
755 
756  // Third party
757  if (!empty($arrayfields['s.nom']['checked'])) {
758  print '<td class="tdoverflowmax150">';
759  if ($obj->socid > 0)
760  {
761  $societestatic->id = $obj->socid;
762  $societestatic->client = $obj->client;
763  $societestatic->name = $obj->societe;
764  $societestatic->email = $obj->socemail;
765 
766  print $societestatic->getNomUrl(1, '', 28);
767  } else print '&nbsp;';
768  print '</td>';
769  }
770 
771  // Contact
772  if (!empty($arrayfields['a.fk_contact']['checked'])) {
773  print '<td class="tdoverflowmax100">';
774 
775  if (!empty($actionstatic->socpeopleassigned))
776  {
777  $contactList = array();
778  foreach ($actionstatic->socpeopleassigned as $socpeopleassigned)
779  {
780  if (!isset($contactListCache[$socpeopleassigned['id']]))
781  {
782  // if no cache found we fetch it
783  $contact = new Contact($db);
784  if ($contact->fetch($socpeopleassigned['id']) > 0)
785  {
786  $contactListCache[$socpeopleassigned['id']] = $contact->getNomUrl(1, '', 0);
787  $contactList[] = $contact->getNomUrl(1, '', 0);
788  }
789  } else {
790  // use cache
791  $contactList[] = $contactListCache[$socpeopleassigned['id']];
792  }
793  }
794  if (!empty($contactList)) {
795  print implode(', ', $contactList);
796  }
797  } elseif ($obj->fk_contact > 0) //keep for retrocompatibility with faraway event
798  {
799  $contactstatic->id = $obj->fk_contact;
800  $contactstatic->email = $obj->email;
801  $contactstatic->lastname = $obj->lastname;
802  $contactstatic->firstname = $obj->firstname;
803  $contactstatic->phone_pro = $obj->phone_pro;
804  $contactstatic->phone_mobile = $obj->phone_mobile;
805  $contactstatic->phone_perso = $obj->phone_perso;
806  $contactstatic->country_id = $obj->country_id;
807  print $contactstatic->getNomUrl(1, '', 0);
808  } else {
809  print "&nbsp;";
810  }
811  print '</td>';
812  }
813 
814  // Linked object
815  if (!empty($arrayfields['a.fk_element']['checked'])) {
816  print '<td class="tdoverflowmax150">';
817  //var_dump($obj->fkelement.' '.$obj->elementtype);
818  if ($obj->fk_element > 0 && !empty($obj->elementtype)) {
819  include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
820  print dolGetElementUrl($obj->fk_element, $obj->elementtype, 1);
821  } else {
822  print "&nbsp;";
823  }
824  print '</td>';
825  }
826 
827  // Extra fields
828  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
829  // Fields from hook
830  $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
831  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
832  print $hookmanager->resPrint;
833 
834  // Date creation
835  if (!empty($arrayfields['a.datec']['checked'])) {
836  // Status/Percent
837  print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($obj->datec), 'dayhour', 'tzuser').'</td>';
838  }
839  // Date update
840  if (!empty($arrayfields['a.tms']['checked'])) {
841  print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($obj->datem), 'dayhour', 'tzuser').'</td>';
842  }
843  if (!empty($arrayfields['a.percent']['checked'])) {
844  // Status/Percent
845  $datep = $db->jdate($obj->datep);
846  print '<td align="center" class="nowrap">'.$actionstatic->LibStatut($obj->percent, 5, 0, $datep).'</td>';
847  }
848  // Action column
849  print '<td class="nowrap center">';
850  if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
851  {
852  $selected = 0;
853  if (in_array($obj->id, $arrayofselected)) $selected = 1;
854  print '<input id="cb'.$obj->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.'"'.($selected ? ' checked="checked"' : '').'>';
855  }
856  print '</td>';
857 
858  print "</tr>\n";
859  $i++;
860  }
861  print "</table>";
862  print '</div>';
863  print '</form>';
864 
865  $db->free($resql);
866 } else {
867  dol_print_error($db);
868 }
869 
870 // End of page
871 llxFooter();
872 $db->close();
Class to manage different types of events.
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto= 'UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
if(preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if(preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) if($action== 'set') elseif($action== 'specimen') elseif($action== 'setmodel') elseif($action== 'del') elseif($action== 'setdoc') $formactions
View.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
Class to manage building of HTML components.
if(!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'] country if(!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'] typent code
Definition: list.php:566
Class to manage agenda events (actions)
Class to manage contact/addresses.
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.
const EVENT_FINISHED
Typical value for a event that is in a finished state.
dol_now($mode= 'auto')
Return date for now.
calendars_prepare_head($param)
Define head array for tabs of agenda setup pages.
Definition: agenda.lib.php:466
Class to manage Dolibarr users.
Definition: user.class.php:44
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete= 'resolve')
Convert a html select field into an ajax combobox.
Definition: ajax.lib.php:391
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...
img_warning($titlealt= 'default', $moreatt= '', $morecss= 'pictowarning')
Show warning logo.
llxHeader()
Empty header.
Definition: wrapper.php:45
Class to manage standard extra fields.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options= '', $sortfield= '', $sortorder= '', $morehtmlcenter= '', $num=-1, $totalnboflines= '', $picto= 'generic', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow= '')
Print a title with navigation controls for pagination.
Class to manage generation of HTML components Only common components must be here.
const EVENT_IN_PROGRESS
Typical value for a event that is in a progress state.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it&#39;s its name (generic function)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
const EVENT_TODO
Typical value for a event that is in a todo state.
dol_getdate($timestamp, $fast=false, $forcetimezone= '')
Return an array with locale date info.
print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $action, $showextcals=array(), $actioncode= '', $usergroupid= '', $excludetype= '', $resourceid=0)
Show filter form in agenda view.
Definition: agenda.lib.php:50
if(!GETPOST('transkey', 'alphanohtml')&&!GETPOST('transphrase', 'alphanohtml')) else
View.
Definition: notice.php:44
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=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 Calling this function terminate execution ...
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
print $_SERVER["PHP_SELF"]
Edit parameters.
dolGetFirstLineOfText($text, $nboflines=1, $charset= 'UTF-8')
Return first line of text.
dol_sort_array(&$array, $index, $order= 'asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
print
Draft customers invoices.
Definition: index.php:89
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1232
dol_print_error($db= '', $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 &#39;...&#39; if string larger than length.
llxFooter()
Empty footer.
Definition: wrapper.php:59
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition: repair.php:105
dolGetElementUrl($objectid, $objecttype, $withpicto=0, $option= '')
Return link url to an object.