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