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