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