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