dolibarr  19.0.0-dev
conferenceorboothattendee_list.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2021 Florian Henry <florian.henry@scopen.fr>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 
26 // Load Dolibarr environment
27 require '../main.inc.php';
28 
29 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
33 
34 require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
35 require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php';
36 require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php';
37 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
38 if (isModEnabled('categorie')) {
39  require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
40 }
41 
42 global $dolibarr_main_url_root;
43 
44 // Load translation files required by the page
45 $langs->loadLangs(array("eventorganization", "other", "projects", "bills"));
46 
47 // Get Paramters
48 $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
49 $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
50 $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
51 $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
52 $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
53 $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
54 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
55 $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
56 $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
57 $mode = GETPOST('mode', 'aZ');
58 
59 $id = GETPOST('id', 'int');
60 $conf_or_booth_id = GETPOST('conforboothid', 'int');
61 
62 $withproject = GETPOST('withproject', 'int');
63 $fk_project = GETPOST('fk_project', 'int') ? GETPOST('fk_project', 'int') : GETPOST('projectid', 'int');
64 $projectid = $fk_project;
65 
66 $withProjectUrl='';
67 
68 // Load variable for pagination
69 $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
70 $sortfield = GETPOST('sortfield', 'aZ09comma');
71 $sortorder = GETPOST('sortorder', 'aZ09comma');
72 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
73 if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
74  // If $page is not defined, or '' or -1 or if we click on clear filters
75  $page = 0;
76 }
77 $offset = $limit * $page;
78 $pageprev = $page - 1;
79 $pagenext = $page + 1;
80 
81 // Initialize technical objects
82 $object = new ConferenceOrBoothAttendee($db);
83 $extrafields = new ExtraFields($db);
84 $projectstatic = new Project($db);
85 $diroutputmassaction = $conf->eventorganization->dir_output.'/temp/massgeneration/'.$user->id;
86 $hookmanager->initHooks(array('conferenceorboothattendeelist')); // Note that conf->hooks_modules contains array
87 
88 // Fetch optionals attributes and labels
89 $extrafields->fetch_name_optionals_label($object->table_element);
90 //$extrafields->fetch_name_optionals_label($object->table_element_line);
91 
92 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
93 
94 // Default sort order (if not yet defined by previous GETPOST)
95 if (!$sortfield) {
96  reset($object->fields); // Reset is required to avoid key() to return null.
97  $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
98 }
99 if (!$sortorder) {
100  $sortorder = "ASC";
101 }
102 
103 // Initialize array of search criterias
104 $search_all = GETPOST('search_all', 'alphanohtml');
105 $search = array();
106 foreach ($object->fields as $key => $val) {
107  if (GETPOST('search_'.$key, 'alpha') !== '') {
108  $search[$key] = GETPOST('search_'.$key, 'alpha');
109  }
110  if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
111  $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
112  $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
113  }
114 }
115 
116 // List of fields to search into when doing a "search in all"
117 $fieldstosearchall = array();
118 foreach ($object->fields as $key => $val) {
119  if (!empty($val['searchall'])) {
120  $fieldstosearchall['t.'.$key] = $val['label'];
121  }
122 }
123 
124 // Definition of array of fields for columns
125 $arrayfields = array();
126 foreach ($object->fields as $key => $val) {
127  // If $val['visible']==0, then we never show the field
128  if (!empty($val['visible'])) {
129  $visible = (int) dol_eval($val['visible'], 1);
130  $arrayfields['t.'.$key] = array(
131  'label'=>$val['label'],
132  'checked'=>(($visible < 0) ? 0 : 1),
133  'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
134  'position'=>$val['position'],
135  'help'=> isset($val['help']) ? $val['help'] : ''
136  );
137  }
138 }
139 // Extra fields
140 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
141 
142 $object->fields = dol_sort_array($object->fields, 'position');
143 $arrayfields = dol_sort_array($arrayfields, 'position');
144 
145 // Permissions
146 $permissiontoread = $user->rights->eventorganization->read;
147 $permissiontoadd = $user->rights->eventorganization->write;
148 $permissiontodelete = $user->rights->eventorganization->delete;
149 
150 // Security check
151 if (empty($conf->eventorganization->enabled)) {
152  accessforbidden('Module not enabled');
153 }
154 $socid = 0;
155 if ($user->socid > 0) { // Protection if external user
156  //$socid = $user->socid;
157  accessforbidden();
158 }
159 $result = restrictedArea($user, 'eventorganization');
160 if (!$permissiontoread) accessforbidden();
161 
162 
163 /*
164  * Actions
165  */
166 
167 if (preg_match('/^set/', $action) && $projectid > 0 && !empty($user->rights->eventorganization->write)) {
168  $project = new Project($db);
169  //If "set" fields keys is in projects fields
170  $project_attr=preg_replace('/^set/', '', $action);
171  if (array_key_exists($project_attr, $project->fields)) {
172  $result = $project->fetch($projectid);
173  if ($result < 0) {
174  setEventMessages(null, $project->errors, 'errors');
175  } else {
176  $project->{$project_attr}=GETPOST($project_attr);
177  $result=$project->update($user);
178  if ($result < 0) {
179  setEventMessages(null, $project->errors, 'errors');
180  }
181  }
182  }
183 }
184 
185 if (GETPOST('cancel', 'alpha')) {
186  $action = 'list';
187  $massaction = '';
188 }
189 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
190  $massaction = '';
191 }
192 
193 $parameters = array();
194 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
195 if ($reshook < 0) {
196  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
197 }
198 
199 if (empty($reshook)) {
200  // Selection of new fields
201  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
202 
203  // Purge search criteria
204  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
205  foreach ($object->fields as $key => $val) {
206  $search[$key] = '';
207  if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
208  $search[$key.'_dtstart'] = '';
209  $search[$key.'_dtend'] = '';
210  }
211  }
212  $toselect = array();
213  $search_array_options = array();
214  }
215  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
216  || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
217  $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
218  }
219 
220  // Mass actions
221  $objectclass = 'ConferenceOrBoothAttendee';
222  $objectlabel = 'ConferenceOrBoothAttendee';
223  $uploaddir = $conf->eventorganization->dir_output;
224  include DOL_DOCUMENT_ROOT.'/eventorganization/core/actions_massactions_mail.inc.php';
225  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
226 }
227 
228 
229 
230 /*
231  * View
232  */
233 
234 $form = new Form($db);
235 $now = dol_now();
236 
237 //$help_url="EN:Module_ConferenceOrBoothAttendee|FR:Module_ConferenceOrBoothAttendee_FR|ES:Módulo_ConferenceOrBoothAttendee";
238 $help_url = '';
239 $morejs = array();
240 $morecss = array();
241 
242 $confOrBooth = new ConferenceOrBooth($db);
243 if ($conf_or_booth_id > 0) {
244  $result = $confOrBooth->fetch($conf_or_booth_id);
245  if ($result < 0) {
246  setEventMessages(null, $confOrBooth->errors, 'errors');
247  } else {
248  $fk_project = $confOrBooth->fk_project;
249  }
250 }
251 
252 if ($fk_project > 0) {
253  $result = $projectstatic->fetch($fk_project);
254  if ($result < 0) {
255  setEventMessages(null, $projectstatic->errors, 'errors');
256  }
257 }
258 
259 
260 // Build and execute select
261 // --------------------------------------------------------------------
262 $sql = 'SELECT ';
263 $sql .= $object->getFieldList('t');
264 // Add fields from extrafields
265 if (!empty($extrafields->attributes[$object->table_element]['label'])) {
266  foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
267  $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
268  }
269 }
270 // Add fields from hooks
271 $parameters = array();
272 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
273 $sql .= $hookmanager->resPrint;
274 $sql = preg_replace('/,\s*$/', '', $sql);
275 //$sql .= ", COUNT(rc.rowid) as anotherfield";
276 
277 $sqlfields = $sql; // $sql fields to remove for count total
278 
279 $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
280 if (!empty($confOrBooth->id)) {
281  $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm as a on a.id=t.fk_actioncomm AND a.id=".((int) $confOrBooth->id);
282 }
283 if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
284  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
285 }
286 // Add table from hooks
287 $parameters = array();
288 $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
289 $sql .= $hookmanager->resPrint;
290 if ($object->ismultientitymanaged == 1) {
291  $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
292 } else {
293  $sql .= " WHERE 1 = 1";
294 }
295 if (!empty($projectstatic->id)) {
296  $sql .= " AND t.fk_project = ".((int) $projectstatic->id);
297 }
298 foreach ($search as $key => $val) {
299  if (array_key_exists($key, $object->fields)) {
300  if ($key == 'status' && $search[$key] == -1) {
301  continue;
302  }
303  $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
304  if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
305  if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
306  $search[$key] = '';
307  }
308  $mode_search = 2;
309  }
310  if ($search[$key] != '') {
311  $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
312  }
313  } else {
314  if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
315  $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
316  if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
317  if (preg_match('/_dtstart$/', $key)) {
318  $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'";
319  }
320  if (preg_match('/_dtend$/', $key)) {
321  $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'";
322  }
323  }
324  }
325  }
326 }
327 if ($search_all) {
328  $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
329 }
330 //$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
331 // Add where from extra fields
332 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
333 // Add where from hooks
334 $parameters = array();
335 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
336 $sql .= $hookmanager->resPrint;
337 
338 
339 // Count total nb of records
340 $nbtotalofrecords = '';
341 if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
342  /* The fast and low memory method to get and count full list converts the sql into a sql count */
343  $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
344  $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
345  $resql = $db->query($sqlforcount);
346  if ($resql) {
347  $objforcount = $db->fetch_object($resql);
348  $nbtotalofrecords = $objforcount->nbtotalofrecords;
349  } else {
350  dol_print_error($db);
351  }
352 
353  if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
354  $page = 0;
355  $offset = 0;
356  }
357  $db->free($resql);
358 }
359 
360 // Complete request and execute it with limit
361 $sql .= $db->order($sortfield, $sortorder);
362 if ($limit) {
363  $sql .= $db->plimit($limit + 1, $offset);
364 }
365 
366 $resql = $db->query($sql);
367 if (!$resql) {
368  dol_print_error($db);
369  exit;
370 }
371 
372 $num = $db->num_rows($resql);
373 
374 // Direct jump if only one record found
375 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
376  $obj = $db->fetch_object($resql);
377  $id = $obj->rowid;
378  header("Location: ".DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?id='.((int) $id));
379  exit;
380 }
381 
382 if ($confOrBooth->id > 0) {
383  $title = $langs->trans('ListOfAttendeesPerConference');
384 } else {
385  $title = $langs->trans('ListOfAttendeesOfEvent');
386 }
387 
388 // Output page
389 // --------------------------------------------------------------------
390 
391 llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs');
392 
393 
394 
395 if ($projectstatic->id > 0 || $confOrBooth > 0) {
396  if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) {
397  $projectstatic->fetchComments();
398  }
399  if (!empty($projectstatic->socid)) {
400  $projectstatic->fetch_thirdparty();
401  }
402 
403  $withProjectUrl='';
404  $object->project = clone $projectstatic;
405 
406  if (!empty($withproject)) {
407  // Tabs for project
408  $tab = 'eventorganisation';
409  $withProjectUrl = "&withproject=1";
410  $head = project_prepare_head($projectstatic);
411 
412  print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'), 0, '', '');
413 
414  $param = ($mode == 'mine' ? '&mode=mine' : '');
415 
416  // Project card
417 
418  $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
419 
420  $morehtmlref = '<div class="refidno">';
421  // Title
422  $morehtmlref .= $projectstatic->title;
423  // Thirdparty
424  if (!empty($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) {
425  $morehtmlref .= '<br>'.$projectstatic->thirdparty->getNomUrl(1, 'project');
426  }
427  $morehtmlref .= '</div>';
428 
429  // Define a complementary filter for search of next/prev ref.
430  if (empty($user->rights->projet->all->lire)) {
431  $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
432  $projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
433  }
434 
435  dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
436 
437  print '<div class="fichecenter">';
438  print '<div class="fichehalfleft">';
439  print '<div class="underbanner clearboth"></div>';
440 
441  print '<table class="border tableforfield centpercent">';
442 
443  // Usage
444  if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled('eventorganization')) {
445  print '<tr><td class="tdtop">';
446  print $langs->trans("Usage");
447  print '</td>';
448  print '<td>';
449  if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
450  print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_opportunity ? ' checked="checked"' : '')).'"> ';
451  $htmltext = $langs->trans("ProjectFollowOpportunity");
452  print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
453  print '<br>';
454  }
455  if (empty($conf->global->PROJECT_HIDE_TASKS)) {
456  print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_task ? ' checked="checked"' : '')).'"> ';
457  $htmltext = $langs->trans("ProjectFollowTasks");
458  print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
459  print '<br>';
460  }
461  if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
462  print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_bill_time ? ' checked="checked"' : '')).'"> ';
463  $htmltext = $langs->trans("ProjectBillTimeDescription");
464  print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
465  print '<br>';
466  }
467  if (isModEnabled('eventorganization')) {
468  print '<input type="checkbox" disabled name="usage_organize_event"'.(GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_organize_event ? ' checked="checked"' : '')).'"> ';
469  $htmltext = $langs->trans("EventOrganizationDescriptionLong");
470  print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
471  }
472  print '</td></tr>';
473  }
474 
475  // Visibility
476  print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
477  if ($projectstatic->public == 0) {
478  print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"');
479  print $langs->trans("PrivateProject");
480  } else {
481  print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"');
482  print $langs->trans("SharedProject");
483  }
484  print '</td></tr>';
485 
486  // Budget
487  print '<tr><td>'.$langs->trans("Budget").'</td><td>';
488  if (strcmp($projectstatic->budget_amount, '')) {
489  print '<span class="amount">'.price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency).'</span>';
490  }
491  print '</td></tr>';
492 
493  // Date start - end project
494  print '<tr><td>'.$langs->trans("Dates").' ('.$langs->trans("Project").')</td><td>';
495  $start = dol_print_date($projectstatic->date_start, 'day');
496  print ($start ? $start : '?');
497  $end = dol_print_date($projectstatic->date_end, 'day');
498  print ' - ';
499  print ($end ? $end : '?');
500  if ($projectstatic->hasDelay()) {
501  print img_warning("Late");
502  }
503  print '</td></tr>';
504 
505  // Date start - end of event
506  print '<tr><td>'.$langs->trans("Dates").' ('.$langs->trans("Event").')</td><td>';
507  $start = dol_print_date($projectstatic->date_start_event, 'day');
508  print ($start ? $start : '?');
509  $end = dol_print_date($projectstatic->date_end_event, 'day');
510  print ' - ';
511  print ($end ? $end : '?');
512  if ($projectstatic->hasDelay()) {
513  print img_warning("Late");
514  }
515  print '</td></tr>';
516 
517  // Location event
518  print '<tr><td>'.$langs->trans("Location").'</td><td>';
519  print $projectstatic->location;
520  print '</td></tr>';
521 
522  // Other attributes
523  $cols = 2;
524  $objectconf = $object;
525  $object = $projectstatic;
526  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
527  $object = $objectconf;
528 
529  print '</table>';
530 
531  print '</div>';
532 
533  print '<div class="fichehalfright">';
534  print '<div class="underbanner clearboth"></div>';
535 
536  print '<table class="border tableforfield centpercent">';
537 
538  // Description
539  print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
540  print nl2br($projectstatic->description);
541  print '</td></tr>';
542 
543  // Categories
544  if (isModEnabled('categorie')) {
545  print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>';
546  print $form->showCategories($projectstatic->id, 'project', 1);
547  print "</td></tr>";
548  }
549 
550  print '<tr><td class="nowrap">';
551  $typeofdata = 'checkbox:'.($projectstatic->accept_conference_suggestions ? ' checked="checked"' : '');
552  $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp");
553  print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext);
554  print '</td><td>';
555  print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', 0, 0, '', 0, '', 'projectid');
556  print "</td></tr>";
557 
558  print '<tr><td>';
559  $typeofdata = 'checkbox:'.($projectstatic->accept_booth_suggestions ? ' checked="checked"' : '');
560  $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp");
561  print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext);
562  print '</td><td>';
563  print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', 0, 0, '', 0, '', 'projectid');
564  print "</td></tr>";
565 
566  print '<tr><td>';
567  print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
568  print '</td><td>';
569  print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid');
570  print "</td></tr>";
571 
572  print '<tr><td>';
573  print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
574  print '</td><td>';
575  print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid');
576  print "</td></tr>";
577 
578  print '<tr><td class="titlefield">';
579  print $form->editfieldkey($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', '', $projectstatic, $permissiontoadd, 'integer:3', '&withproject=1', 0, 0, 'projectid');
580  print '</td><td class="valuefield">';
581  print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $projectstatic->max_attendees, $projectstatic, $permissiontoadd, 'integer:3', '', 0, 0, '&withproject=1', 0, '', 'projectid');
582  print "</td></tr>";
583 
584  print '<tr><td valign="middle">'.$langs->trans("EventOrganizationICSLink").'</td><td>';
585  // Define $urlwithroot
586  $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
587  $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
588 
589  // Show message
590  $message = '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
591  $message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...');
592  $message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>';
593  print $message;
594  print "</td></tr>";
595 
596  // Link to the submit vote/register page
597  print '<tr><td>';
598  //print '<span class="opacitymedium">';
599  print $form->textwithpicto($langs->trans("SuggestOrVoteForConfOrBooth"), $langs->trans("EvntOrgRegistrationHelpMessage"));
600  //print '</span>';
601  print '</td><td>';
602  $linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.$projectstatic->id;
603  $encodedsecurekey = dol_hash(getDolGlobalString("EVENTORGANIZATION_SECUREKEY").'conferenceorbooth'.$projectstatic->id, 'md5');
604  $linksuggest .= '&securekey='.urlencode($encodedsecurekey);
605  //print '<div class="urllink">';
606  //print '<input type="text" value="'.$linksuggest.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
607  print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" rel="noopener noreferrer" href="'.$linksuggest.'" class="quatrevingtpercent">'.$linksuggest.'</a></div>';
608  print '<a target="_blank" rel="noopener noreferrer" href="'.$linksuggest.'">'.img_picto('', 'globe').'</a>';
609  //print '</div>';
610  //print ajax_autoselect("linkregister");
611  print '</td></tr>';
612 
613  // Link to the subscribe
614  print '<tr><td>';
615  //print '<span class="opacitymedium">';
616  print $langs->trans("PublicAttendeeSubscriptionGlobalPage");
617  //print '</span>';
618  print '</td><td>';
619  $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.$projectstatic->id.'&type=global';
620  $encodedsecurekey = dol_hash(getDolGlobalString("EVENTORGANIZATION_SECUREKEY").'conferenceorbooth'.$projectstatic->id, 'md5');
621  $link_subscription .= '&securekey='.urlencode($encodedsecurekey);
622  //print '<div class="urllink">';
623  //print '<input type="text" value="'.$linkregister.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
624  print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$link_subscription.'" class="quatrevingtpercent">'.$link_subscription.'</a></div>';
625  print '<a target="_blank" rel="noopener noreferrer" href="'.$link_subscription.'">'.img_picto('', 'globe').'</a>';
626  //print '</div>';
627  //print ajax_autoselect("linkregister");
628  print '</td></tr>';
629 
630  print '</table>';
631 
632  print '</div>';
633  print '</div>';
634 
635  print '<div class="clearboth"></div>';
636 
637  print dol_get_fiche_end();
638 
639  if (empty($confOrBooth->id)) {
640  $head = conferenceorboothProjectPrepareHead($projectstatic);
641  $tab = 'attendees';
642  print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, (!empty($project->public) ? 'projectpub' : 'project'), 0, '', 'reposition');
643  }
644  }
645 
646  if ($confOrBooth->id > 0) {
647  $head = conferenceorboothPrepareHead($confOrBooth, $withproject);
648 
649  print dol_get_fiche_head($head, 'attendees', $langs->trans("ConferenceOrBooth"), -1, $object->picto);
650 
651  $object_evt = $object;
652  $object = $confOrBooth;
653 
654  dol_banner_tab($object, 'ref', '', 0);
655 
656  print '<div class="fichecenter">';
657  print '<div class="fichehalfleft">';
658  print '<div class="underbanner clearboth"></div>';
659  print '<table class="border centpercent tableforfield">' . "\n";
660 
661  include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
662 
663  // Other attributes. Fields from hook formObjectOptions and Extrafields.
664  include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
665  $object = $object_evt;
666  print '</table>';
667  print '</div>';
668  print '</div>';
669 
670  print '<div class="clearboth"></div>';
671 
672  print dol_get_fiche_end();
673  }
674 }
675 
676 $arrayofselected = is_array($toselect) ? $toselect : array();
677 
678 $param = '';
679 if (!empty($mode)) {
680  $param .= '&mode='.urlencode($mode);
681 }
682 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
683  $param .= '&contextpage='.urlencode($contextpage);
684 }
685 if ($limit > 0 && $limit != $conf->liste_limit) {
686  $param .= '&limit='.((int) $limit);
687 }
688 if ($optioncss != '') {
689  $param .= '&optioncss='.urlencode($optioncss);
690 }
691 foreach ($search as $key => $val) {
692  if (is_array($search[$key])) {
693  foreach ($search[$key] as $skey) {
694  if ($skey != '') {
695  $param .= '&search_'.$key.'[]='.urlencode($skey);
696  }
697  }
698  } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
699  $param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int'));
700  $param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int'));
701  $param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int'));
702  } elseif ($search[$key] != '') {
703  $param .= '&search_'.$key.'='.urlencode($search[$key]);
704  }
705 }
706 if ($confOrBooth->id > 0) {
707  $param .= '&conforboothid='.urlencode($confOrBooth->id);
708 }
709 if ($projectstatic->id > 0) {
710  $param .= '&fk_project='.urlencode($projectstatic->id);
711 }
712 $param .= $withProjectUrl;
713 
714 // Add $param from extra fields
715 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
716 // Add $param from hooks
717 $parameters = array();
718 $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
719 $param .= $hookmanager->resPrint;
720 
721 // List of mass actions available
722 $arrayofmassactions = array(
723  //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
724  //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
725  //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
726  'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
727 );
728 if (!empty($permissiontodelete)) {
729  $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
730 }
731 if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
732  $arrayofmassactions = array();
733 }
734 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
735 
736 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].(!empty($conf_or_booth_id)?'?conforboothid='.$conf_or_booth_id:'').'">'."\n";
737 if ($optioncss != '') {
738  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
739 }
740 print '<input type="hidden" name="token" value="'.newToken().'">';
741 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
742 print '<input type="hidden" name="action" value="list">';
743 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
744 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
745 print '<input type="hidden" name="page" value="'.$page.'">';
746 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
747 print '<input type="hidden" name="withproject" value="'.$withproject.'">';
748 print '<input type="hidden" name="fk_project" value="'.$fk_project.'">';
749 print '<input type="hidden" name="page_y" value="">';
750 print '<input type="hidden" name="mode" value="'.$mode.'">';
751 
752 $params = array('morecss'=>'reposition');
753 
754 $newcardbutton = '';
755 $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?action=create'.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').$withProjectUrl.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.(empty($confOrBooth->id) ? '' : '&conforboothid='.$confOrBooth->id).$withProjectUrl), '', $permissiontoadd, $params);
756 
757 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
758 
759 
760 // Add code for pre mass action (confirmation or email presend form)
761 $topicmail = $projectstatic->title;
762 $modelmail = "conferenceorbooth";
763 $objecttmp = new ConferenceOrBoothAttendee($db);
764 $trackid = 'conferenceorbooth_'.$object->id;
765 $withmaindocfilemail = 0;
766 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
767 
768 
769 if ($search_all) {
770  $setupstring = '';
771  foreach ($fieldstosearchall as $key => $val) {
772  $fieldstosearchall[$key] = $langs->trans($val);
773  $setupstring .= $key."=".$val.";";
774  }
775  print '<!-- Search done like if CONFERENCEORBOOTHATTENDEE_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
776  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
777 }
778 
779 $moreforfilter = '';
780 /*$moreforfilter.='<div class="divsearchfield">';
781 $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
782 $moreforfilter.= '</div>';*/
783 
784 $parameters = array();
785 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
786 if (empty($reshook)) {
787  $moreforfilter .= $hookmanager->resPrint;
788 } else {
789  $moreforfilter = $hookmanager->resPrint;
790 }
791 
792 if (!empty($moreforfilter)) {
793  print '<div class="liste_titre liste_titre_bydiv centpercent">';
794  print $moreforfilter;
795  $parameters = array();
796  $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
797  print $hookmanager->resPrint;
798  print '</div>';
799 }
800 
801 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
802 $selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields
803 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
804 
805 print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
806 print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
807 
808 
809 // Fields title search
810 // --------------------------------------------------------------------
811 print '<tr class="liste_titre_filter">';
812 // Action column
813 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
814  print '<td class="liste_titre center maxwidthsearch">';
815  $searchpicto = $form->showFilterButtons('left');
816  print $searchpicto;
817  print '</td>';
818 }
819 foreach ($object->fields as $key => $val) {
820  $searchkey = empty($search[$key]) ? '' : $search[$key];
821  $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
822  if ($key == 'status') {
823  $cssforfield .= ($cssforfield ? ' ' : '').'center';
824  } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
825  $cssforfield .= ($cssforfield ? ' ' : '').'center';
826  } elseif (in_array($val['type'], array('timestamp'))) {
827  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
828  } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
829  $cssforfield .= ($cssforfield ? ' ' : '').'right';
830  }
831  if (!empty($arrayfields['t.'.$key]['checked'])) {
832  print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').($key == 'status' ? ' parentonrightofpage' : '').'">';
833  if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
834  print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1);
835  } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
836  print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
837  } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
838  print '<div class="nowrap">';
839  print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
840  print '</div>';
841  print '<div class="nowrap">';
842  print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
843  print '</div>';
844  } elseif ($key == 'lang') {
845  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
846  $formadmin = new FormAdmin($db);
847  print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2);
848  } else {
849  print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
850  }
851  print '</td>';
852  }
853 }
854 // Extra fields
855 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
856 
857 // Fields from hook
858 $parameters = array('arrayfields'=>$arrayfields);
859 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
860 print $hookmanager->resPrint;
861 // Action column
862 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
863  print '<td class="liste_titre center maxwidthsearch">';
864  $searchpicto = $form->showFilterButtons();
865  print $searchpicto;
866  print '</td>';
867 }
868 print '</tr>'."\n";
869 
870 $totalarray = array();
871 $totalarray['nbfield'] = 0;
872 
873 // Fields title label
874 // --------------------------------------------------------------------
875 print '<tr class="liste_titre">';
876 // Action column
877 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
878  print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
879  $totalarray['nbfield']++;
880 }
881 foreach ($object->fields as $key => $val) {
882  $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
883  if ($key == 'status') {
884  $cssforfield .= ($cssforfield ? ' ' : '').'center';
885  } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
886  $cssforfield .= ($cssforfield ? ' ' : '').'center';
887  } elseif (in_array($val['type'], array('timestamp'))) {
888  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
889  } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
890  $cssforfield .= ($cssforfield ? ' ' : '').'right';
891  }
892  $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
893  if (!empty($arrayfields['t.'.$key]['checked'])) {
894  print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n";
895  $totalarray['nbfield']++;
896  }
897 }
898 // Extra fields
899 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
900 // Hook fields
901 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
902 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
903 print $hookmanager->resPrint;
904 // Action column
905 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
906  print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
907  $totalarray['nbfield']++;
908 }
909 print '</tr>'."\n";
910 
911 
912 // Detect if we need a fetch on each output line
913 $needToFetchEachLine = 0;
914 if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
915  foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
916  if (!is_null($val) && preg_match('/\$object/', $val)) {
917  $needToFetchEachLine++; // There is at least one compute field that use $object
918  }
919  }
920 }
921 
922 
923 // Loop on record
924 // --------------------------------------------------------------------
925 $i = 0;
926 $savnbfield = $totalarray['nbfield'];
927 $totalarray = array();
928 $totalarray['nbfield'] = 0;
929 $imaxinloop = ($limit ? min($num, $limit) : $num);
930 while ($i < $imaxinloop) {
931  $obj = $db->fetch_object($resql);
932  if (empty($obj)) {
933  break; // Should not happen
934  }
935 
936  // Store properties in $object
937  $object->setVarsFromFetchObj($obj);
938 
939  if ($mode == 'kanban') {
940  if ($i == 0) {
941  print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
942  print '<div class="box-flex-container kanban">';
943  }
944  // Output Kanban
945  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
946  $selected = 0;
947  if (in_array($object->id, $arrayofselected)) {
948  $selected = 1;
949  }
950  }
951  print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
952  if ($i == ($imaxinloop - 1)) {
953  print '</div>';
954  print '</td></tr>';
955  }
956  } else {
957  // Show here line of result
958  $j = 0;
959  print '<tr data-rowid="'.$object->id.'" class="oddeven">';
960  // Action column
961  if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
962  print '<td class="nowrap center">';
963  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
964  $selected = 0;
965  if (in_array($object->id, $arrayofselected)) {
966  $selected = 1;
967  }
968  print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
969  }
970  print '</td>';
971  if (!$i) {
972  $totalarray['nbfield']++;
973  }
974  }
975  foreach ($object->fields as $key => $val) {
976  $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
977  if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
978  $cssforfield .= ($cssforfield ? ' ' : '').'center';
979  } elseif ($key == 'status') {
980  $cssforfield .= ($cssforfield ? ' ' : '').'center';
981  }
982 
983  if (in_array($val['type'], array('timestamp'))) {
984  $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
985  } elseif ($key == 'ref') {
986  $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
987  }
988 
989  if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
990  $cssforfield .= ($cssforfield ? ' ' : '').'right';
991  }
992  //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
993 
994  if (!empty($arrayfields['t.'.$key]['checked'])) {
995  print '<td'.($cssforfield ? ' class="'.$cssforfield.(preg_match('/tdoverflow/', $cssforfield) ? ' classfortooltip' : '').'"' : '');
996  if (preg_match('/tdoverflow/', $cssforfield) && !is_numeric($object->$key)) {
997  print ' title="'.dol_escape_htmltag($object->$key).'"';
998  }
999  print '>';
1000  if ($key == 'status') {
1001  print $object->getLibStatut(5);
1002  } elseif ($key == 'ref') {
1003  $optionLink = (!empty($withproject)?'conforboothidproject':'conforboothid');
1004  if (empty($confOrBooth->id)) {
1005  $optionLink='projectid';
1006  }
1007  print $object->getNomUrl(1, $optionLink);
1008  } else {
1009  print $object->showOutputField($val, $key, $object->$key, '');
1010  }
1011  print '</td>';
1012  if (!$i) {
1013  $totalarray['nbfield']++;
1014  }
1015  if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
1016  if (!$i) {
1017  $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
1018  }
1019  if (!isset($totalarray['val'])) {
1020  $totalarray['val'] = array();
1021  }
1022  if (!isset($totalarray['val']['t.'.$key])) {
1023  $totalarray['val']['t.'.$key] = 0;
1024  }
1025  $totalarray['val']['t.'.$key] += $object->$key;
1026  }
1027  }
1028  }
1029  // Extra fields
1030  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1031  // Fields from hook
1032  $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
1033  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1034  print $hookmanager->resPrint;
1035  // Action column
1036  if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1037  print '<td class="nowrap center">';
1038  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1039  $selected = 0;
1040  if (in_array($object->id, $arrayofselected)) {
1041  $selected = 1;
1042  }
1043  print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
1044  }
1045  print '</td>';
1046  if (!$i) {
1047  $totalarray['nbfield']++;
1048  }
1049  }
1050 
1051  print '</tr>'."\n";
1052  }
1053 
1054  $i++;
1055 }
1056 
1057 // Show total line
1058 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1059 
1060 // If no record found
1061 if ($num == 0) {
1062  $colspan = 1;
1063  foreach ($arrayfields as $key => $val) {
1064  if (!empty($val['checked'])) {
1065  $colspan++;
1066  }
1067  }
1068  print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1069 }
1070 
1071 
1072 $db->free($resql);
1073 
1074 $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
1075 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1076 print $hookmanager->resPrint;
1077 
1078 print '</table>'."\n";
1079 print '</div>'."\n";
1080 
1081 print '</form>'."\n";
1082 
1083 if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
1084  $hidegeneratedfilelistifempty = 1;
1085  if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
1086  $hidegeneratedfilelistifempty = 0;
1087  }
1088 
1089  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
1090  $formfile = new FormFile($db);
1091 
1092  // Show list of available documents
1093  $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
1094  $urlsource .= str_replace('&amp;', '&', $param);
1095 
1096  $filedir = $diroutputmassaction;
1097  $genallowed = $permissiontoread;
1098  $delallowed = $permissiontoadd;
1099 
1100  print $formfile->showdocuments('massfilesarea_eventorganization', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
1101 }
1102 
1103 // End of page
1104 llxFooter();
1105 $db->close();
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Definition: agenda.php:118
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
llxFooter()
Empty footer.
Definition: wrapper.php:70
Class for ConferenceOrBoothAttendee.
Class for ConferenceOrBooth.
Class to manage standard extra fields.
Class to generate html code for admin pages.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Class to manage projects.
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
Definition: index.php:746
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
conferenceorboothPrepareHead($object, $with_project=0)
Prepare array of tabs for ConferenceOrBooth.
conferenceorboothProjectPrepareHead($object)
Prepare array of tabs for ConferenceOrBooth Project tab.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
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...
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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...
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
project_prepare_head(Project $project, $moreparam='')
Prepare array with list of tabs.
Definition: project.lib.php:39
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.
dol_hash($chain, $type='0')
Returns a hash (non reversible encryption) of a string.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.