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