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