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
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', '', 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', '', 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').'&file='.urlencode('calendar-'.$project->ref.'.ics').'&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 class="">';
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" 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 class="">';
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// Build and execute select
660// --------------------------------------------------------------------
661$sql = 'SELECT ';
662$sql .= $object->getFieldList('t');
663
664// Add fields from extrafields
665if (!empty($extrafields->attributes[$object->table_element]['label'])) {
666 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
667 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
668 }
669}
670// Add fields from hooks
671$parameters = array();
672$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
673$sql .= $hookmanager->resPrint;
674$sql = preg_replace('/,\s*$/', '', $sql);
675//$sql .= ", COUNT(rc.rowid) as anotherfield";
676
677$sqlfields = $sql; // $sql fields to remove for count total
678
679$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
680if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
681 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.id = ef.fk_object)";
682}
683$sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as cact ON cact.id=t.fk_action AND cact.module LIKE '%@eventorganization'";
684// Add table from hooks
685$parameters = array();
686$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
687$sql .= $hookmanager->resPrint;
688if ($object->ismultientitymanaged == 1) {
689 $sql .= " WHERE t.entity IN (".getEntity($object->element, (GETPOSTINT('search_current_entity') ? 0 : 1)).")";
690} else {
691 $sql .= " WHERE 1 = 1";
692}
693if ($projectid > 0) {
694 $sql .= " AND t.fk_project = ".((int) $project->id);
695}
696if (!empty($thirdpartyid)) {
697 $sql .= " AND t.fk_soc = ".((int) $thirdpartyid);
698}
699foreach ($search as $key => $val) {
700 if (array_key_exists($key, $object->fields)) {
701 if ($key == 'status' && $search[$key] == -1) {
702 continue;
703 }
704 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
705 if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
706 if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
707 $search[$key] = '';
708 }
709 $mode_search = 2;
710 }
711 if ($search[$key] != '') {
712 $sql .= natural_search("t.".$db->sanitize($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
713 }
714 } else {
715 if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
716 $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
717 if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
718 if (preg_match('/_dtstart$/', $key)) {
719 $sql .= " AND t.".$db->sanitize($columnName)." >= '".$db->idate($search[$key])."'";
720 }
721 if (preg_match('/_dtend$/', $key)) {
722 $sql .= " AND t.".$db->sanitize($columnName)." <= '".$db->idate($search[$key])."'";
723 }
724 }
725 }
726 }
727}
728if ($search_all) {
729 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
730}
731//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
732// Add where from extra fields
733include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
734// Add where from hooks
735$parameters = array();
736$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
737$sql .= $hookmanager->resPrint;
738
739// Count total nb of records
740$nbtotalofrecords = '';
741if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
742 /* The fast and low memory method to get and count full list converts the sql into a sql count */
743 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
744 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
745 $resql = $db->query($sqlforcount);
746 if ($resql) {
747 $objforcount = $db->fetch_object($resql);
748 $nbtotalofrecords = $objforcount->nbtotalofrecords;
749 } else {
751 }
752
753 if (($page * $limit) > (int) $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
754 $page = 0;
755 $offset = 0;
756 }
757 $db->free($resql);
758}
759
760// Complete request and execute it with limit
761$sql .= $db->order($sortfield, $sortorder);
762if ($limit) {
763 $sql .= $db->plimit($limit + 1, $offset);
764}
765
766$resql = $db->query($sql);
767if (!$resql) {
769 exit;
770}
771
772$num = $db->num_rows($resql);
773
774// Direct jump if only one record found
775if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
776 $obj = $db->fetch_object($resql);
777 $id = $obj->rowid;
778 header("Location: ".DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.php?id='.((int) $id));
779 exit;
780}
781
782$arrayofselected = is_array($toselect) ? $toselect : array();
783
784$param = '';
785if (!empty($mode)) {
786 $param .= '&mode='.urlencode($mode);
787}
788if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
789 $param .= '&contextpage='.urlencode($contextpage);
790}
791if ($limit > 0 && $limit != $conf->liste_limit) {
792 $param .= '&limit='.((int) $limit);
793}
794if ($optioncss != '') {
795 $param .= '&optioncss='.urlencode($optioncss);
796}
797if ($project->id > 0) {
798 $param .= '&projectid='.((int) $project->id);
799}
800foreach ($search as $key => $val) {
801 if (is_array($search[$key])) {
802 foreach ($search[$key] as $skey) {
803 if ($skey != '') {
804 $param .= '&search_'.$key.'[]='.urlencode($skey);
805 }
806 }
807 } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
808 $param .= '&search_'.$key.'month='.(GETPOSTINT('search_'.$key.'month'));
809 $param .= '&search_'.$key.'day='.(GETPOSTINT('search_'.$key.'day'));
810 $param .= '&search_'.$key.'year='.(GETPOSTINT('search_'.$key.'year'));
811 } elseif ($search[$key] != '') {
812 $param .= '&search_'.$key.'='.urlencode($search[$key]);
813 }
814}
815// Add $param from extra fields
816include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
817// Add $param from hooks
818$parameters = array('param' => &$param);
819$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
820$param .= $hookmanager->resPrint;
821
822// List of mass actions available
823$arrayofmassactions = array(
824 //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
825 //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
826 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
827 'presend' => img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail").' ('.$langs->trans("ToSpeakers").')',
828 //'presend_attendees'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail").' - '.$langs->trans("Attendees"),
829);
830if (!empty($permissiontodelete)) {
831 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
832}
833if (!empty($permissiontoadd)) {
834 $arrayofmassactions['presetstatus'] = img_picto('', 'edit', 'class="pictofixedwidth"').$langs->trans("ModifyStatus");
835}
836if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) {
837 $arrayofmassactions = array();
838}
839$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
840
841print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].(!empty($projectid) ? '?projectid='.$projectid : '').'">'."\n";
842if ($optioncss != '') {
843 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
844}
845print '<input type="hidden" name="token" value="'.newToken().'">';
846print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
847print '<input type="hidden" name="action" value="list">';
848print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
849print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
850print '<input type="hidden" name="page" value="'.$page.'">';
851print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
852print '<input type="hidden" name="page_y" value="">';
853print '<input type="hidden" name="mode" value="'.$mode.'">';
854
855
856$newcardbutton = '';
857$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'));
858$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'));
859$newcardbutton .= dolGetButtonTitleSeparator();
860$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);
861
862print_barre_liste($subtitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
863
864
865// Add code for pre mass action (confirmation or email presend form)
866$topicmail = '';
867$modelmail = "conferenceorbooth";
868$objecttmp = new ConferenceOrBooth($db);
869$trackid = 'conferenceorbooth_'.$object->id;
870$withmaindocfilemail = 0;
871include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
872
873if ($massaction == 'presetstatus') {
874 $formquestion = array();
875 $statuslist = array();
876 $statuslist[$objecttmp::STATUS_DRAFT] = $objecttmp->LibStatutEvent($objecttmp::STATUS_DRAFT);
877 $statuslist[$objecttmp::STATUS_SUGGESTED] = $objecttmp->LibStatutEvent($objecttmp::STATUS_SUGGESTED);
878 $statuslist[$objecttmp::STATUS_CONFIRMED] = $objecttmp->LibStatutEvent($objecttmp::STATUS_CONFIRMED);
879 $statuslist[$objecttmp::STATUS_NOT_QUALIFIED] = $objecttmp->LibStatutEvent($objecttmp::STATUS_NOT_QUALIFIED);
880 $statuslist[$objecttmp::STATUS_DONE] = $objecttmp->LibStatutEvent($objecttmp::STATUS_DONE);
881 $statuslist[$objecttmp::STATUS_CANCELED] = $objecttmp->LibStatutEvent($objecttmp::STATUS_CANCELED);
882 $formquestion[] = array('type' => 'other',
883 'name' => 'affectedcommercial',
884 'label' => $form->editfieldkey('ModifyStatus', 'status_id', '', $object, 0),
885 'value' => $form->selectarray('statusmassaction', $statuslist, GETPOST('statusmassaction')));
886 print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmModifyStatus"), $langs->trans("ConfirmModifyStatusQuestion", count($toselect)), "setstatus", $formquestion, 1, 0, 200, 500, 1);
887}
888
889if ($search_all) {
890 $setupstring = '';
891 foreach ($fieldstosearchall as $key => $val) {
892 $fieldstosearchall[$key] = $langs->trans($val);
893 $setupstring .= $key."=".$val.";";
894 }
895 print '<!-- Search done like if EVENTORGANIZATION_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
896 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>'."\n";
897}
898
899$moreforfilter = '';
900/*$moreforfilter.='<div class="divsearchfield">';
901$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
902$moreforfilter.= '</div>';*/
903
904$parameters = array();
905$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
906if (empty($reshook)) {
907 $moreforfilter .= $hookmanager->resPrint;
908} else {
909 $moreforfilter = $hookmanager->resPrint;
910}
911
912if (!empty($moreforfilter)) {
913 print '<div class="liste_titre liste_titre_bydiv centpercent">';
914 print $moreforfilter;
915 print '</div>';
916}
917
918$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
919$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields with user setup
920$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
921$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
922
923
924print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
925print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
926
927
928// Fields title search
929// --------------------------------------------------------------------
930print '<tr class="liste_titre_filter">';
931// Action column
932if ($conf->main_checkbox_left_column) {
933 print '<td class="liste_titre center maxwidthsearch">';
934 $searchpicto = $form->showFilterButtons('left');
935 print $searchpicto;
936 print '</td>';
937}
938foreach ($object->fields as $key => $val) {
939 $searchkey = empty($search[$key]) ? '' : $search[$key];
940 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
941 if ($key == 'status') {
942 $cssforfield .= ($cssforfield ? ' ' : '').'center';
943 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
944 $cssforfield .= ($cssforfield ? ' ' : '').'center';
945 } elseif (in_array($val['type'], array('timestamp'))) {
946 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
947 } 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'])) {
948 $cssforfield .= ($cssforfield ? ' ' : '').'right';
949 }
950 if (!empty($arrayfields['t.'.$key]['checked'])) {
951 print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').($key == 'status' ? ' parentonrightofpage' : '').'">';
952 if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
953 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);
954 } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
955 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
956 } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
957 print '<div class="nowrap">';
958 print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
959 print '</div>';
960 print '<div class="nowrap">';
961 print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
962 print '</div>';
963 } elseif ($key == 'lang') {
964 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
965 $formadmin = new FormAdmin($db);
966 print $formadmin->select_language($search[$key], 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2);
967 } else {
968 print '<input type="text" class="flat maxwidth'.($val['type'] == 'integer' ? '50' : '75').'" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
969 }
970 print '</td>';
971 }
972}
973// Extra fields
974include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
975
976// Fields from hook
977$parameters = array('arrayfields' => $arrayfields);
978$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
979print $hookmanager->resPrint;
980// Action column
981if (!$conf->main_checkbox_left_column) {
982 print '<td class="liste_titre center maxwidthsearch">';
983 $searchpicto = $form->showFilterButtons();
984 print $searchpicto;
985 print '</td>';
986}
987print '</tr>'."\n";
988
989$totalarray = array();
990$totalarray['nbfield'] = 0;
991
992// Fields title label
993// --------------------------------------------------------------------
994print '<tr class="liste_titre">';
995// Action column
996if ($conf->main_checkbox_left_column) {
997 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
998 $totalarray['nbfield']++;
999}
1000foreach ($object->fields as $key => $val) {
1001 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
1002 if ($key == 'status') {
1003 $cssforfield .= ($cssforfield ? ' ' : '').'center';
1004 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
1005 $cssforfield .= ($cssforfield ? ' ' : '').'center';
1006 } elseif (in_array($val['type'], array('timestamp'))) {
1007 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
1008 } 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'])) {
1009 $cssforfield .= ($cssforfield ? ' ' : '').'right';
1010 }
1011 $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
1012 if (!empty($arrayfields['t.'.$key]['checked'])) {
1013 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";
1014 $totalarray['nbfield']++;
1015 }
1016}
1017// Extra fields
1018include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
1019// Hook fields
1020$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
1021$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1022print $hookmanager->resPrint;
1023// Action column
1024if (!$conf->main_checkbox_left_column) {
1025 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
1026 $totalarray['nbfield']++;
1027}
1028print '</tr>'."\n";
1029
1030
1031// Detect if we need a fetch on each output line
1032$needToFetchEachLine = 0;
1033if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
1034 foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
1035 if (!is_null($val) && preg_match('/\$object/', $val)) {
1036 $needToFetchEachLine++; // There is at least one compute field that use $object
1037 }
1038 }
1039}
1040
1041
1042// Loop on record
1043// --------------------------------------------------------------------
1044$i = 0;
1045$savnbfield = $totalarray['nbfield'];
1046$totalarray = array();
1047$totalarray['nbfield'] = 0;
1048$imaxinloop = ($limit ? min($num, $limit) : $num);
1049while ($i < $imaxinloop) {
1050 $obj = $db->fetch_object($resql);
1051 if (empty($obj)) {
1052 break; // Should not happen
1053 }
1054
1055 // Store properties in $object
1056 $object->setVarsFromFetchObj($obj);
1057
1058 if ($mode == 'kanban') {
1059 if ($i == 0) {
1060 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
1061 print '<div class="box-flex-container kanban">';
1062 }
1063 // Output Kanban
1064 $selected = -1;
1065 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1066 $selected = 0;
1067 if (in_array($object->id, $arrayofselected)) {
1068 $selected = 1;
1069 }
1070 }
1071 $thirdparty = $object->fetch_thirdparty();
1072 print $object->getKanbanView('', array('selected' => $selected, 'thirdparty' => $thirdparty));
1073 if ($i == ($imaxinloop - 1)) {
1074 print '</div>';
1075 print '</td></tr>';
1076 }
1077 } else {
1078 // Show line of result
1079 $j = 0;
1080 print '<tr data-rowid="'.$object->id.'" class="oddeven row-with-select">';
1081 // Action column
1082 if ($conf->main_checkbox_left_column) {
1083 print '<td class="nowrap center">';
1084 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1085 $selected = 0;
1086 if (in_array($object->id, $arrayofselected)) {
1087 $selected = 1;
1088 }
1089 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
1090 }
1091 print '</td>';
1092 if (!$i) {
1093 $totalarray['nbfield']++;
1094 }
1095 }
1096 foreach ($object->fields as $key => $val) {
1097 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
1098 if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
1099 $cssforfield .= ($cssforfield ? ' ' : '').'center';
1100 } elseif ($key == 'status') {
1101 $cssforfield .= ($cssforfield ? ' ' : '').'center';
1102 }
1103
1104 if (in_array($val['type'], array('timestamp'))) {
1105 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
1106 } elseif ($key == 'ref') {
1107 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
1108 }
1109
1110 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'])) {
1111 $cssforfield .= ($cssforfield ? ' ' : '').'right';
1112 }
1113 //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
1114
1115 if (!empty($arrayfields['t.'.$key]['checked'])) {
1116 print '<td'.($cssforfield ? ' class="'.$cssforfield.(preg_match('/tdoverflow/', $cssforfield) ? ' classfortooltip' : '').'"' : '');
1117 if (preg_match('/tdoverflow/', $cssforfield) && !is_numeric($object->$key)) {
1118 print ' title="'.dol_escape_htmltag((string) $object->$key).'"';
1119 }
1120 print '>';
1121 if ($key == 'status') {
1122 print $object->getLibStatut(5);
1123 } elseif ($key == 'ref') {
1124 print $object->getNomUrl(1, 0, '', (($projectid > 0) ? 'withproject' : ''));
1125 } else {
1126 print $object->showOutputField($val, $key, (string) $object->$key, '');
1127 }
1128 print '</td>';
1129 if (!$i) {
1130 $totalarray['nbfield']++;
1131 }
1132 if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
1133 if (!$i) {
1134 $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
1135 }
1136 if (!isset($totalarray['val'])) {
1137 $totalarray['val'] = array();
1138 }
1139 if (!isset($totalarray['val']['t.'.$key])) {
1140 $totalarray['val']['t.'.$key] = 0;
1141 }
1142 $totalarray['val']['t.'.$key] += $object->$key;
1143 }
1144 }
1145 }
1146 // Extra fields
1147 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1148 // Fields from hook
1149 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
1150 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1151 print $hookmanager->resPrint;
1152 // Action column
1153 if (!$conf->main_checkbox_left_column) {
1154 print '<td class="nowrap center">';
1155 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1156 $selected = 0;
1157 if (in_array($object->id, $arrayofselected)) {
1158 $selected = 1;
1159 }
1160 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
1161 }
1162 print '</td>';
1163 if (!$i) {
1164 $totalarray['nbfield']++;
1165 }
1166 }
1167
1168 print '</tr>'."\n";
1169 }
1170
1171 $i++;
1172}
1173
1174// Show total line
1175include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1176
1177// If no record found
1178if ($num == 0) {
1179 $colspan = 1;
1180 foreach ($arrayfields as $key => $val) {
1181 if (!empty($val['checked'])) {
1182 $colspan++;
1183 }
1184 }
1185 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1186}
1187
1188
1189$db->free($resql);
1190
1191$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
1192$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1193print $hookmanager->resPrint;
1194
1195print '</table>'."\n";
1196print '</div>'."\n";
1197
1198print '</form>'."\n";
1199
1200if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
1201 $hidegeneratedfilelistifempty = 1;
1202 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
1203 $hidegeneratedfilelistifempty = 0;
1204 }
1205
1206 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
1207 $formfile = new FormFile($db);
1208
1209 // Show list of available documents
1210 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
1211 $urlsource .= str_replace('&amp;', '&', $param);
1212
1213 $filedir = $diroutputmassaction;
1214 $genallowed = $permissiontoread;
1215 $delallowed = $permissiontoadd;
1216
1217 print $formfile->showdocuments('massfilesarea_eventorganization', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
1218}
1219
1220// End of page
1221llxFooter();
1222$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
$totalarray
Definition list.php:501
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
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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
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).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dolPrintHTML($s, $allowiframe=0, $moreallowedtags=array())
Return a string (that can be on several lines) ready to be output on a HTML page.
Definition html.lib.php:73
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:519
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:717
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_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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...
Definition html.lib.php:172
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
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.
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.