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