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