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