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