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