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