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';
47$langs->loadLangs(array(
"agenda",
"other"));
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'));
58$backtopage =
GETPOST(
'backtopage',
'alpha');
59$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
60$dol_openinpopup =
GETPOST(
'dol_openinpopup',
'aZ09');
64$diroutputmassaction =
$conf->bookcal->dir_output.
'/temp/massgeneration/'.$user->id;
65$hookmanager->initHooks(array(
'calendarcard',
'globalcard'));
68$extrafields->fetch_name_optionals_label(
$object->table_element);
70$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
73$search_all =
GETPOST(
"search_all",
'alpha');
75foreach (
$object->fields as $key => $val) {
76 if (
GETPOST(
'search_'.$key,
'alpha')) {
77 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
81if (empty($action) && empty($id) && empty($ref)) {
86include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
92$enablepermissioncheck = 0;
93if ($enablepermissioncheck) {
94 $permissiontoread = $user->hasRight(
'bookcal',
'calendar',
'read');
95 $permissiontoadd = $user->hasRight(
'bookcal',
'calendar',
'write');
96 $permissiontodelete = $user->hasRight(
'bookcal',
'calendar',
'delete') || ($permissiontoadd && isset(
$object->status) &&
$object->status == $object::STATUS_DRAFT);
97 $permissionnote = $user->hasRight(
'bookcal',
'calendar',
'write');
98 $permissiondellink = $user->hasRight(
'bookcal',
'calendar',
'write');
100 $permissiontoread = 1;
101 $permissiontoadd = 1;
102 $permissiontodelete = 1;
104 $permissiondellink = 1;
107$upload_dir =
$conf->bookcal->multidir_output[isset(
$object->entity) ?
$object->entity : 1].
'/calendar';
117if (!$permissiontoread) {
128$parameters = array();
129$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
134if (empty($reshook)) {
135 $backurlforlist =
dol_buildpath(
'/bookcal/calendar_list.php', 1);
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;
142 $backtopage =
dol_buildpath(
'/bookcal/calendar_card.php', 1).
'?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
147 $triggermodname =
'BOOKCAL_MYOBJECT_MODIFY';
150 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
153 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
156 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
162 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
164 if ($action ==
'set_thirdparty' && $permissiontoadd) {
165 $object->setValueFrom(
'fk_soc',
GETPOSTINT(
'fk_soc'),
'',
null,
'date',
'', $user, $triggermodname);
167 if ($action ==
'classin' && $permissiontoadd) {
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';
189$title = $langs->trans(
"Calendar");
191llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-bookcal page-card_calendar');
210if ($action ==
'create') {
211 if (empty($permissiontoadd)) {
215 print
load_fiche_titre($langs->trans(
"NewObject", $langs->transnoentitiesnoconv(
"Calendar")),
'',
'object_'.$object->picto);
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">';
221 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
223 if ($backtopageforcancel) {
224 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
226 if ($dol_openinpopup) {
227 print
'<input type="hidden" name="dol_openinpopup" value="'.$dol_openinpopup.
'">';
233 print
'<table class="border centpercent tableforfieldcreate">'.
"\n";
236 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_add.tpl.php';
239 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
241 print
'</table>'.
"\n";
245 print $form->buttonsSaveCancel(
"Create");
253if (($id || $ref) && $action ==
'edit') {
254 print
load_fiche_titre($langs->trans(
"Calendar"),
'',
'object_'.$object->picto);
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.
'">';
261 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
263 if ($backtopageforcancel) {
264 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
269 print
'<table class="border centpercent tableforfieldedit">'.
"\n";
272 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_edit.tpl.php';
275 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
281 print $form->buttonsSaveCancel();
287if (
$object->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
290 print
dol_get_fiche_head($head,
'card', $langs->trans(
"Calendar"), -1,
$object->picto, 0,
'',
'', 0,
'', 1);
295 if ($action ==
'delete') {
296 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteCalendar'), $langs->trans(
'ConfirmDeleteObject'),
'confirm_delete',
'', 0, 1);
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);
304 if ($action ==
'clone') {
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);
311 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
312 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
313 if (empty($reshook)) {
314 $formconfirm .= $hookmanager->resPrint;
315 } elseif ($reshook > 0) {
316 $formconfirm = $hookmanager->resPrint;
325 $linkback =
'<a href="'.dol_buildpath(
'/bookcal/calendar_list.php', 1).
'?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
327 $morehtmlref =
'<div class="refidno">';
359 $morehtmlref .=
'</div>';
362 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
366 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
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";
377 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_view.tpl.php';
380 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
383 print
'<tr><td>'.$langs->trans(
"PublicLinkForBooking").
'</td>';
386 $linktobook = $urlwithroot.
'/public/bookcal/index.php?id='.
$object->id;
388 $linktobook .=
'&securekey='.urlencode($encodedsecurekey);
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>';
399 print
'<div class="clearboth"></div>';
408 if (!empty(
$object->table_element_line)) {
410 $result =
$object->getLinesArray();
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.
'">
420 if (!empty(
$conf->use_javascript_ajax) &&
$object->status == 0) {
421 include DOL_DOCUMENT_ROOT.
'/core/tpl/ajaxrow.tpl.php';
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%">';
434 if (
$object->status == 0 && $permissiontoadd && $action !=
'selectlines') {
435 if ($action !=
'editline') {
438 $parameters = array();
439 $reshook = $hookmanager->executeHooks(
'formAddObjectLine', $parameters, $object, $action);
443 if (empty($reshook)) {
449 if (!empty(
$object->lines) || (
$object->status == $object::STATUS_DRAFT && $permissiontoadd && $action !=
'selectlines' && $action !=
'editline')) {
460 if ($action !=
'presend' && $action !=
'editline') {
461 print
'<div class="tabsAction">'.
"\n";
462 $parameters = array();
463 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
468 if (empty($reshook)) {
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);
479 print dolGetButtonAction(
'', $langs->trans(
'Modify'),
'default', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=edit&token='.newToken(),
'', $permissiontoadd);
482 if (
$object->status == $object::STATUS_DRAFT) {
484 print dolGetButtonAction(
'', $langs->trans(
'Validate'),
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=confirm_validate&confirm=yes&token='.newToken(),
'', $permissiontoadd);
486 $langs->load(
"errors");
487 print dolGetButtonAction($langs->trans(
"ErrorAddAtLeastOneLineFirst"), $langs->trans(
"Validate"),
'default',
'#',
'', 0);
492 if ($permissiontoadd) {
493 print dolGetButtonAction(
'', $langs->trans(
'ToClone'),
'clone', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=clone&token='.newToken(),
'', $permissiontoadd);
515 print dolGetButtonAction(
'', $langs->trans(
"Delete"),
'delete', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.newToken(),
'delete', $permissiontodelete, $params);
522 if (
GETPOST(
'modelselected')) {
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
global $dolibarr_main_url_root
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
calendarPrepareHead($object)
Prepare array of tabs for Calendar.
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.