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