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