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