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