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