28if (!$res && !empty($_SERVER[
"CONTEXT_DOCUMENT_ROOT"])) {
29 $res = @include $_SERVER[
"CONTEXT_DOCUMENT_ROOT"].
"/main.inc.php";
32$tmp = empty($_SERVER[
'SCRIPT_FILENAME']) ?
'' : $_SERVER[
'SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
33while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
37if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)).
"/main.inc.php")) {
38 $res = @include substr($tmp, 0, ($i + 1)).
"/main.inc.php";
40if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php")) {
41 $res = @include dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php";
44if (!$res && file_exists(
"../main.inc.php")) {
45 $res = @include
"../main.inc.php";
47if (!$res && file_exists(
"../../main.inc.php")) {
48 $res = @include
"../../main.inc.php";
50if (!$res && file_exists(
"../../../main.inc.php")) {
51 $res = @include
"../../../main.inc.php";
54 die(
"Include of main fails");
57require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
58require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
63$langs->loadLangs(array(
"bookcal@bookcal",
"companies",
"other",
"mails"));
67$lineid =
GETPOST(
'lineid',
'int');
68$socid =
GETPOST(
'socid',
'int');
69$action =
GETPOST(
'action',
'aZ09');
74$diroutputmassaction = $conf->bookcal->dir_output.
'/temp/massgeneration/'.$user->id;
75$hookmanager->initHooks(array(
'calendarcontact',
'globalcard'));
77$extrafields->fetch_name_optionals_label($object->table_element);
80include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
84$enablepermissioncheck = 0;
85if ($enablepermissioncheck) {
86 $permissiontoread = $user->rights->bookcal->calendar->read;
87 $permission = $user->rights->bookcal->calendar->write;
89 $permissiontoread = 1;
98if (!isModEnabled(
"bookcal")) {
101if (!$permissiontoread) {
110if ($action ==
'addcontact' && $permission) {
113 $result = $object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
116 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
119 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
120 $langs->load(
"errors");
121 setEventMessages($langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType"),
null,
'errors');
126} elseif ($action ==
'swapstatut' && $permission) {
128 $result = $object->swapContactStatus(
GETPOST(
'ligne',
'int'));
129} elseif ($action ==
'deletecontact' && $permission) {
131 $result = $object->delete_contact($lineid);
134 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
146$title = $langs->trans(
'Calendar').
" - ".$langs->trans(
'ContactsAddresses');
151$form =
new Form($db);
153$contactstatic =
new Contact($db);
154$userstatic =
new User($db);
169 print
dol_get_fiche_head($head,
'contact', $langs->trans(
"Calendar"), -1, $object->picto);
171 $linkback =
'<a href="'.dol_buildpath(
'/bookcal/calendar_list.php', 1).
'?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
173 $morehtmlref =
'<div class="refidno">';
210 $morehtmlref .=
'</div>';
212 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref,
'', 0,
'',
'', 1);
219 $dirtpls = array_merge($conf->modules_parts[
'tpl'], array(
'/core/tpl'));
220 foreach ($dirtpls as $reldir) {
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
calendarPrepareHead($object)
Prepare array of tabs for Calendar.
Class to manage Dolibarr users.
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.
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_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.