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