31require
'../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
40require_once __DIR__.
'/class/calendar.class.php';
43$langs->loadLangs(array(
"bookcal@bookcal",
"other"));
47$socid =
GETPOST(
'socid',
'int');
48$action =
GETPOST(
'action',
'aZ09');
51$fieldid = (!empty($ref) ?
'ref' :
'rowid');
53 $socid = $user->socid;
61if ($id > 0 || !empty($ref)) {
62 $ret = $object->fetch($id, $ref);
63 $isdraft = (($object->status == Calendar::STATUS_DRAFT) ? 1 : 0);
65 $object->fetch_thirdparty();
71$enablepermissioncheck = 0;
72if ($enablepermissioncheck) {
73 $permissiontoread = $user->hasRight(
'bookcal',
'calendar',
'read');
74 $permissiontoadd = $user->hasRight(
'bookcal',
'calendar',
'write');
75 $permissiontodelete = $user->hasRight(
'bookcal',
'calendar',
'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
76 $permissionnote = $user->hasRight(
'bookcal',
'calendar',
'write');
77 $permissiondellink = $user->hasRight(
'bookcal',
'calendar',
'write');
79 $permissiontoread = 1;
81 $permissiontodelete = 1;
83 $permissiondellink = 1;
86if (!isModEnabled(
"bookcal")) {
89if (!$permissiontoread) {
98$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
108$form =
new Form($db);
111$title = $langs->trans(
'Calendar').
" - ".$langs->trans(
'Bookings');
116if ($object->id > 0) {
119 print
dol_get_fiche_head($head,
'booking', $langs->trans(
"Calendar"), -1, $object->picto, 0,
'',
'', 0,
'', 1);
124 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
125 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
126 if (empty($reshook)) {
127 $formconfirm .= $hookmanager->resPrint;
128 } elseif ($reshook > 0) {
129 $formconfirm = $hookmanager->resPrint;
138 $linkback =
'<a href="'.dol_buildpath(
'/bookcal/calendar_list.php', 1).
'?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
140 $morehtmlref =
'<div class="refidno">';
141 $morehtmlref .=
'</div>';
144 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
147 print
'<div class="fichecenter">';
148 print
'<div class="fichehalfleft">';
149 print
'<div class="underbanner clearboth"></div>';
150 print
'<table class="border centpercent tableforfield">'.
"\n";
153 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_view.tpl.php';
156 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
159 print
'<tr><td>Link</td>';
160 print
'<td><a href="'. DOL_URL_ROOT.
'/public/bookcal/index.php?id='.$object->id.
'" target="_blank">Public page</a>';
167 print
'<div class="clearboth"></div>';
176 print
'<div class="div-table-responsive-no-min">';
177 print
'<table class="noborder centpercent">';
179 print
'<tr class="liste_titre">';
181 print
'<td class="left">'.$langs->trans(
"Ref").
'</td>';
182 print
'<td>'.$langs->trans(
"Title").
'</td>';
183 print
'<td class="center">'.$langs->trans(
"DateStart").
'</td>';
184 print
'<td class="center">'.$langs->trans(
"DateEnd").
'</td>';
185 print
'<td class="left">'.$langs->trans(
"Contact").
'</td>';
189 $sql =
"SELECT ac.id, ac.ref, ac.datep as date_start, ac.datep2 as date_end, ac.label, acr.fk_element";
190 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm as ac";
191 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"actioncomm_resources as acr on acr.fk_actioncomm = ac.id";
192 $sql .=
" WHERE ac.fk_bookcal_calendar = ".((int) $object->id);
193 $sql .=
" AND ac.code = 'AC_RDV'";
194 $sql .=
" AND acr.element_type = 'socpeople'";
195 $resql = $db->query($sql);
201 $tmpcontact =
new Contact($db);
204 $num = $db->num_rows($result);
206 $obj = $db->fetch_object($resql);
207 $tmpcontact->fetch($obj->fk_element);
208 $tmpactioncomm->fetch($obj->id);
210 print
'<tr class="oddeven">';
213 print
'<td class="nowraponall">'.$tmpactioncomm->getNomUrl(1, -1).
"</td>\n";
216 print
'<td class="tdoverflowmax125">';
221 print
'<td class="center">'.dol_print_date($db->jdate($obj->date_start),
"dayhour").
'</td>';
224 print
'<td class="center">'.dol_print_date($db->jdate($obj->date_end),
"dayhour").
'</td>';
227 print
'<td class="minwidth75">';
228 print $tmpcontact->getNomUrl(1, -1);
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 agenda events (actions)
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.
dol_now($mode='auto')
Return date for now.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.