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