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