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