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 {
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) {
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 print '<div class="fichecenter">';
528 print '<div class="fichehalfleft">';
529 print '<div class="underbanner clearboth"></div>';
530
531 print '<table class="border tableforfield centpercent">';
532
533 // Usage
534 if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') || !getDolGlobalString('PROJECT_HIDE_TASKS') || isModEnabled('eventorganization')) {
535 print '<tr><td class="tdtop">';
536 print $langs->trans("Usage");
537 print '</td>';
538 print '<td>';
539 if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) {
540 print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_opportunity ? ' checked="checked"' : '')).'"> ';
541 $htmltext = $langs->trans("ProjectFollowOpportunity");
542 print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
543 print '<br>';
544 }
545 if (!getDolGlobalString('PROJECT_HIDE_TASKS')) {
546 print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_task ? ' checked="checked"' : '')).'"> ';
547 $htmltext = $langs->trans("ProjectFollowTasks");
548 print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
549 print '<br>';
550 }
551 if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) {
552 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"' : '')).'"> ';
553 $htmltext = $langs->trans("ProjectBillTimeDescription");
554 print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
555 print '<br>';
556 }
557 if (isModEnabled('eventorganization')) {
558 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"' : '')).'"> ';
559 $htmltext = $langs->trans("EventOrganizationDescriptionLong");
560 print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
561 }
562 print '</td></tr>';
563 }
564
565 // Budget
566 print '<tr><td>'.$langs->trans("Budget").'</td><td>';
567 if (strcmp($projectstatic->budget_amount, '')) {
568 print '<span class="amount">'.price($projectstatic->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).'</span>';
569 }
570 print '</td></tr>';
571
572 // Date start - end project
573 print '<tr><td>'.$langs->trans("Dates").' ('.$langs->trans("Project").')</td><td>';
574 $start = dol_print_date($projectstatic->date_start, 'day');
575 print($start ? $start : '?');
576 $end = dol_print_date($projectstatic->date_end, 'day');
577 print ' - ';
578 print($end ? $end : '?');
579 if ($projectstatic->hasDelay()) {
580 print img_warning("Late");
581 }
582 print '</td></tr>';
583
584 // Date start - end of event
585 print '<tr><td>'.$langs->trans("Dates").' ('.$langs->trans("Event").')</td><td>';
586 $start = dol_print_date($projectstatic->date_start_event, 'day');
587 print($start ? $start : '?');
588 $end = dol_print_date($projectstatic->date_end_event, 'day');
589 print ' - ';
590 print($end ? $end : '?');
591 if ($projectstatic->hasDelay()) {
592 print img_warning("Late");
593 }
594 print '</td></tr>';
595
596 // Visibility
597 print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
598 if ($projectstatic->public == 0) {
599 print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"');
600 print $langs->trans("PrivateProject");
601 } else {
602 print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"');
603 print $langs->trans("SharedProject");
604 }
605 print '</td></tr>';
606
607 // Location event
608 print '<tr><td>'.$langs->trans("Location").'</td><td>';
609 print dolPrintHTML($projectstatic->location);
610 print '</td></tr>';
611
612 // Other attributes
613 $cols = 2;
614 $objectconf = $object;
615 $object = $projectstatic;
616 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
617 $object = $objectconf;
618
619 print '</table>';
620
621 print '</div>';
622
623 print '<div class="fichehalfright">';
624 print '<div class="underbanner clearboth"></div>';
625
626 print '<table class="border tableforfield centpercent">';
627
628 // Categories
629 if (isModEnabled('category')) {
630 print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>';
631 print $form->showCategories($projectstatic->id, Categorie::TYPE_PROJECT, 1);
632 print "</td></tr>";
633 }
634
635 // Description
636 print '<tr><td class="titlefield'.($projectstatic->description ? ' noborderbottom' : '').'" colspan="2">'.$langs->trans("Description").'</td></tr>';
637 if ($projectstatic->description) {
638 print '<tr><td class="nottitleforfield" colspan="2">';
639 print '<div class="longmessagecut">';
640 print dolPrintHTML($projectstatic->description);
641 print '</div>';
642 print '</td></tr>';
643 }
644
645 print '<tr><td class="nowrap">';
646 $typeofdata = 'checkbox:'.($projectstatic->accept_conference_suggestions ? ' checked="checked"' : '');
647 $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp");
648 print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', $projectstatic->accept_conference_suggestions ? '1' : '0', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext);
649 print '</td><td>';
650 print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', $projectstatic->accept_conference_suggestions ? 1 : 0, $projectstatic, 0, $typeofdata, '', null, null, '', 0, '', 'projectid');
651 print "</td></tr>";
652
653 print '<tr><td>';
654 $typeofdata = 'checkbox:'.($projectstatic->accept_booth_suggestions ? ' checked="checked"' : '');
655 $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp");
656 print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', $projectstatic->accept_booth_suggestions ? '1' : '0', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext);
657 print '</td><td>';
658 print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', $projectstatic->accept_booth_suggestions ? 1 : 0, $projectstatic, 0, $typeofdata, '', null, null, '', 0, '', 'projectid');
659 print "</td></tr>";
660
661 print '<tr><td>';
662 print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
663 print '</td><td>';
664 print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', null, null, '', 0, '', 'projectid');
665 print "</td></tr>";
666
667 print '<tr><td>';
668 print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
669 print '</td><td>';
670 print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', null, null, '', 0, '', 'projectid');
671 print "</td></tr>";
672
673 print '<tr><td class="titlefield">';
674 print $form->editfieldkey($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', '', $projectstatic, $permissiontoadd, 'integer:3', '&withproject=1', 0, 0, 'projectid');
675 print '</td><td class="valuefield">';
676 print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $projectstatic->max_attendees, $projectstatic, $permissiontoadd, 'integer:3', '', null, null, '&withproject=1', 0, '', 'projectid');
677 print "</td></tr>";
678
679 // Link to ICS for the event
680 print '<tr><td class="titlefield valignmiddle">'.$langs->trans("EventOrganizationICSLinkProject").'</td><td class="valuefield">';
681 // Define $urlwithroot
682 $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
683 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
684
685 // Show message
686 $message = '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
687 $message .= '&exportkey='.urlencode(getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY', '...'));
688 $message .= "&project=".$projectid.'&module='.urlencode('project@eventorganization').'&output=file">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>';
689 print $message;
690 print "</td></tr>";
691
692 print '<tr><td class="valignmiddle">'.$langs->trans("EventOrganizationICSLink").'</td><td>';
693 // Define $urlwithroot
694 $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
695 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
696
697 // Show message
698 $message = '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
699 $message .= '&exportkey='.(getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY') ? urlencode(getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY')) : '...');
700 $message .= "&project=".$projectstatic->id.'&module='.urlencode('conforbooth@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'&output=file">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>';
701 print $message;
702 print "</td></tr>";
703
704 // Link to the submit vote/register page
705 print '<tr><td>';
706 //print '<span class="opacitymedium">';
707 print $form->textwithpicto($langs->trans("SuggestOrVoteForConfOrBooth"), $langs->trans("EvntOrgRegistrationHelpMessage"));
708 //print '</span>';
709 print '</td><td class="valuefield nowrap">';
710 $linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.$projectstatic->id;
711 $encodedsecurekey = dol_hash(getDolGlobalString("EVENTORGANIZATION_SECUREKEY").'conferenceorbooth'.$projectstatic->id, 'md5');
712 $linksuggest .= '&securekey='.urlencode($encodedsecurekey);
713 //print '<div class="urllink">';
714 //print '<input type="text" value="'.$linksuggest.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
715 print '<div class="tdoverflowmax150 inline-block valignmiddle"><a target="_blank" rel="noopener noreferrer" href="'.$linksuggest.'" class="quatrevingtpercent">'.$linksuggest.'</a></div>';
716 print '<a target="_blank" rel="noopener noreferrer" href="'.$linksuggest.'">'.img_picto('', 'globe').'</a>';
717 //print '</div>';
718 //print ajax_autoselect("linkregister");
719 print '</td></tr>';
720
721 // Link to the subscribe
722 print '<tr><td>';
723 //print '<span class="opacitymedium">';
724 print $langs->trans("PublicAttendeeSubscriptionGlobalPage");
725 //print '</span>';
726 print '</td><td>';
727 $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.$projectstatic->id.'&type=global';
728 $encodedsecurekey = dol_hash(getDolGlobalString("EVENTORGANIZATION_SECUREKEY").'conferenceorbooth'.$projectstatic->id, 'md5');
729 $link_subscription .= '&securekey='.urlencode($encodedsecurekey);
730 //print '<div class="urllink">';
731 //print '<input type="text" value="'.$linkregister.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
732 print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$link_subscription.'" class="quatrevingtpercent">'.$link_subscription.'</a></div>';
733 print '<a target="_blank" rel="noopener noreferrer" href="'.$link_subscription.'">'.img_picto('', 'globe').'</a>';
734 //print '</div>';
735 //print ajax_autoselect("linkregister");
736 print '</td></tr>';
737
738 print '</table>';
739
740 print '</div>';
741 print '</div>';
742
743 print '<div class="clearboth"></div>';
744
745 print dol_get_fiche_end();
746
747 if (empty($confOrBooth->id)) {
748 $head = conferenceorboothProjectPrepareHead($projectstatic);
749 $tab = 'attendees';
750 print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, '', 0, '', 'reposition');
751 }
752 }
753
754 if ($confOrBooth->id > 0) {
755 $head = conferenceorboothPrepareHead($confOrBooth, $withproject);
756
757 print dol_get_fiche_head($head, 'attendees', $langs->trans("ConferenceOrBooth"), -1, $object->picto);
758
759 $object_evt = $object;
760 $object = $confOrBooth;
761
762 dol_banner_tab($object, 'ref', '', 0);
763
764 print '<div class="fichecenter">';
765 print '<div class="fichehalfleft">';
766 print '<div class="underbanner clearboth"></div>';
767 print '<table class="border centpercent tableforfield">' . "\n";
768
769 include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
770
771 // Other attributes. Fields from hook formObjectOptions and Extrafields.
772 include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
773 $object = $object_evt;
774 print '</table>';
775 print '</div>';
776 print '</div>';
777
778 print '<div class="clearboth"></div>';
779
780 print dol_get_fiche_end();
781 }
782}
783
784$arrayofselected = is_array($toselect) ? $toselect : array();
785
786$param = '';
787if (!empty($mode)) {
788 $param .= '&mode='.urlencode($mode);
789}
790if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
791 $param .= '&contextpage='.urlencode($contextpage);
792}
793if ($limit > 0 && $limit != $conf->liste_limit) {
794 $param .= '&limit='.((int) $limit);
795}
796if ($optioncss != '') {
797 $param .= '&optioncss='.urlencode($optioncss);
798}
799if ($confOrBooth->id > 0) {
800 $param .= '&conforboothid='.urlencode((string) $confOrBooth->id);
801}
802if ($projectstatic->id > 0) {
803 $param .= '&fk_project='.urlencode((string) ($projectstatic->id));
804}
805foreach ($search as $key => $val) {
806 if (is_array($search[$key])) {
807 foreach ($search[$key] as $skey) {
808 if ($skey != '') {
809 $param .= '&search_'.$key.'[]='.urlencode($skey);
810 }
811 }
812 } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
813 $param .= '&search_'.$key.'month='.(GETPOSTINT('search_'.$key.'month'));
814 $param .= '&search_'.$key.'day='.(GETPOSTINT('search_'.$key.'day'));
815 $param .= '&search_'.$key.'year='.(GETPOSTINT('search_'.$key.'year'));
816 } elseif ($search[$key] != '') {
817 $param .= '&search_'.$key.'='.urlencode($search[$key]);
818 }
819}
820$param .= $withProjectUrl;
821
822// Add $param from extra fields
823include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
824// Add $param from hooks
825$parameters = array('param' => &$param);
826$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
827$param .= $hookmanager->resPrint;
828
829// List of mass actions available
830$arrayofmassactions = array(
831 //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
832 //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
833 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
834 'presend' => img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
835);
836if (!empty($permissiontodelete)) {
837 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
838}
839if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) {
840 $arrayofmassactions = array();
841}
842$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
843
844print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].(!empty($conf_or_booth_id) ? '?conforboothid='.$conf_or_booth_id : '').'">'."\n";
845if ($optioncss != '') {
846 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
847}
848print '<input type="hidden" name="token" value="'.newToken().'">';
849print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
850print '<input type="hidden" name="action" value="list">';
851print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
852print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
853print '<input type="hidden" name="page" value="'.$page.'">';
854print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
855print '<input type="hidden" name="withproject" value="'.$withproject.'">';
856print '<input type="hidden" name="fk_project" value="'.$fk_project.'">';
857print '<input type="hidden" name="page_y" value="">';
858print '<input type="hidden" name="mode" value="'.$mode.'">';
859
860$params = array('morecss' => 'reposition');
861
862$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);
863
864$newcardbutton = '';
865$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $urlnew, '', $permissiontoadd, $params);
866
867print_barre_liste($subtitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
868
869
870// Add code for pre mass action (confirmation or email presend form)
871$topicmail = $projectstatic->title;
872$modelmail = "conferenceorbooth";
873$objecttmp = new ConferenceOrBoothAttendee($db);
874$trackid = 'conferenceorbooth_'.$object->id;
875$withmaindocfilemail = 0;
876include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
877
878
879if ($search_all) {
880 $setupstring = '';
881 foreach ($fieldstosearchall as $key => $val) {
882 $fieldstosearchall[$key] = $langs->trans($val);
883 $setupstring .= $key."=".$val.";";
884 }
885 print '<!-- Search done like if CONFERENCEORBOOTHATTENDEE_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
886 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>';
887}
888
889$moreforfilter = '';
890/*$moreforfilter.='<div class="divsearchfield">';
891$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
892$moreforfilter.= '</div>';*/
893
894$parameters = array();
895$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
896if (empty($reshook)) {
897 $moreforfilter .= $hookmanager->resPrint;
898} else {
899 $moreforfilter = $hookmanager->resPrint;
900}
901
902if (!empty($moreforfilter)) {
903 print '<div class="liste_titre liste_titre_bydiv centpercent">';
904 print $moreforfilter;
905 print '</div>';
906}
907
908$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
909$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields with user setup
910$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
911$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
912
913
914print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
915print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
916
917
918// Fields title search
919// --------------------------------------------------------------------
920print '<tr class="liste_titre_filter">';
921// Action column
922if ($conf->main_checkbox_left_column) {
923 print '<td class="liste_titre center maxwidthsearch">';
924 $searchpicto = $form->showFilterButtons('left');
925 print $searchpicto;
926 print '</td>';
927}
928foreach ($object->fields as $key => $val) {
929 $searchkey = empty($search[$key]) ? '' : $search[$key];
930 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
931 if ($key == 'status') {
932 $cssforfield .= ($cssforfield ? ' ' : '').'center';
933 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
934 $cssforfield .= ($cssforfield ? ' ' : '').'center';
935 } elseif (in_array($val['type'], array('timestamp'))) {
936 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
937 } 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'])) {
938 $cssforfield .= ($cssforfield ? ' ' : '').'right';
939 }
940 if (!empty($arrayfields['t.'.$key]['checked'])) {
941 print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').($key == 'status' ? ' parentonrightofpage' : '').'">';
942 if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
943 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);
944 } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
945 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
946 } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
947 print '<div class="nowrap">';
948 print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
949 print '</div>';
950 print '<div class="nowrap">';
951 print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
952 print '</div>';
953 } elseif ($key == 'lang') {
954 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
955 $formadmin = new FormAdmin($db);
956 print $formadmin->select_language($search[$key], 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2);
957 } else {
958 print '<input type="text" class="flat maxwidth'.($val['type'] == 'integer' ? '50' : '75').'" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
959 }
960 print '</td>';
961 }
962}
963// Extra fields
964include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
965
966// Fields from hook
967$parameters = array('arrayfields' => $arrayfields);
968$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
969print $hookmanager->resPrint;
970// Action column
971if (!$conf->main_checkbox_left_column) {
972 print '<td class="liste_titre center maxwidthsearch">';
973 $searchpicto = $form->showFilterButtons();
974 print $searchpicto;
975 print '</td>';
976}
977print '</tr>'."\n";
978
979$totalarray = array();
980$totalarray['nbfield'] = 0;
981
982// Fields title label
983// --------------------------------------------------------------------
984print '<tr class="liste_titre">';
985// Action column
986if ($conf->main_checkbox_left_column) {
987 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
988 $totalarray['nbfield']++;
989}
990foreach ($object->fields as $key => $val) {
991 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
992 if ($key == 'status') {
993 $cssforfield .= ($cssforfield ? ' ' : '').'center';
994 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
995 $cssforfield .= ($cssforfield ? ' ' : '').'center';
996 } elseif (in_array($val['type'], array('timestamp'))) {
997 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
998 } 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'])) {
999 $cssforfield .= ($cssforfield ? ' ' : '').'right';
1000 }
1001 $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
1002 if (!empty($arrayfields['t.'.$key]['checked'])) {
1003 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";
1004 $totalarray['nbfield']++;
1005 }
1006}
1007// Extra fields
1008include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
1009// Hook fields
1010$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
1011$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1012print $hookmanager->resPrint;
1013// Action column
1014if (!$conf->main_checkbox_left_column) {
1015 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
1016 $totalarray['nbfield']++;
1017}
1018print '</tr>'."\n";
1019
1020
1021// Detect if we need a fetch on each output line
1022$needToFetchEachLine = 0;
1023if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
1024 foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
1025 if (!is_null($val) && preg_match('/\$object/', $val)) {
1026 $needToFetchEachLine++; // There is at least one compute field that use $object
1027 }
1028 }
1029}
1030
1031
1032// Loop on record
1033// --------------------------------------------------------------------
1034$i = 0;
1035$savnbfield = $totalarray['nbfield'];
1036$totalarray = array();
1037$totalarray['nbfield'] = 0;
1038$imaxinloop = ($limit ? min($num, $limit) : $num);
1039while ($i < $imaxinloop) {
1040 $obj = $db->fetch_object($resql);
1041 if (empty($obj)) {
1042 break; // Should not happen
1043 }
1044
1045 // Store properties in $object
1046 $object->setVarsFromFetchObj($obj);
1047
1048 if ($mode == 'kanban') {
1049 if ($i == 0) {
1050 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
1051 print '<div class="box-flex-container kanban">';
1052 }
1053 // Output Kanban
1054 $selected = -1;
1055 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1056 $selected = 0;
1057 if (in_array($object->id, $arrayofselected)) {
1058 $selected = 1;
1059 }
1060 }
1061 print $object->getKanbanView('', array('selected' => $selected));
1062 if ($i == ($imaxinloop - 1)) {
1063 print '</div>';
1064 print '</td></tr>';
1065 }
1066 } else {
1067 // Show line of result
1068 $j = 0;
1069 print '<tr data-rowid="'.$object->id.'" class="oddeven">';
1070 // Action column
1071 if ($conf->main_checkbox_left_column) {
1072 print '<td class="nowrap center">';
1073 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1074 $selected = 0;
1075 if (in_array($object->id, $arrayofselected)) {
1076 $selected = 1;
1077 }
1078 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
1079 }
1080 print '</td>';
1081 if (!$i) {
1082 $totalarray['nbfield']++;
1083 }
1084 }
1085 foreach ($object->fields as $key => $val) {
1086 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
1087 if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
1088 $cssforfield .= ($cssforfield ? ' ' : '').'center';
1089 } elseif ($key == 'status') {
1090 $cssforfield .= ($cssforfield ? ' ' : '').'center';
1091 }
1092
1093 if (in_array($val['type'], array('timestamp'))) {
1094 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
1095 } elseif ($key == 'ref') {
1096 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
1097 }
1098
1099 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'])) {
1100 $cssforfield .= ($cssforfield ? ' ' : '').'right';
1101 }
1102 //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
1103
1104 if (!empty($arrayfields['t.'.$key]['checked'])) {
1105 print '<td'.($cssforfield ? ' class="'.$cssforfield.(preg_match('/tdoverflow/', $cssforfield) ? ' classfortooltip' : '').'"' : '');
1106 if (preg_match('/tdoverflow/', $cssforfield) && !is_numeric($object->$key)) {
1107 print ' title="'.dol_escape_htmltag((string) $object->$key).'"';
1108 }
1109 print '>';
1110 if ($key == 'status') {
1111 print $object->getLibStatut(5);
1112 } elseif ($key == 'ref') {
1113 $optionLink = (!empty($withproject) ? 'conforboothidproject' : 'conforboothid');
1114 if (empty($confOrBooth->id)) {
1115 $optionLink = 'projectid';
1116 }
1117 print $object->getNomUrl(1, $optionLink);
1118 } else {
1119 print $object->showOutputField($val, $key, (string) $object->$key, '');
1120 }
1121 print '</td>';
1122 if (!$i) {
1123 $totalarray['nbfield']++;
1124 }
1125 if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
1126 if (!$i) {
1127 $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
1128 }
1129 if (!isset($totalarray['val'])) {
1130 $totalarray['val'] = array();
1131 }
1132 if (!isset($totalarray['val']['t.'.$key])) {
1133 $totalarray['val']['t.'.$key] = 0;
1134 }
1135 $totalarray['val']['t.'.$key] += $object->$key;
1136 }
1137 }
1138 }
1139 // Extra fields
1140 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1141 // Fields from hook
1142 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
1143 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1144 print $hookmanager->resPrint;
1145 // Action column
1146 if (!$conf->main_checkbox_left_column) {
1147 print '<td class="nowrap center">';
1148 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1149 $selected = 0;
1150 if (in_array($object->id, $arrayofselected)) {
1151 $selected = 1;
1152 }
1153 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
1154 }
1155 print '</td>';
1156 if (!$i) {
1157 $totalarray['nbfield']++;
1158 }
1159 }
1160
1161 print '</tr>'."\n";
1162 }
1163
1164 $i++;
1165}
1166
1167// Show total line
1168include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1169
1170// If no record found
1171if ($num == 0) {
1172 $colspan = 1;
1173 foreach ($arrayfields as $key => $val) {
1174 if (!empty($val['checked'])) {
1175 $colspan++;
1176 }
1177 }
1178 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1179}
1180
1181
1182$db->free($resql);
1183
1184$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
1185$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1186print $hookmanager->resPrint;
1187
1188print '</table>'."\n";
1189print '</div>'."\n";
1190
1191print '</form>'."\n";
1192
1193if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
1194 $hidegeneratedfilelistifempty = 1;
1195 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
1196 $hidegeneratedfilelistifempty = 0;
1197 }
1198
1199 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
1200 $formfile = new FormFile($db);
1201
1202 // Show list of available documents
1203 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
1204 $urlsource .= str_replace('&amp;', '&', $param);
1205
1206 $filedir = $diroutputmassaction;
1207 $genallowed = $permissiontoread;
1208 $delallowed = $permissiontoadd;
1209
1210 print $formfile->showdocuments('massfilesarea_eventorganization', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
1211}
1212
1213// End of page
1214llxFooter();
1215$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 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.
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.
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.