dolibarr 23.0.3
conferenceorboothattendee_card.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
4 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
5 * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
28// Load Dolibarr environment
29require '../main.inc.php';
39require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
40require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
41require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
42require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
43require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
44require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
45require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php';
46require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php';
47require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
48
49// Load translation files required by the page
50$langs->loadLangs(array("eventorganization", "other", "projects", "companies"));
51
52// Get parameters
53$action = GETPOST('action', 'aZ09');
54$confirm = GETPOST('confirm', 'alpha');
55$cancel = GETPOST('cancel');
56$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'conferenceorboothattendeecard'; // To manage different context of search
57$backtopage = GETPOST('backtopage', 'alpha');
58$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
59$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
60$mode = GETPOST('mode', 'aZ');
61
62$id = GETPOSTINT('id');
63$ref = GETPOST('ref', 'alpha');
64
65$lineid = GETPOSTINT('lineid');
66
67$conf_or_booth_id = GETPOSTINT('conforboothid');
68$fk_project = GETPOSTINT('fk_project');
69$withproject = 1;
70
71// Initialize a technical objects
73$extrafields = new ExtraFields($db);
74$projectstatic = new Project($db);
75$diroutputmassaction = $conf->eventorganization->dir_output.'/temp/massgeneration/'.$user->id;
76$hookmanager->initHooks(array($contextpage, 'globalcard')); // Note that conf->hooks_modules contains array
77
78$confOrBooth = null;
79if ($conf_or_booth_id > 0) {
80 $confOrBooth = new ConferenceOrBooth($db); // Actioncomm
81 $result = $confOrBooth->fetch($conf_or_booth_id);
82 if ($result < 0) {
83 setEventMessages(null, $confOrBooth->errors, 'errors');
84 } else {
85 $object->fk_actioncomm = $confOrBooth->id;
86 $object->fk_project = $confOrBooth->fk_project;
87 $fk_project = $object->fk_project;
88 }
89}
90
91// Fetch optionals attributes and labels
92$extrafields->fetch_name_optionals_label($object->table_element);
93
94$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
95
96// Initialize array of search criteria
97$search_all = GETPOST('search_all', 'alphanohtml');
98$search = array();
99foreach ($object->fields as $key => $val) {
100 if (GETPOST('search_'.$key, 'alpha') !== '') {
101 $search[$key] = GETPOST('search_'.$key, 'alpha');
102 }
103 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
104 $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOSTINT('search_'.$key.'_dtstartmonth'), GETPOSTINT('search_'.$key.'_dtstartday'), GETPOSTINT('search_'.$key.'_dtstartyear'));
105 $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOSTINT('search_'.$key.'_dtendmonth'), GETPOSTINT('search_'.$key.'_dtendday'), GETPOSTINT('search_'.$key.'_dtendyear'));
106 }
107}
108
109// List of fields to search into when doing a "search in all"
110$fieldstosearchall = array();
111foreach ($object->fields as $key => $val) {
112 if (!empty($val['searchall'])) {
113 $fieldstosearchall['t.'.$key] = $val['label'];
114 }
115}
116
117if (empty($action) && empty($id) && empty($ref)) {
118 $action = 'view';
119}
120
121// Load object
122include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'.
123
124// Now we have loaded the attendee, we can force the project (in case value provided as parameter is wrong or value not provided)
125if ($object->fk_project > 0) {
126 $fk_project = $object->fk_project;
127}
128
129// Permissions
130$permissiontoread = $user->hasRight('project', 'read');
131$permissiontoadd = $user->hasRight('project', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
132$permissiontodelete = $user->hasRight('project', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
133$permissionnote = $user->hasRight('project', 'write'); // Used by the include of actions_setnotes.inc.php
134$permissiondellink = $user->hasRight('project', 'write'); // Used by the include of actions_dellink.inc.php
135$upload_dir = $conf->eventorganization->multidir_output[isset($object->entity) ? $object->entity : 1];
136
137// Security check
138if ($user->socid > 0) {
140}
141
142restrictedArea($user, 'projet', $object->fk_project, 'projet&project');
143
144
145/*
146 * Actions
147 */
148
149$parameters = array();
150$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
151if ($reshook < 0) {
152 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
153}
154
155if (empty($reshook)) {
156 //if (!empty($withproject)) {
157 $backurlforlist = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_list.php?withproject=1&fk_project='.((int) $fk_project);
158 //} else {
159 // $backurlforlist = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_list.php';
160 //}
161
162 if (empty($backtopage) || ($cancel && empty($id))) {
163 if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
164 if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
165 $backtopage = $backurlforlist;
166 } else {
167 $backtopage = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?fk_project='.((int) $fk_project).'&id='.($id > 0 ? $id : '__ID__').'&withproject=1';
168 }
169 }
170 }
171
172 if ($cancel) {
173 if (!empty($backtopageforcancel)) {
174 header("Location: ".$backtopageforcancel);
175 exit;
176 } elseif (!empty($backtopage)) {
177 header("Location: ".$backtopage);
178 exit;
179 }
180 $action = '';
181 }
182
183 $triggermodname = 'EVENTORGANIZATION_CONFERENCEORBOOTHATTENDEE_MODIFY'; // Name of trigger action code to execute when we modify record
184
185 // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
186 include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
187
188 // Actions when linking object each other
189 include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';
190
191 // Actions when printing a doc from card
192 include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
193
194 // Action to move up and down lines of object
195 //include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php';
196
197 // Action to build doc
198 include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
199
200 if ($action == 'set_thirdparty' && $permissiontoadd) {
201 $object->setValueFrom('fk_soc', GETPOSTINT('fk_soc'), '', null, 'date', '', $user, $triggermodname);
202 }
203 if ($action == 'classin' && $permissiontoadd) {
204 $object->setProject(GETPOSTINT('projectid'));
205 }
206
207 // Actions to send emails
208 $triggersendname = 'EVENTORGANIZATION_CONFERENCEORBOOTHATTENDEE_SENTBYMAIL';
209 $autocopy = 'MAIN_MAIL_AUTOCOPY_CONFERENCEORBOOTHATTENDEE_TO';
210 $trackid = 'conferenceorboothattendee'.$object->id;
211 include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
212}
213
214
215
216
217/*
218 * View
219 */
220
221$form = new Form($db);
222$formfile = new FormFile($db);
223$formproject = new FormProjets($db);
224
225$title = $langs->trans("ConferenceOrBoothAttendee");
226$help_url = 'EN:Module_Event_Organization';
227
228llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-eventorganization page-attendee-card');
229
230if ($action == 'create') {
231 $result = $projectstatic->fetch(GETPOSTINT('fk_project'));
232} else {
233 $result = $projectstatic->fetch(($confOrBooth === null || empty($confOrBooth->fk_project)) ? $fk_project : $confOrBooth->fk_project);
234}
235if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) {
236 $projectstatic->fetchComments();
237}
238if (!empty($projectstatic->socid)) {
239 $projectstatic->fetch_thirdparty();
240}
241
242$withProjectUrl = '';
243$object->project = clone $projectstatic;
244
245if (!empty($withproject)) {
246 // Tabs for project
247 $tab = 'eventorganisation';
248 $withProjectUrl = "&withproject=1";
249
250 $head = project_prepare_head($projectstatic);
251
252 print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'), 0, '', '');
253
254 $param = ($mode == 'mine' ? '&mode=mine' : '');
255
256 // Project card
257
258 $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
259
260 $morehtmlref = '<div class="refidno">';
261 // Title
262 $morehtmlref .= $projectstatic->title;
263 // Thirdparty
264 if (isset($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) {
265 $morehtmlref .= '<br>'.$projectstatic->thirdparty->getNomUrl(1, 'project');
266 }
267 $morehtmlref .= '</div>';
268
269 // Define a complementary filter for search of next/prev ref.
270 if (!$user->hasRight('project', 'all', 'lire')) {
271 $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
272 $projectstatic->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0');
273 }
274
275 dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
276
277 print '<div class="fichecenter">';
278 print '<div class="fichehalfleft">';
279 print '<div class="underbanner clearboth"></div>';
280
281 print '<table class="border tableforfield centpercent">';
282
283 // Usage
284 if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') || !getDolGlobalString('PROJECT_HIDE_TASKS') || isModEnabled('eventorganization')) {
285 print '<tr><td class="tdtop">';
286 print $langs->trans("Usage");
287 print '</td>';
288 print '<td>';
289 if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) {
290 print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_opportunity ? ' checked="checked"' : '')).'"> ';
291 $htmltext = $langs->trans("ProjectFollowOpportunity");
292 print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
293 print '<br>';
294 }
295 if (!getDolGlobalString('PROJECT_HIDE_TASKS')) {
296 print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_task ? ' checked="checked"' : '')).'"> ';
297 $htmltext = $langs->trans("ProjectFollowTasks");
298 print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
299 print '<br>';
300 }
301 if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) {
302 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"' : '')).'"> ';
303 $htmltext = $langs->trans("ProjectBillTimeDescription");
304 print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
305 print '<br>';
306 }
307 if (isModEnabled('eventorganization')) {
308 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"' : '')).'"> ';
309 $htmltext = $langs->trans("EventOrganizationDescriptionLong");
310 print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
311 }
312 print '</td></tr>';
313 }
314
315 // Budget
316 print '<tr><td>'.$langs->trans("Budget").'</td><td>';
317 if (strcmp($projectstatic->budget_amount, '')) {
318 print '<span class="amount">'.price($projectstatic->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).'</span>';
319 }
320 print '</td></tr>';
321
322 // Date start - end project
323 print '<tr><td>'.$langs->trans("Dates").' ('.$langs->trans("Project").')</td><td>';
324 $start = dol_print_date($projectstatic->date_start, 'day');
325 print($start ? $start : '?');
326 $end = dol_print_date($projectstatic->date_end, 'day');
327 print ' - ';
328 print($end ? $end : '?');
329 if ($projectstatic->hasDelay()) {
330 print img_warning("Late");
331 }
332 print '</td></tr>';
333
334 // Date start - end of event
335 print '<tr><td>'.$langs->trans("Dates").' ('.$langs->trans("Event").')</td><td>';
336 $start = dol_print_date($projectstatic->date_start_event, 'day');
337 print($start ? $start : '?');
338 $end = dol_print_date($projectstatic->date_end_event, 'day');
339 print ' - ';
340 print($end ? $end : '?');
341 if ($projectstatic->hasDelay()) {
342 print img_warning("Late");
343 }
344 print '</td></tr>';
345
346 // Visibility
347 print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
348 if ($projectstatic->public == 0) {
349 print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"');
350 print $langs->trans("PrivateProject");
351 } else {
352 print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"');
353 print $langs->trans("SharedProject");
354 }
355 print '</td></tr>';
356
357 // Location event
358 print '<tr><td>'.$langs->trans("Location").'</td><td>';
359 print $projectstatic->location;
360 print '</td></tr>';
361
362 // Other attributes
363 $cols = 2;
364 $objectconf = $object;
365 $object = $projectstatic;
366 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
367 $object = $objectconf;
368
369 print '</table>';
370
371 print '</div>';
372
373 print '<div class="fichehalfright">';
374 print '<div class="underbanner clearboth"></div>';
375
376 print '<table class="border tableforfield centpercent">';
377
378 // Categories
379 if (isModEnabled('category')) {
380 print '<tr><td class="titlefield valignmiddle">'.$langs->trans("Categories").'</td><td class="valuefield">';
381 print $form->showCategories($projectstatic->id, Categorie::TYPE_PROJECT, 1);
382 print "</td></tr>";
383 }
384
385 // Description
386 print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
387 print dol_htmlentitiesbr($projectstatic->description);
388 print '</td></tr>';
389
390 print '<tr><td class="ntitlefield owrap">';
391 $typeofdata = 'checkbox:'.($projectstatic->accept_conference_suggestions ? ' checked="checked"' : '');
392 $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp");
393 print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext);
394 print '</td><td>';
395 print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, null, '', 0, '', 'projectid');
396 print "</td></tr>";
397
398 print '<tr><td>';
399 $typeofdata = 'checkbox:'.($projectstatic->accept_booth_suggestions ? ' checked="checked"' : '');
400 $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp");
401 print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext);
402 print '</td><td>';
403 print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, null, '', 0, '', 'projectid');
404 print "</td></tr>";
405
406 print '<tr><td>';
407 print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
408 print '</td><td>';
409 print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', null, null, '', 0, '', 'projectid');
410 print "</td></tr>";
411
412 print '<tr><td>';
413 print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
414 print '</td><td>';
415 print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', null, null, '', 0, '', 'projectid');
416 print "</td></tr>";
417
418 print '<tr><td class="titlefield">';
419 print $form->editfieldkey($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', '', $projectstatic, $permissiontoadd, 'integer:3', '', 0, 0, 'projectid');
420 print '</td><td class="valuefield">';
421 print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $projectstatic->max_attendees, $projectstatic, $permissiontoadd, 'integer:3', '', null, null, '', 0, '', 'projectid');
422 print "</td></tr>";
423
424 // Link to ICS for the event
425 print '<tr><td class="titlefield valignmiddle">'.$langs->trans("EventOrganizationICSLinkProject").'</td><td class="valuefield">';
426 // Define $urlwithroot
427 $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
428 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
429
430 // Show message
431 $message = '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
432 $message .= '&exportkey='.urlencode(getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY', '...'));
433 $message .= "&project=".$projectstatic->id.'&module='.urlencode('project@eventorganization').'&file='.urlencode('calendar-'.$projectstatic->ref.'.ics').'&output=file">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>';
434 print $message;
435 print "</td></tr>";
436
437 // Link for ICS for conference or booth
438 print '<tr><td class="titlefield valignmiddle">'.$langs->trans("EventOrganizationICSLink").'</td><td>';
439 // Define $urlwithroot
440 $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
441 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
442
443 // Show message
444 $message = '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
445 $message .= '&exportkey='.urlencode(getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY', '...'));
446 $message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>';
447 print $message;
448 print "</td></tr>";
449
450 // Link to the submit vote/register page
451 print '<tr><td>';
452 //print '<span class="opacitymedium">';
453 print $form->textwithpicto($langs->trans("SuggestOrVoteForConfOrBooth"), $langs->trans("EvntOrgRegistrationHelpMessage"));
454 //print '</span>';
455 print '</td><td>';
456 $linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.((int) $projectstatic->id);
457 $encodedsecurekey = dol_hash(getDolGlobalString("EVENTORGANIZATION_SECUREKEY").'conferenceorbooth'.((int) $projectstatic->id), 'md5');
458 $linksuggest .= '&securekey='.urlencode($encodedsecurekey);
459 //print '<div class="urllink">';
460 //print '<input type="text" value="'.$linksuggest.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
461 print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$linksuggest.'" class="quatrevingtpercent">'.$linksuggest.'</a></div>';
462 print '<a target="_blank" rel="noopener noreferrer" href="'.$linksuggest.'">'.img_picto('', 'globe').'</a>';
463 //print '</div>';
464 //print ajax_autoselect("linkregister");
465 print '</td></tr>';
466
467 // Link to the subscribe
468 print '<tr><td>';
469 //print '<span class="opacitymedium">';
470 print $langs->trans("PublicAttendeeSubscriptionGlobalPage");
471 //print '</span>';
472 print '</td><td>';
473 $link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.((int) $projectstatic->id).'&type=global';
474 $encodedsecurekey = dol_hash(getDolGlobalString("EVENTORGANIZATION_SECUREKEY").'conferenceorbooth'.((int) $projectstatic->id), 'md5');
475 $link_subscription .= '&securekey='.urlencode($encodedsecurekey);
476 //print '<div class="urllink">';
477 //print '<input type="text" value="'.$linkregister.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
478 print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$link_subscription.'" class="quatrevingtpercent">'.$link_subscription.'</a></div>';
479 print '<a target="_blank" rel="noopener noreferrer" href="'.$link_subscription.'">'.img_picto('', 'globe').'</a>';
480 //print '</div>';
481 //print ajax_autoselect("linkregister");
482 print '</td></tr>';
483
484 print '</table>';
485
486 print '</div>';
487 print '</div>';
488
489 print '<div class="clearboth"></div>';
490
491 print dol_get_fiche_end();
492
493 print '<br>';
494}
495
496// Part to create an attendee
497if ($action == 'create' && $confOrBooth === null) {
498 print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("ConferenceOrBoothAttendee")), '', 'object_'.$object->picto);
499
500
501 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].(empty($withproject) ? '' : '?withproject=1').'">';
502 print '<input type="hidden" name="token" value="'.newToken().'">';
503 print '<input type="hidden" name="action" value="add">';
504
505 if ($projectstatic->id > 0) {
506 print '<input type="hidden" name="fk_project" value="'.$projectstatic->id.'">';
507 print '<input type="hidden" name="projectid" value="'.$projectstatic->id.'">';
508 }
509
510 if ($backtopage) {
511 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
512 }
513 if ($backtopageforcancel) {
514 print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
515 }
516
517 print dol_get_fiche_head(array(), '');
518
519 print '<table class="border centpercent tableforfieldcreate">'."\n";
520
521 // Common attributes
522 include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
523
524 // Other attributes
525 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
526
527 print '</table>'."\n";
528
529 print dol_get_fiche_end();
530
531 print $form->buttonsSaveCancel("Create");
532
533 print '</form>';
534
535 //dol_set_focus('input[name="ref"]');
536}
537
538// Part to edit attendee
539if (($id || $ref) && $action == 'edit') {
540 print load_fiche_titre($langs->trans("ConferenceOrBoothAttendee"), '', 'object_'.$object->picto);
541
542 print '<form method="POST" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
543 print '<input type="hidden" name="token" value="'.newToken().'">';
544 print '<input type="hidden" name="action" value="update">';
545 print '<input type="hidden" name="id" value="'.$object->id.'">';
546 if (is_object($confOrBooth) && $confOrBooth->id > 0) {
547 print '<input type="hidden" name="conforboothid" value="'.$confOrBooth->id.'">';
548 }
549 if ($object->fk_actioncomm > 0) {
550 print '<input type="hidden" name="fk_actioncomm" value="'.$object->fk_actioncomm.'">';
551 }
552 if ($backtopage) {
553 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
554 }
555 if ($backtopageforcancel) {
556 print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
557 }
558 if ($projectstatic->id > 0) {
559 print '<input type="hidden" name="fk_project" value="'.$projectstatic->id.'">';
560 }
561
562 print dol_get_fiche_head();
563
564 print '<table class="border centpercent tableforfieldedit">'."\n";
565
566 // Common attributes
567 include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
568
569 // Other attributes
570 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
571
572 print '</table>';
573
574 print dol_get_fiche_end();
575
576 print $form->buttonsSaveCancel();
577
578 print '</form>';
579}
580
581// Part to show attendee
582if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
583 $object->fetch_optionals();
584
585 $moreparam = '';
586 if ($withproject) {
587 $moreparam .= '&withproject=1';
588 }
589 if ($fk_project) {
590 $moreparam .= '&fk_project='.((int) $fk_project);
591 }
592
594 print dol_get_fiche_head($head, 'card', $langs->trans("ConferenceOrBoothAttendee"), -1, $object->picto);
595
596 $formconfirm = '';
597
598 // Confirmation to delete
599 if ($action == 'delete') {
600 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteConferenceOrBoothAttendee'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
601 }
602 // Confirmation to delete line
603 if ($action == 'deleteline') {
604 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
605 }
606 // Clone confirmation
607 if ($action == 'clone') {
608 // Create an array for form
609 $formquestion = array();
610 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
611 }
612
613 // Call Hook formConfirm
614 $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
615 $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
616 if (empty($reshook)) {
617 $formconfirm .= $hookmanager->resPrint;
618 } elseif ($reshook > 0) {
619 $formconfirm = $hookmanager->resPrint;
620 }
621
622 // Print form confirm
623 print $formconfirm;
624
625 // Object card
626 // ------------------------------------------------------------
627 $linkback = '<a href="'.dol_buildpath('/eventorganization/conferenceorboothattendee_list.php', 1).'?restore_lastsearch_values=1'.$moreparam.'">'.$langs->trans("BackToList").'</a>';
628
629 $morehtmlref = '<div class="refidno">';
630
631 $morehtmlref .= '</div>';
632
633 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $moreparam);
634
635 print '<div class="fichecenter">';
636 print '<div class="fichehalfleft">';
637 print '<div class="underbanner clearboth"></div>';
638 print '<table class="border centpercent tableforfield">'."\n";
639
640 // Common attributes
641 //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field
642 //unset($object->fields['fk_project']); // Hide field already shown in banner
643 //unset($object->fields['fk_soc']); // Hide field already shown in banner
644 $keyforbreak = 'num_vote';
645
646 include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
647
648 // Other attributes. Fields from hook formObjectOptions and Extrafields.
649 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
650
651 print '</table>';
652 print '</div>';
653 print '</div>';
654
655 print '<div class="clearboth"></div>';
656
657 print dol_get_fiche_end();
658
659 // Buttons for actions
660
661 if ($action != 'presend' && $action != 'editline') {
662 print '<div class="tabsAction">'."\n";
663 $parameters = array();
664 $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
665 if ($reshook < 0) {
666 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
667 }
668
669 if (empty($reshook)) {
670 // Send
671 if (empty($user->socid)) {
672 print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.(is_object($confOrBooth) && !empty($confOrBooth->id) ? '&conforboothid='.$confOrBooth->id : '').(!empty($projectstatic->id) ? '&fk_project='.$projectstatic->id : '').'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
673 }
674 print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(is_object($confOrBooth) && !empty($confOrBooth->id) ? '&conforboothid='.$confOrBooth->id : '').(!empty($projectstatic->id) ? '&fk_project='.$projectstatic->id : '').'&action=edit&token='.newToken(), '', $permissiontoadd);
675
676 // Clone
677 print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=clone&token='.newToken().(!empty($projectstatic->id) ? '&fk_project='.$projectstatic->id : ''), '', $permissiontoadd);
678
679 // Delete (need delete permission, or if draft, just need create/modify permission)
680 print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken().(!empty($projectstatic->id) ? '&fk_project='.$projectstatic->id : ''), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd));
681 }
682 print '</div>'."\n";
683 }
684
685
686 // Select mail models is same action as presend
687 if (GETPOST('modelselected')) {
688 $action = 'presend';
689 }
690
691 if ($action != 'presend') {
692 print '<div class="fichecenter"><div class="fichehalfleft">';
693 print '<a name="builddoc"></a>'; // ancre
694
695 $includedocgeneration = 0;
696
697 // Documents
698 if ($includedocgeneration) {
699 $objref = dol_sanitizeFileName($object->ref);
700 $relativepath = $objref.'/'.$objref.'.pdf';
701 $filedir = $conf->eventorganization->dir_output.'/'.$object->element.'/'.$objref;
702 $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
703 $genallowed = $user->hasRight('project', 'conferenceorboothattendee', 'read'); // If you can read, you can build the PDF to read content
704 $delallowed = $user->hasRight('project', 'conferenceorboothattendee', 'write'); // If you can create/edit, you can remove a file on card
705 print $formfile->showdocuments('eventorganization:ConferenceOrBoothAttendee', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, (string) $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
706 }
707
708 // Show links to link elements
709 $tmparray = $form->showLinkToObjectBlock($object, array(), array('conferenceorboothattendee'), 1);
710 $linktoelem = $tmparray['linktoelem'];
711 $htmltoenteralink = $tmparray['htmltoenteralink'];
712 print $htmltoenteralink;
713
714 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
715
716
717 print '</div><div class="fichehalfright">';
718
719 print '</div></div>';
720 }
721
722 //Select mail models is same action as presend
723 if (GETPOST('modelselected')) {
724 $action = 'presend';
725 }
726
727 // Presend form
728 $modelmail = 'conferenceorboothattendee';
729 $defaulttopic = 'InformationMessage';
730 $diroutput = $conf->eventorganization->dir_output;
731 $trackid = 'conferenceorboothattendee'.$object->id;
732
733 include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
734}
735
736// End of page
737llxFooter();
738$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
global $dolibarr_main_url_root
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class for ConferenceOrBoothAttendee.
Class for ConferenceOrBooth.
Class to manage standard extra fields.
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 building of HTML components.
Class to manage projects.
print $langs trans("Ref").' m titre as m m statut as status
Or an array listing all the potential status of the object: array: int of the status => translated la...
Definition index.php:171
conferenceorboothAttendeePrepareHead($object)
Prepare array of tabs for ConferenceOrBoothAttendees.
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.
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.
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_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
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).
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
project_prepare_head(Project $project, $moreparam='')
Prepare array with list of tabs.
dol_hash($chain, $type='0', $nosalt=0, $mode=0)
Returns a hash (non reversible encryption) of a string.
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.