dolibarr 24.0.0-beta
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 = GETPOSTISSET('withproject') ? GETPOSTINT('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 print '<input type="hidden" name="withproject" value="'.$withproject.'">';
505
506 if ($projectstatic->id > 0) {
507 print '<input type="hidden" name="fk_project" value="'.$projectstatic->id.'">';
508 print '<input type="hidden" name="projectid" value="'.$projectstatic->id.'">';
509 }
510
511 if ($backtopage) {
512 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
513 }
514 if ($backtopageforcancel) {
515 print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
516 }
517
518 print dol_get_fiche_head(array(), '');
519
520 print '<table class="border centpercent tableforfieldcreate">'."\n";
521
522 // Common attributes
523 include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
524
525 // Other attributes
526 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
527
528 print '</table>'."\n";
529
530 print dol_get_fiche_end();
531
532 print $form->buttonsSaveCancel("Create");
533
534 print '</form>';
535
536 //dol_set_focus('input[name="ref"]');
537}
538
539// Part to edit attendee
540if (($id || $ref) && $action == 'edit') {
541 print load_fiche_titre($langs->trans("ConferenceOrBoothAttendee"), '', 'object_'.$object->picto);
542
543 print '<form method="POST" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
544 print '<input type="hidden" name="token" value="'.newToken().'">';
545 print '<input type="hidden" name="action" value="update">';
546 print '<input type="hidden" name="id" value="'.$object->id.'">';
547 if (is_object($confOrBooth) && $confOrBooth->id > 0) {
548 print '<input type="hidden" name="conforboothid" value="'.$confOrBooth->id.'">';
549 }
550 if ($object->fk_actioncomm > 0) {
551 print '<input type="hidden" name="fk_actioncomm" value="'.$object->fk_actioncomm.'">';
552 }
553 if ($backtopage) {
554 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
555 }
556 if ($backtopageforcancel) {
557 print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
558 }
559 if ($projectstatic->id > 0) {
560 print '<input type="hidden" name="fk_project" value="'.$projectstatic->id.'">';
561 }
562
563 print dol_get_fiche_head();
564
565 print '<table class="border centpercent tableforfieldedit">'."\n";
566
567 // Common attributes
568 include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
569
570 // Other attributes
571 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
572
573 print '</table>';
574
575 print dol_get_fiche_end();
576
577 print $form->buttonsSaveCancel();
578
579 print '</form>';
580}
581
582// Part to show attendee
583if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
584 $object->fetch_optionals();
585
586 $moreparam = '';
587 if ($withproject) {
588 $moreparam .= '&withproject=1';
589 }
590 if ($fk_project) {
591 $moreparam .= '&fk_project='.((int) $fk_project);
592 }
593
595 print dol_get_fiche_head($head, 'card', $langs->trans("ConferenceOrBoothAttendee"), -1, $object->picto);
596
597 $formconfirm = '';
598
599 // Confirmation to delete
600 if ($action == 'delete') {
601 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteConferenceOrBoothAttendee'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
602 }
603 // Confirmation to delete line
604 if ($action == 'deleteline') {
605 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
606 }
607 // Clone confirmation
608 if ($action == 'clone') {
609 // Create an array for form
610 $formquestion = array();
611 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
612 }
613
614 // Call Hook formConfirm
615 $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
616 $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
617 if (empty($reshook)) {
618 $formconfirm .= $hookmanager->resPrint;
619 } elseif ($reshook > 0) {
620 $formconfirm = $hookmanager->resPrint;
621 }
622
623 // Print form confirm
624 print $formconfirm;
625
626 // Object card
627 // ------------------------------------------------------------
628 $linkback = '<a href="'.dol_buildpath('/eventorganization/conferenceorboothattendee_list.php', 1).'?restore_lastsearch_values=1'.$moreparam.'">'.$langs->trans("BackToList").'</a>';
629
630 $morehtmlref = '<div class="refidno">';
631
632 $morehtmlref .= '</div>';
633
634 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $moreparam);
635
636 print '<div class="fichecenter">';
637 print '<div class="fichehalfleft">';
638 print '<div class="underbanner clearboth"></div>';
639 print '<table class="border centpercent tableforfield">'."\n";
640
641 // Common attributes
642 //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field
643 //unset($object->fields['fk_project']); // Hide field already shown in banner
644 //unset($object->fields['fk_soc']); // Hide field already shown in banner
645 $keyforbreak = 'num_vote';
646
647 include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
648
649 // Other attributes. Fields from hook formObjectOptions and Extrafields.
650 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
651
652 print '</table>';
653 print '</div>';
654 print '</div>';
655
656 print '<div class="clearboth"></div>';
657
658 print dol_get_fiche_end();
659
660 // Buttons for actions
661
662 if ($action != 'presend' && $action != 'editline') {
663 print '<div class="tabsAction">'."\n";
664 $parameters = array();
665 $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
666 if ($reshook < 0) {
667 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
668 }
669
670 if (empty($reshook)) {
671 // Send
672 if (empty($user->socid)) {
673 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');
674 }
675 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);
676
677 // Clone
678 print dolGetButtonAction('', $langs->trans('ToClone'), 'clone', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=clone&token='.newToken().(!empty($projectstatic->id) ? '&fk_project='.$projectstatic->id : ''), '', $permissiontoadd);
679
680 // Delete (need delete permission, or if draft, just need create/modify permission)
681 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));
682 }
683 print '</div>'."\n";
684 }
685
686
687 // Select mail models is same action as presend
688 if (GETPOST('modelselected')) {
689 $action = 'presend';
690 }
691
692 if ($action != 'presend') {
693 print '<div class="fichecenter"><div class="fichehalfleft">';
694 print '<a name="builddoc"></a>'; // ancre
695
696 $includedocgeneration = 0;
697
698 // Documents
699 if ($includedocgeneration) {
700 $objref = dol_sanitizeFileName($object->ref);
701 $relativepath = $objref.'/'.$objref.'.pdf';
702 $filedir = $conf->eventorganization->dir_output.'/'.$object->element.'/'.$objref;
703 $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
704 $genallowed = $user->hasRight('project', 'conferenceorboothattendee', 'read'); // If you can read, you can build the PDF to read content
705 $delallowed = $user->hasRight('project', 'conferenceorboothattendee', 'write'); // If you can create/edit, you can remove a file on card
706 print $formfile->showdocuments('eventorganization:ConferenceOrBoothAttendee', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, (string) $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
707 }
708
709 // Show links to link elements
710 $tmparray = $form->showLinkToObjectBlock($object, array(), array('conferenceorboothattendee'), 1);
711 $linktoelem = $tmparray['linktoelem'];
712 $htmltoenteralink = $tmparray['htmltoenteralink'];
713 print $htmltoenteralink;
714
715 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
716
717
718 print '</div><div class="fichehalfright">';
719
720 $MAXEVENT = 10;
721
722 $morehtmlcenter = '<div class="nowraponall">';
723 $morehtmlcenter .= dolGetButtonTitle($langs->trans('FullConversation'), '', 'fa fa-comments imgforviewmode', DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id);
724 $morehtmlcenter .= dolGetButtonTitle($langs->trans('FullList'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id);
725 $morehtmlcenter .= '</div>';
726
727 // List of actions on element
728 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
729 $formactions = new FormActions($db);
730 $somethingshown = $formactions->showactions($object, 'conferenceorboothattendee', 0, 1, '', $MAXEVENT, '', $morehtmlcenter); // Show all action for attendee
731
732 print '</div></div>';
733 }
734
735 //Select mail models is same action as presend
736 if (GETPOST('modelselected')) {
737 $action = 'presend';
738 }
739
740 // Presend form
741 $modelmail = 'conferenceorboothattendee';
742 $defaulttopic = 'InformationMessage';
743 $diroutput = $conf->eventorganization->dir_output;
744 $trackid = 'conferenceorboothattendee'.$object->id;
745
746 include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
747}
748
749// End of page
750llxFooter();
751$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 manage building of HTML components.
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:168
conferenceorboothAttendeePrepareHead($object)
Prepare array of tabs for ConferenceOrBoothAttendees.
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_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.
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.
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.