dolibarr  17.0.4
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') : 'conferenceorboothattendeelist'; // 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 
58 $id = GETPOST('id', 'int');
59 $conf_or_booth_id = GETPOST('conforboothid', 'int');
60 
61 $withproject = GETPOST('withproject', 'int');
62 $fk_project = GETPOST('fk_project', 'int') ? GETPOST('fk_project', 'int') : GETPOST('projectid', 'int');
63 $projectid = $fk_project;
64 
65 $withProjectUrl='';
66 
67 // Load variable for pagination
68 $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
69 $sortfield = GETPOST('sortfield', 'aZ09comma');
70 $sortorder = GETPOST('sortorder', 'aZ09comma');
71 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
72 if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
73  $page = 0;
74 } // If $page is not defined, or '' or -1 or if we click on clear filters
75 $offset = $limit * $page;
76 $pageprev = $page - 1;
77 $pagenext = $page + 1;
78 
79 // Initialize technical objects
80 $object = new ConferenceOrBoothAttendee($db);
81 $extrafields = new ExtraFields($db);
82 $projectstatic = new Project($db);
83 $diroutputmassaction = $conf->eventorganization->dir_output.'/temp/massgeneration/'.$user->id;
84 $hookmanager->initHooks(array('conferenceorboothattendeelist')); // Note that conf->hooks_modules contains array
85 
86 // Fetch optionals attributes and labels
87 $extrafields->fetch_name_optionals_label($object->table_element);
88 //$extrafields->fetch_name_optionals_label($object->table_element_line);
89 
90 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
91 
92 // Default sort order (if not yet defined by previous GETPOST)
93 if (!$sortfield) {
94  reset($object->fields); // Reset is required to avoid key() to return null.
95  $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
96 }
97 if (!$sortorder) {
98  $sortorder = "ASC";
99 }
100 
101 // Initialize array of search criterias
102 $search_all = GETPOST('search_all', 'alphanohtml');
103 $search = array();
104 foreach ($object->fields as $key => $val) {
105  if (GETPOST('search_'.$key, 'alpha') !== '') {
106  $search[$key] = GETPOST('search_'.$key, 'alpha');
107  }
108  if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
109  $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
110  $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
111  }
112 }
113 
114 // List of fields to search into when doing a "search in all"
115 $fieldstosearchall = array();
116 foreach ($object->fields as $key => $val) {
117  if (!empty($val['searchall'])) {
118  $fieldstosearchall['t.'.$key] = $val['label'];
119  }
120 }
121 
122 // Definition of array of fields for columns
123 $arrayfields = array();
124 foreach ($object->fields as $key => $val) {
125  // If $val['visible']==0, then we never show the field
126  if (!empty($val['visible'])) {
127  $visible = (int) dol_eval($val['visible'], 1, 1, '1');
128  $arrayfields['t.'.$key] = array(
129  'label'=>$val['label'],
130  'checked'=>(($visible < 0) ? 0 : 1),
131  'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
132  'position'=>$val['position'],
133  'help'=> isset($val['help']) ? $val['help'] : ''
134  );
135  }
136 }
137 // Extra fields
138 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
139 
140 $object->fields = dol_sort_array($object->fields, 'position');
141 $arrayfields = dol_sort_array($arrayfields, 'position');
142 
143 // Permissions
144 $permissiontoread = $user->rights->eventorganization->read;
145 $permissiontoadd = $user->rights->eventorganization->write;
146 $permissiontodelete = $user->rights->eventorganization->delete;
147 
148 // Security check
149 if (empty($conf->eventorganization->enabled)) {
150  accessforbidden('Module not enabled');
151 }
152 $socid = 0;
153 if ($user->socid > 0) { // Protection if external user
154  //$socid = $user->socid;
155  accessforbidden();
156 }
157 $result = restrictedArea($user, 'eventorganization');
158 if (!$permissiontoread) accessforbidden();
159 
160 
161 /*
162  * Actions
163  */
164 
165 if (preg_match('/^set/', $action) && $projectid > 0 && !empty($user->rights->eventorganization->write)) {
166  $project = new Project($db);
167  //If "set" fields keys is in projects fields
168  $project_attr=preg_replace('/^set/', '', $action);
169  if (array_key_exists($project_attr, $project->fields)) {
170  $result = $project->fetch($projectid);
171  if ($result < 0) {
172  setEventMessages(null, $project->errors, 'errors');
173  } else {
174  $project->{$project_attr}=GETPOST($project_attr);
175  $result=$project->update($user);
176  if ($result < 0) {
177  setEventMessages(null, $project->errors, 'errors');
178  }
179  }
180  }
181 }
182 
183 if (GETPOST('cancel', 'alpha')) {
184  $action = 'list';
185  $massaction = '';
186 }
187 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend'
188 && $massaction != 'presend'
189 && $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 if ($confOrBooth->id > 0) {
240  $title = $langs->trans('ListOfAttendeesPerConference');
241 } else {
242  $title = $langs->trans('ListOfAttendeesOfEvent');
243 }
244 $morejs = array();
245 $morecss = array();
246 
247 $confOrBooth = new ConferenceOrBooth($db);
248 if ($conf_or_booth_id > 0) {
249  $result = $confOrBooth->fetch($conf_or_booth_id);
250  if ($result < 0) {
251  setEventMessages(null, $confOrBooth->errors, 'errors');
252  } else {
253  $fk_project = $confOrBooth->fk_project;
254  }
255 }
256 
257 if ($fk_project > 0) {
258  $result = $projectstatic->fetch($fk_project);
259  if ($result < 0) {
260  setEventMessages(null, $projectstatic->errors, 'errors');
261  }
262 }
263 
264 
265 // Build and execute select
266 // --------------------------------------------------------------------
267 $sql = 'SELECT ';
268 $sql .= $object->getFieldList('t');
269 // Add fields from extrafields
270 if (!empty($extrafields->attributes[$object->table_element]['label'])) {
271  foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
272  $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
273  }
274 }
275 // Add fields from hooks
276 $parameters = array();
277 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
278 $sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
279 $sql = preg_replace('/,\s*$/', '', $sql);
280 $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
281 if (!empty($confOrBooth->id)) {
282  $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm as a on a.id=t.fk_actioncomm AND a.id=".((int) $confOrBooth->id);
283 }
284 if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
285  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
286 }
287 // Add table from hooks
288 $parameters = array();
289 $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
290 $sql .= $hookmanager->resPrint;
291 if ($object->ismultientitymanaged == 1) {
292  $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
293 } else {
294  $sql .= " WHERE 1 = 1";
295 }
296 if (!empty($projectstatic->id)) {
297  $sql .= " AND t.fk_project=".((int) $projectstatic->id);
298 }
299 foreach ($search as $key => $val) {
300  if (array_key_exists($key, $object->fields)) {
301  if ($key == 'status' && $search[$key] == -1) {
302  continue;
303  }
304  $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
305  if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
306  if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
307  $search[$key] = '';
308  }
309  $mode_search = 2;
310  }
311  if ($search[$key] != '') {
312  $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
313  }
314  } else {
315  if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
316  $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
317  if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
318  if (preg_match('/_dtstart$/', $key)) {
319  $sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'";
320  }
321  if (preg_match('/_dtend$/', $key)) {
322  $sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'";
323  }
324  }
325  }
326  }
327 }
328 if ($search_all) {
329  $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
330 }
331 //$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
332 // Add where from extra fields
333 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
334 // Add where from hooks
335 $parameters = array();
336 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
337 $sql .= $hookmanager->resPrint;
338 
339 
340 $sql .= $db->order($sortfield, $sortorder);
341 
342 // Count total nb of records
343 $nbtotalofrecords = '';
344 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
345  $resql = $db->query($sql);
346  $nbtotalofrecords = $db->num_rows($resql);
347  if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
348  $page = 0;
349  $offset = 0;
350  }
351 }
352 // if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
353 if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
354  $num = $nbtotalofrecords;
355 } else {
356  if ($limit) {
357  $sql .= $db->plimit($limit + 1, $offset);
358  }
359 
360  $resql = $db->query($sql);
361  if (!$resql) {
362  dol_print_error($db);
363  exit;
364  }
365 
366  $num = $db->num_rows($resql);
367 }
368 
369 // Direct jump if only one record found
370 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
371  $obj = $db->fetch_object($resql);
372  $id = $obj->rowid;
373  header("Location: ".dol_buildpath('/eventorganization/conferenceorboothattendee_card.php', 1).'?id='.$id);
374  exit;
375 }
376 
377 
378 
379 llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs');
380 
381 
382 
383 if ($projectstatic->id > 0 || $confOrBooth > 0) {
384  if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) {
385  $projectstatic->fetchComments();
386  }
387  if (!empty($projectstatic->socid)) {
388  $projectstatic->fetch_thirdparty();
389  }
390 
391  $withProjectUrl='';
392  $object->project = clone $projectstatic;
393 
394  if (!empty($withproject)) {
395  // Tabs for project
396  $tab = 'eventorganisation';
397  $withProjectUrl = "&withproject=1";
398  $head = project_prepare_head($projectstatic);
399 
400  print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'), 0, '', '');
401 
402  $param = ($mode == 'mine' ? '&mode=mine' : '');
403 
404  // Project card
405 
406  $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
407 
408  $morehtmlref = '<div class="refidno">';
409  // Title
410  $morehtmlref .= $projectstatic->title;
411  // Thirdparty
412  if ($projectstatic->thirdparty->id > 0) {
413  $morehtmlref .= '<br>'.$projectstatic->thirdparty->getNomUrl(1, 'project');
414  }
415  $morehtmlref .= '</div>';
416 
417  // Define a complementary filter for search of next/prev ref.
418  if (empty($user->rights->projet->all->lire)) {
419  $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
420  $projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
421  }
422 
423  dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
424 
425  print '<div class="fichecenter">';
426  print '<div class="fichehalfleft">';
427  print '<div class="underbanner clearboth"></div>';
428 
429  print '<table class="border tableforfield centpercent">';
430 
431  // Usage
432  if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled('eventorganization')) {
433  print '<tr><td class="tdtop">';
434  print $langs->trans("Usage");
435  print '</td>';
436  print '<td>';
437  if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
438  print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_opportunity ? ' checked="checked"' : '')).'"> ';
439  $htmltext = $langs->trans("ProjectFollowOpportunity");
440  print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
441  print '<br>';
442  }
443  if (empty($conf->global->PROJECT_HIDE_TASKS)) {
444  print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_task ? ' checked="checked"' : '')).'"> ';
445  $htmltext = $langs->trans("ProjectFollowTasks");
446  print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
447  print '<br>';
448  }
449  if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
450  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"' : '')).'"> ';
451  $htmltext = $langs->trans("ProjectBillTimeDescription");
452  print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
453  print '<br>';
454  }
455  if (isModEnabled('eventorganization')) {
456  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"' : '')).'"> ';
457  $htmltext = $langs->trans("EventOrganizationDescriptionLong");
458  print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
459  }
460  print '</td></tr>';
461  }
462 
463  // Visibility
464  print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
465  if ($projectstatic->public == 0) {
466  print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"');
467  print $langs->trans("PrivateProject");
468  } else {
469  print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"');
470  print $langs->trans("SharedProject");
471  }
472  print '</td></tr>';
473 
474  // Budget
475  print '<tr><td>'.$langs->trans("Budget").'</td><td>';
476  if (strcmp($projectstatic->budget_amount, '')) {
477  print '<span class="amount">'.price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency).'</span>';
478  }
479  print '</td></tr>';
480 
481  // Date start - end project
482  print '<tr><td>'.$langs->trans("Dates").' ('.$langs->trans("Project").')</td><td>';
483  $start = dol_print_date($projectstatic->date_start, 'day');
484  print ($start ? $start : '?');
485  $end = dol_print_date($projectstatic->date_end, 'day');
486  print ' - ';
487  print ($end ? $end : '?');
488  if ($projectstatic->hasDelay()) {
489  print img_warning("Late");
490  }
491  print '</td></tr>';
492 
493  // Date start - end of event
494  print '<tr><td>'.$langs->trans("Dates").' ('.$langs->trans("Event").')</td><td>';
495  $start = dol_print_date($projectstatic->date_start_event, 'day');
496  print ($start ? $start : '?');
497  $end = dol_print_date($projectstatic->date_end_event, 'day');
498  print ' - ';
499  print ($end ? $end : '?');
500  if ($projectstatic->hasDelay()) {
501  print img_warning("Late");
502  }
503  print '</td></tr>';
504 
505  // Location event
506  print '<tr><td>'.$langs->trans("Location").'</td><td>';
507  print $projectstatic->location;
508  print '</td></tr>';
509 
510  // Other attributes
511  $cols = 2;
512  $objectconf = $object;
513  $object = $projectstatic;
514  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
515  $object = $objectconf;
516 
517  print '</table>';
518 
519  print '</div>';
520 
521  print '<div class="fichehalfright">';
522  print '<div class="underbanner clearboth"></div>';
523 
524  print '<table class="border tableforfield centpercent">';
525 
526  // Description
527  print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
528  print nl2br($projectstatic->description);
529  print '</td></tr>';
530 
531  // Categories
532  if (isModEnabled('categorie')) {
533  print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>';
534  print $form->showCategories($projectstatic->id, 'project', 1);
535  print "</td></tr>";
536  }
537 
538  print '<tr><td class="nowrap">';
539  $typeofdata = 'checkbox:'.($projectstatic->accept_conference_suggestions ? ' checked="checked"' : '');
540  $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp");
541  print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext);
542  print '</td><td>';
543  print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', 0, 0, '', 0, '', 'projectid');
544  print "</td></tr>";
545 
546  print '<tr><td>';
547  $typeofdata = 'checkbox:'.($projectstatic->accept_booth_suggestions ? ' checked="checked"' : '');
548  $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp");
549  print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext);
550  print '</td><td>';
551  print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', 0, 0, '', 0, '', 'projectid');
552  print "</td></tr>";
553 
554  print '<tr><td>';
555  print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
556  print '</td><td>';
557  print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid');
558  print "</td></tr>";
559 
560  print '<tr><td>';
561  print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
562  print '</td><td>';
563  print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', 0, 0, '', 0, '', 'projectid');
564  print "</td></tr>";
565 
566  print '<tr><td class="titlefield">';
567  print $form->editfieldkey($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', '', $projectstatic, $permissiontoadd, 'integer:3', '&withproject=1', 0, 0, 'projectid');
568  print '</td><td class="valuefield">';
569  print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $projectstatic->max_attendees, $projectstatic, $permissiontoadd, 'integer:3', '', 0, 0, '&withproject=1', 0, '', 'projectid');
570  print "</td></tr>";
571 
572  print '<tr><td valign="middle">'.$langs->trans("EventOrganizationICSLink").'</td><td>';
573  // Define $urlwithroot
574  $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
575  $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
576 
577  // Show message
578  $message = '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
579  $message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...');
580  $message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>';
581  print $message;
582  print "</td></tr>";
583 
584  // Link to the submit vote/register page
585  print '<tr><td>';
586  //print '<span class="opacitymedium">';
587  print $form->textwithpicto($langs->trans("SuggestOrVoteForConfOrBooth"), $langs->trans("EvntOrgRegistrationHelpMessage"));
588  //print '</span>';
589  print '</td><td>';
590  $linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.$projectstatic->id;
591  $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 'md5');
592  $linksuggest .= '&securekey='.urlencode($encodedsecurekey);
593  //print '<div class="urllink">';
594  //print '<input type="text" value="'.$linksuggest.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
595  print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" rel="noopener noreferrer" href="'.$linksuggest.'" class="quatrevingtpercent">'.$linksuggest.'</a></div>';
596  print '<a target="_blank" rel="noopener noreferrer" href="'.$linksuggest.'">'.img_picto('', 'globe').'</a>';
597  //print '</div>';
598  //print ajax_autoselect("linkregister");
599  print '</td></tr>';
600 
601  // Link to the subscribe
602  print '<tr><td>';
603  //print '<span class="opacitymedium">';
604  print $langs->trans("PublicAttendeeSubscriptionGlobalPage");
605  //print '</span>';
606  print '</td><td>';
607  $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.$projectstatic->id.'&type=global';
608  $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 'md5');
609  $link_subscription .= '&securekey='.urlencode($encodedsecurekey);
610  //print '<div class="urllink">';
611  //print '<input type="text" value="'.$linkregister.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
612  print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$link_subscription.'" class="quatrevingtpercent">'.$link_subscription.'</a></div>';
613  print '<a target="_blank" rel="noopener noreferrer" href="'.$link_subscription.'">'.img_picto('', 'globe').'</a>';
614  //print '</div>';
615  //print ajax_autoselect("linkregister");
616  print '</td></tr>';
617 
618  print '</table>';
619 
620  print '</div>';
621  print '</div>';
622 
623  print '<div class="clearboth"></div>';
624 
625  print dol_get_fiche_end();
626 
627  if (empty($confOrBooth->id)) {
628  $head = conferenceorboothProjectPrepareHead($projectstatic);
629  $tab = 'attendees';
630  print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($project->public ? 'projectpub' : 'project'), 0, '', 'reposition');
631  }
632  }
633 
634  if ($confOrBooth->id > 0) {
635  $head = conferenceorboothPrepareHead($confOrBooth, $withproject);
636 
637  print dol_get_fiche_head($head, 'attendees', $langs->trans("ConferenceOrBooth"), -1, $object->picto);
638 
639  $object_evt = $object;
640  $object = $confOrBooth;
641 
642  dol_banner_tab($object, 'ref', '', 0);
643 
644  print '<div class="fichecenter">';
645  print '<div class="fichehalfleft">';
646  print '<div class="underbanner clearboth"></div>';
647  print '<table class="border centpercent tableforfield">' . "\n";
648 
649  include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
650 
651  // Other attributes. Fields from hook formObjectOptions and Extrafields.
652  include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
653  $object = $object_evt;
654  print '</table>';
655  print '</div>';
656  print '</div>';
657 
658  print '<div class="clearboth"></div>';
659 
660  print dol_get_fiche_end();
661  }
662 }
663 
664 $arrayofselected = is_array($toselect) ? $toselect : array();
665 
666 $param = '';
667 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
668  $param .= '&contextpage='.urlencode($contextpage);
669 }
670 if ($limit > 0 && $limit != $conf->liste_limit) {
671  $param .= '&limit='.urlencode($limit);
672 }
673 foreach ($search as $key => $val) {
674  if (is_array($search[$key]) && count($search[$key])) {
675  foreach ($search[$key] as $skey) {
676  if ($skey != '') {
677  $param .= '&search_'.$key.'[]='.urlencode($skey);
678  }
679  }
680  } elseif ($search[$key] != '') {
681  $param .= '&search_'.$key.'='.urlencode($search[$key]);
682  }
683 }
684 if ($confOrBooth->id > 0) {
685  $param .= '&conforboothid='.urlencode($confOrBooth->id);
686 }
687 if ($projectstatic->id > 0) {
688  $param .= '&fk_project='.urlencode($projectstatic->id);
689 }
690 $param .= $withProjectUrl;
691 if ($optioncss != '') {
692  $param .= '&optioncss='.urlencode($optioncss);
693 }
694 
695 // Add $param from extra fields
696 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
697 // Add $param from hooks
698 $parameters = array();
699 $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
700 $param .= $hookmanager->resPrint;
701 
702 // List of mass actions available
703 $arrayofmassactions = array(
704  //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
705  //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
706  //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
707  'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
708 );
709 if ($permissiontodelete) {
710  $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
711 }
712 if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
713  $arrayofmassactions = array();
714 }
715 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
716 
717 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].(!empty($conf_or_booth_id)?'?conforboothid='.$conf_or_booth_id:'').'">'."\n";
718 if ($optioncss != '') {
719  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
720 }
721 print '<input type="hidden" name="token" value="'.newToken().'">';
722 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
723 print '<input type="hidden" name="action" value="list">';
724 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
725 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
726 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
727 print '<input type="hidden" name="withproject" value="'.$withproject.'">';
728 print '<input type="hidden" name="fk_project" value="'.$fk_project.'">';
729 print '<input type="hidden" name="page_y" value="">';
730 
731 $params = array('morecss'=>'reposition');
732 $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);
733 
734 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
735 
736 
737 // Add code for pre mass action (confirmation or email presend form)
738 $topicmail = $projectstatic->title;
739 $modelmail = "conferenceorbooth";
740 $objecttmp = new ConferenceOrBoothAttendee($db);
741 $trackid = 'conferenceorbooth_'.$object->id;
742 $withmaindocfilemail = 0;
743 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
744 
745 
746 if ($search_all) {
747  foreach ($fieldstosearchall as $key => $val) {
748  $fieldstosearchall[$key] = $langs->trans($val);
749  }
750  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
751 }
752 
753 $moreforfilter = '';
754 /*$moreforfilter.='<div class="divsearchfield">';
755 $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
756 $moreforfilter.= '</div>';*/
757 
758 $parameters = array();
759 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
760 if (empty($reshook)) {
761  $moreforfilter .= $hookmanager->resPrint;
762 } else {
763  $moreforfilter = $hookmanager->resPrint;
764 }
765 
766 if (!empty($moreforfilter)) {
767  print '<div class="liste_titre liste_titre_bydiv centpercent">';
768  print $moreforfilter;
769  print '</div>';
770 }
771 
772 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
773 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
774 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
775 
776 print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
777 print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
778 
779 
780 // Fields title search
781 // --------------------------------------------------------------------
782 print '<tr class="liste_titre">';
783 foreach ($object->fields as $key => $val) {
784  $cssforfield = (empty($val['css']) ? '' : $val['css']);
785  if ($key == 'status') {
786  $cssforfield .= ($cssforfield ? ' ' : '').'center';
787  } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
788  $cssforfield .= ($cssforfield ? ' ' : '').'center';
789  } elseif (in_array($val['type'], array('timestamp'))) {
790  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
791  } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref')) && $val['label'] != 'TechnicalID') {
792  $cssforfield .= ($cssforfield ? ' ' : '').'right';
793  }
794  if (!empty($arrayfields['t.'.$key]['checked'])) {
795  print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
796  if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
797  print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
798  } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) {
799  print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1);
800  } elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
801  print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
802  } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
803  print '<div class="nowrap">';
804  print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
805  print '</div>';
806  print '<div class="nowrap">';
807  print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
808  print '</div>';
809  }
810  print '</td>';
811  }
812 }
813 // Extra fields
814 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
815 
816 // Fields from hook
817 $parameters = array('arrayfields'=>$arrayfields);
818 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
819 print $hookmanager->resPrint;
820 // Action column
821 print '<td class="liste_titre maxwidthsearch">';
822 $searchpicto = $form->showFilterButtons();
823 print $searchpicto;
824 print '</td>';
825 print '</tr>'."\n";
826 
827 
828 // Fields title label
829 // --------------------------------------------------------------------
830 print '<tr class="liste_titre">';
831 foreach ($object->fields as $key => $val) {
832  $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
833  if ($key == 'status') {
834  $cssforfield .= ($cssforfield ? ' ' : '').'center';
835  } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
836  $cssforfield .= ($cssforfield ? ' ' : '').'center';
837  } elseif (in_array($val['type'], array('timestamp'))) {
838  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
839  } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref')) && $val['label'] != 'TechnicalID') {
840  $cssforfield .= ($cssforfield ? ' ' : '').'right';
841  }
842  if (!empty($arrayfields['t.'.$key]['checked'])) {
843  print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
844  }
845 }
846 // Extra fields
847 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
848 // Hook fields
849 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
850 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
851 print $hookmanager->resPrint;
852 // Action column
853 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
854 print '</tr>'."\n";
855 
856 
857 // Detect if we need a fetch on each output line
858 $needToFetchEachLine = 0;
859 if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
860  foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
861  if (preg_match('/\$object/', $val)) {
862  $needToFetchEachLine++; // There is at least one compute field that use $object
863  }
864  }
865 }
866 
867 
868 // Loop on record
869 // --------------------------------------------------------------------
870 $i = 0;
871 $totalarray = array();
872 while ($i < ($limit ? min($num, $limit) : $num)) {
873  $obj = $db->fetch_object($resql);
874  if (empty($obj)) {
875  break; // Should not happen
876  }
877 
878  // Store properties in $object
879  $object->setVarsFromFetchObj($obj);
880 
881  // Show here line of result
882  print '<tr class="oddeven">';
883  foreach ($object->fields as $key => $val) {
884  $cssforfield = (empty($val['css']) ? '' : $val['css']);
885  if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
886  $cssforfield .= ($cssforfield ? ' ' : '').'center';
887  } elseif ($key == 'status') {
888  $cssforfield .= ($cssforfield ? ' ' : '').'center';
889  }
890 
891  if (in_array($val['type'], array('timestamp'))) {
892  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap left';
893  } elseif ($key == 'ref') {
894  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
895  }
896 
897  if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref', 'status'))) {
898  $cssforfield .= ($cssforfield ? ' ' : '').'right';
899  }
900  //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
901 
902  if (!empty($arrayfields['t.'.$key]['checked'])) {
903  print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
904  if ($key == 'status') {
905  print $object->getLibStatut(5);
906  } elseif ($key == 'ref') {
907  $optionLink = (!empty($withproject)?'conforboothidproject':'conforboothid');
908  if (empty($confOrBooth->id)) {
909  $optionLink='projectid';
910  }
911  print $object->getNomUrl(1, $optionLink);
912  } else {
913  print $object->showOutputField($val, $key, $object->$key, '');
914  }
915  print '</td>';
916  if (!$i) {
917  $totalarray['nbfield']++;
918  }
919  if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
920  if (!$i) {
921  $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
922  }
923  if (!isset($totalarray['val'])) {
924  $totalarray['val'] = array();
925  }
926  if (!isset($totalarray['val']['t.'.$key])) {
927  $totalarray['val']['t.'.$key] = 0;
928  }
929  $totalarray['val']['t.'.$key] += $object->$key;
930  }
931  }
932  }
933  // Extra fields
934  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
935  // Fields from hook
936  $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
937  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
938  print $hookmanager->resPrint;
939  // Action column
940  print '<td class="nowrap center">';
941  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
942  $selected = 0;
943  if (in_array($object->id, $arrayofselected)) {
944  $selected = 1;
945  }
946  print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
947  }
948  print '</td>';
949  if (!$i) {
950  $totalarray['nbfield']++;
951  }
952 
953  print '</tr>'."\n";
954 
955  $i++;
956 }
957 
958 // Show total line
959 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
960 
961 // If no record found
962 if ($num == 0) {
963  $colspan = 1;
964  foreach ($arrayfields as $key => $val) {
965  if (!empty($val['checked'])) {
966  $colspan++;
967  }
968  }
969  print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
970 }
971 
972 
973 $db->free($resql);
974 
975 $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
976 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
977 print $hookmanager->resPrint;
978 
979 print '</table>'."\n";
980 print '</div>'."\n";
981 
982 print '</form>'."\n";
983 
984 if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
985  $hidegeneratedfilelistifempty = 1;
986  if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
987  $hidegeneratedfilelistifempty = 0;
988  }
989 
990  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
991  $formfile = new FormFile($db);
992 
993  // Show list of available documents
994  $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
995  $urlsource .= str_replace('&amp;', '&', $param);
996 
997  $filedir = $diroutputmassaction;
998  $genallowed = $permissiontoread;
999  $delallowed = $permissiontoadd;
1000 
1001  print $formfile->showdocuments('massfilesarea_eventorganization', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
1002 }
1003 
1004 // End of page
1005 llxFooter();
1006 $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 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') &&!empty($user->rights->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') &&!empty($user->rights->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)) $resql
Social contributions to pay.
Definition: index.php:745
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...
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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.
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.
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.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
$nbtotalofrecords
Count total nb of records.
Definition: list.php:329
project_prepare_head(Project $project, $moreparam='')
Prepare array with list of tabs.
Definition: project.lib.php:38
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.