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