dolibarr 24.0.0-beta
calendar_card.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2023 Alice Adminson <aadminson@example.com>
4 * Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
5 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
27// Load Dolibarr environment
28require '../main.inc.php';
40require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
41require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
42require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
43require_once DOL_DOCUMENT_ROOT.'/bookcal/class/calendar.class.php';
44require_once DOL_DOCUMENT_ROOT.'/bookcal/lib/bookcal_calendar.lib.php';
45
46// Load translation files required by the page
47$langs->loadLangs(array("agenda", "other"));
48
49// Get parameters
50$id = GETPOSTINT('id');
51$ref = GETPOST('ref', 'alpha');
52$lineid = GETPOSTINT('lineid');
53
54$action = GETPOST('action', 'aZ09');
55$confirm = GETPOST('confirm', 'alpha');
56$cancel = GETPOST('cancel', 'alpha');
57$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
58$backtopage = GETPOST('backtopage', 'alpha'); // if not set, a default page will be used
59$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // if not set, $backtopage will be used
60$dol_openinpopup = GETPOST('dol_openinpopup', 'aZ09');
61
62// Initialize a technical objects
63$object = new Calendar($db);
64$diroutputmassaction = $conf->bookcal->dir_output.'/temp/massgeneration/'.$user->id;
65$hookmanager->initHooks(array('calendarcard', 'globalcard')); // Note that conf->hooks_modules contains array
66
67// Fetch optionals attributes and labels
68$extrafields->fetch_name_optionals_label($object->table_element);
69
70$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
71
72// Initialize array of search criteria
73$search_all = GETPOST("search_all", 'alpha');
74$search = array();
75foreach ($object->fields as $key => $val) {
76 if (GETPOST('search_'.$key, 'alpha')) {
77 $search[$key] = GETPOST('search_'.$key, 'alpha');
78 }
79}
80
81if (empty($action) && empty($id) && empty($ref)) {
82 $action = 'view';
83}
84
85// Load object
86include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'.
87
88$object->entity = ((GETPOSTISSET('entity') && GETPOST('entity') != '') ? GETPOSTINT('entity') : $conf->entity);
89
90// There is several ways to check permission.
91// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
92$enablepermissioncheck = 0;
93if ($enablepermissioncheck) {
94 $permissiontoread = $user->hasRight('bookcal', 'calendar', 'read');
95 $permissiontoadd = $user->hasRight('bookcal', 'calendar', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
96 $permissiontodelete = $user->hasRight('bookcal', 'calendar', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
97 $permissionnote = $user->hasRight('bookcal', 'calendar', 'write'); // Used by the include of actions_setnotes.inc.php
98 $permissiondellink = $user->hasRight('bookcal', 'calendar', 'write'); // Used by the include of actions_dellink.inc.php
99} else {
100 $permissiontoread = 1;
101 $permissiontoadd = 1; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
102 $permissiontodelete = 1;
103 $permissionnote = 1;
104 $permissiondellink = 1;
105}
106
107$upload_dir = $conf->bookcal->multidir_output[isset($object->entity) ? $object->entity : 1].'/calendar';
108
109// Security check (enable the most restrictive one)
110//if ($user->socid > 0) accessforbidden();
111//if ($user->socid > 0) $socid = $user->socid;
112//$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0);
113//restrictedArea($user, $object->module, $object, $object->table_element, $object->element, 'fk_soc', 'rowid', $isdraft);
114if (!isModEnabled("bookcal")) {
116}
117if (!$permissiontoread) {
119}
120
121$error = 0;
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
130if ($reshook < 0) {
131 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
132}
133
134if (empty($reshook)) {
135 $backurlforlist = dol_buildpath('/bookcal/calendar_list.php', 1);
136
137 if (empty($backtopage) || ($cancel && empty($id))) {
138 if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
139 if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
140 $backtopage = $backurlforlist;
141 } else {
142 $backtopage = dol_buildpath('/bookcal/calendar_card.php', 1).'?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
143 }
144 }
145 }
146
147 $triggermodname = 'BOOKCAL_MYOBJECT_MODIFY'; // Name of trigger action code to execute when we modify record
148
149 // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
150 include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
151
152 // Actions when linking object each other
153 include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';
154
155 // Actions when printing a doc from card
156 include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
157
158 // Action to move up and down lines of object
159 //include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php';
160
161 // Action to build doc
162 include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
163
164 if ($action == 'set_thirdparty' && $permissiontoadd) {
165 $object->setValueFrom('fk_soc', GETPOSTINT('fk_soc'), '', null, 'date', '', $user, $triggermodname);
166 }
167 if ($action == 'classin' && $permissiontoadd) {
168 $object->setProject(GETPOSTINT('projectid'));
169 }
170
171 // Actions to send emails
172 $triggersendname = 'BOOKCAL_MYOBJECT_SENTBYMAIL';
173 $autocopy = 'MAIN_MAIL_AUTOCOPY_MYOBJECT_TO';
174 $trackid = 'calendar'.$object->id;
175 include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
176}
177
178
179
180
181/*
182 * View
183 */
184
185$form = new Form($db);
186$formfile = new FormFile($db);
187$formproject = new FormProjets($db);
188
189$title = $langs->trans("Calendar");
190$help_url = '';
191llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-bookcal page-card_calendar');
192
193// Example : Adding jquery code
194// print '<script type="text/javascript">
195// jQuery(document).ready(function() {
196// function init_myfunc()
197// {
198// jQuery("#myid").removeAttr(\'disabled\');
199// jQuery("#myid").attr(\'disabled\',\'disabled\');
200// }
201// init_myfunc();
202// jQuery("#mybutton").click(function() {
203// init_myfunc();
204// });
205// });
206// </script>';
207
208
209// Part to create
210if ($action == 'create') {
211 if (empty($permissiontoadd)) {
212 accessforbidden('NotEnoughPermissions', 0, 1);
213 }
214
215 print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Calendar")), '', 'object_'.$object->picto);
216
217 print '<form method="POST" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
218 print '<input type="hidden" name="token" value="'.newToken().'">';
219 print '<input type="hidden" name="action" value="add">';
220 if ($backtopage) {
221 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
222 }
223 if ($backtopageforcancel) {
224 print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
225 }
226 if ($dol_openinpopup) {
227 print '<input type="hidden" name="dol_openinpopup" value="'.$dol_openinpopup.'">';
228 }
229
230 print dol_get_fiche_head(array(), '');
231
232
233 print '<table class="border centpercent tableforfieldcreate">'."\n";
234
235 // Common attributes
236 include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
237
238 // Other attributes
239 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
240
241 print '</table>'."\n";
242
243 print dol_get_fiche_end();
244
245 print $form->buttonsSaveCancel("Create");
246
247 print '</form>';
248
249 //dol_set_focus('input[name="ref"]');
250}
251
252// Part to edit record
253if (($id || $ref) && $action == 'edit') {
254 print load_fiche_titre($langs->trans("Calendar"), '', 'object_'.$object->picto);
255
256 print '<form method="POST" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
257 print '<input type="hidden" name="token" value="'.newToken().'">';
258 print '<input type="hidden" name="action" value="update">';
259 print '<input type="hidden" name="id" value="'.$object->id.'">';
260 if ($backtopage) {
261 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
262 }
263 if ($backtopageforcancel) {
264 print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
265 }
266
267 print dol_get_fiche_head();
268
269 print '<table class="border centpercent tableforfieldedit">'."\n";
270
271 // Common attributes
272 include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
273
274 // Other attributes
275 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
276
277 print '</table>';
278
279 print dol_get_fiche_end();
280
281 print $form->buttonsSaveCancel();
282
283 print '</form>';
284}
285
286// Part to show record
287if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
288 $head = calendarPrepareHead($object);
289
290 print dol_get_fiche_head($head, 'card', $langs->trans("Calendar"), -1, $object->picto, 0, '', '', 0, '', 1);
291
292 $formconfirm = '';
293
294 // Confirmation to delete
295 if ($action == 'delete') {
296 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteCalendar'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
297 }
298 // Confirmation to delete line
299 if ($action == 'deleteline') {
300 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
301 }
302
303 // Clone confirmation
304 if ($action == 'clone') {
305 // Create an array for form
306 $formquestion = array();
307 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
308 }
309
310 // Call Hook formConfirm
311 $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
312 $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
313 if (empty($reshook)) {
314 $formconfirm .= $hookmanager->resPrint;
315 } elseif ($reshook > 0) {
316 $formconfirm = $hookmanager->resPrint;
317 }
318
319 // Print form confirm
320 print $formconfirm;
321
322
323 // Object card
324 // ------------------------------------------------------------
325 $linkback = '<a href="'.dol_buildpath('/bookcal/calendar_list.php', 1).'?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
326
327 $morehtmlref = '<div class="refidno">';
328 /*
329 // Ref customer
330 $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1);
331 $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.$conf->global->THIRDPARTY_REF_INPUT_SIZE : ''), '', null, null, '', 1);
332 // Thirdparty
333 $morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1, 'customer');
334 if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) {
335 $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherOrders").'</a>)';
336 }
337 // Project
338 if (isModEnabled('project')) {
339 $langs->load("projects");
340 $morehtmlref .= '<br>';
341 if ($permissiontoadd) {
342 $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
343 if ($action != 'classify') {
344 $morehtmlref .= '<a class="editfielda" href="'.dolBuildUrl($_SERVER['PHP_SELF'], ['action' => 'classify', 'id' => $object->id], true).'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
345 }
346 $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
347 } else {
348 if (!empty($object->fk_project)) {
349 $proj = new Project($db);
350 $proj->fetch($object->fk_project);
351 $morehtmlref .= $proj->getNomUrl(1);
352 if ($proj->title) {
353 $morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
354 }
355 }
356 }
357 }
358 */
359 $morehtmlref .= '</div>';
360
361
362 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
363
364 // Define $urlwithroot
365 $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
366 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
367
368 print '<div class="fichecenter">';
369 print '<div class="fichehalfleft">';
370 print '<div class="underbanner clearboth"></div>';
371 print '<table class="border centpercent tableforfield">'."\n";
372
373 // Common attributes
374 //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field
375 //unset($object->fields['fk_project']); // Hide field already shown in banner
376 //unset($object->fields['fk_soc']); // Hide field already shown in banner
377 include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
378
379 // Other attributes. Fields from hook formObjectOptions and Extrafields.
380 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
381
382 // Link to public page
383 print '<tr><td>'.$langs->trans("PublicLinkForBooking").'</td>';
384 print '<td>';
385
386 $linktobook = $urlwithroot.'/public/bookcal/index.php?id='.$object->id;
387 $encodedsecurekey = dol_hash(getDolGlobalString('BOOKCAL_SECUREKEY').'bookcal'.((int) $object->id), 'md5');
388 $linktobook .= '&securekey='.urlencode($encodedsecurekey);
389
390 print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$linktobook.'" class="quatrevingtpercent">'.$linktobook.'</a></div>';
391 print '<a target="_blank" rel="noopener noreferrer" href="'.$linktobook.'">'.img_picto('', 'globe').'</a>';
392
393 print '</td></tr>';
394
395 print '</table>';
396 print '</div>';
397 print '</div>';
398
399 print '<div class="clearboth"></div>';
400
401 print dol_get_fiche_end();
402
403
404 /*
405 * Lines
406 */
407
408 if (!empty($object->table_element_line)) {
409 // Show object lines
410 $result = $object->getLinesArray();
411
412 print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '#line_'.GETPOSTINT('lineid')).'" method="POST">
413 <input type="hidden" name="token" value="' . newToken().'">
414 <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
415 <input type="hidden" name="mode" value="">
416 <input type="hidden" name="page_y" value="">
417 <input type="hidden" name="id" value="' . $object->id.'">
418 ';
419
420 if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
421 include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
422 }
423
424 print '<div class="div-table-responsive-no-min">';
425 if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
426 print '<table id="tablelines" class="noborder noshadow" width="100%">';
427 }
428
429 if (!empty($object->lines)) {
430 $object->printObjectLines($action, $mysoc, null, GETPOSTINT('lineid'), 1);
431 }
432
433 // Form to add new line
434 if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') {
435 if ($action != 'editline') {
436 // Add products/services form
437
438 $parameters = array();
439 $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
440 if ($reshook < 0) {
441 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
442 }
443 if (empty($reshook)) {
444 $object->formAddObjectLine(1, $mysoc, $mysoc);
445 }
446 }
447 }
448
449 if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
450 print '</table>';
451 }
452 print '</div>';
453
454 print "</form>\n";
455 }
456
457
458 // Buttons for actions
459
460 if ($action != 'presend' && $action != 'editline') {
461 print '<div class="tabsAction">'."\n";
462 $parameters = array();
463 $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
464 if ($reshook < 0) {
465 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
466 }
467
468 if (empty($reshook)) {
469 // Send
470 /*if (empty($user->socid)) {
471 print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
472 }*/
473
474 // Back to draft
475 if ($object->status == $object::STATUS_VALIDATED) {
476 print dolGetButtonAction('', $langs->trans('SetToDraft'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd);
477 }
478
479 print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
480
481 // Validate
482 if ($object->status == $object::STATUS_DRAFT) {
483 if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) {
484 print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes&token='.newToken(), '', $permissiontoadd);
485 } else {
486 $langs->load("errors");
487 print dolGetButtonAction($langs->trans("ErrorAddAtLeastOneLineFirst"), $langs->trans("Validate"), 'default', '#', '', 0);
488 }
489 }
490
491 // Clone
492 if ($permissiontoadd) {
493 print dolGetButtonAction('', $langs->trans('ToClone'), 'clone', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=clone&token='.newToken(), '', $permissiontoadd);
494 }
495
496 /*
497 if ($permissiontoadd) {
498 if ($object->status == $object::STATUS_ENABLED) {
499 print dolGetButtonAction('', $langs->trans('Disable'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=disable&token='.newToken(), '', $permissiontoadd);
500 } else {
501 print dolGetButtonAction('', $langs->trans('Enable'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=enable&token='.newToken(), '', $permissiontoadd);
502 }
503 }
504 if ($permissiontoadd) {
505 if ($object->status == $object::STATUS_VALIDATED) {
506 print dolGetButtonAction('', $langs->trans('Cancel'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=close&token='.newToken(), '', $permissiontoadd);
507 } else {
508 print dolGetButtonAction('', $langs->trans('Re-Open'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen&token='.newToken(), '', $permissiontoadd);
509 }
510 }
511 */
512
513 // Delete
514 $params = array();
515 print dolGetButtonAction('', $langs->trans("Delete"), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete, $params);
516 }
517 print '</div>'."\n";
518 }
519
520
521 // Select mail models is same action as presend
522 if (GETPOST('modelselected')) {
523 $action = 'presend';
524 }
525
526 /*
527 if ($action != 'presend') {
528 print '<div class="fichecenter"><div class="fichehalfleft">';
529 print '<a name="builddoc"></a>'; // ancre
530
531 $includedocgeneration = 0;
532
533 // Documents
534 if ($includedocgeneration) {
535 $objref = dol_sanitizeFileName($object->ref);
536 $relativepath = $objref.'/'.$objref.'.pdf';
537 $filedir = $conf->bookcal->dir_output.'/'.$object->element.'/'.$objref;
538 $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
539 $genallowed = $permissiontoread; // If you can read, you can build the PDF to read content
540 $delallowed = $permissiontoadd; // If you can create/edit, you can remove a file on card
541 print $formfile->showdocuments('bookcal:Calendar', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
542 }
543
544 // Show links to link elements
545 $tmparray = $form->showLinkToObjectBlock($object, array(), array('calendar'), 1);
546 $linktoelem = $tmparray['linktoelem'];
547 $htmltoenteralink = $tmparray['htmltoenteralink'];
548 print $htmltoenteralink;
549
550 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
551
552
553 print '</div><div class="fichehalfright">';
554
555 $MAXEVENT = 10;
556
557 $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', dol_buildpath('/bookcal/calendar_agenda.php', 1).'?id='.$object->id);
558
559 // List of actions on element
560 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
561 $formactions = new FormActions($db);
562 $somethingshown = $formactions->showactions($object, $object->element.'@'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter);
563
564 print '</div></div>';
565 }
566
567 //Select mail models is same action as presend
568 if (GETPOST('modelselected')) {
569 $action = 'presend';
570 }
571
572 // Presend form
573 $modelmail = 'calendar';
574 $defaulttopic = 'InformationMessage';
575 $diroutput = $conf->bookcal->dir_output;
576 $trackid = 'calendar'.$object->id;
577
578 include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
579 */
580}
581
582// End of page
583llxFooter();
584$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
global $dolibarr_main_url_root
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
calendarPrepareHead($object)
Prepare array of tabs for Calendar.
Class for Calendar.
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.
global $mysoc
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
dol_hash($chain, $type='0', $nosalt=0, $mode=0)
Returns a hash (non reversible encryption) of a string.