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