25require
'../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/holiday.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
41$langs->loadLangs(array(
'holiday',
'other'));
47$action =
GETPOST(
'action',
'aZ09');
48$cancel =
GETPOST(
'cancel',
'alpha');
49$backtopage =
GETPOST(
'backtopage',
'alpha');
51if (
GETPOST(
'actioncode',
'array')) {
52 $actioncode =
GETPOST(
'actioncode',
'array', 3);
53 if (!count($actioncode)) {
60$search_rowid =
GETPOST(
'search_rowid');
61$search_agenda_label =
GETPOST(
'search_agenda_label');
65$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
66$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
68if (empty($page) || $page == -1) {
71$offset = $limit * $page;
75 $sortfield =
'a.datep,a.id';
83$hookmanager->initHooks(array(
'holidayagenda',
'globalcard'));
86$extrafields->fetch_name_optionals_label(
$object->table_element);
88$childids = $user->getAllChildIds(1);
91$permissiontoapprove = $user->hasRight(
'holiday',
'approve');
93if (($id > 0) || $ref) {
97 if ($user->hasRight(
'holiday',
'readall')) {
100 if ($user->hasRight(
'holiday',
'read') && in_array(
$object->fk_user, $childids)) {
103 if ($permissiontoapprove &&
$object->fk_validator == $user->id && !
getDolGlobalString(
'HOLIDAY_CAN_APPROVE_ONLY_THE_SUBORDINATES')) {
113 $socid = $user->socid;
126$parameters = array(
'id' => $id);
127$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
129 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
132if (empty($reshook)) {
134 if (
GETPOST(
'cancel',
'alpha') && !empty($backtopage)) {
135 header(
"Location: ".$backtopage);
140 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
142 $search_agenda_label =
'';
152$form =
new Form($db);
155 $title = $langs->trans(
"Leave").
' - '.$langs->trans(
"Agenda");
156 $help_url =
'EN:Module_Holiday';
157 llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-holiday page-card_agenda');
160 $langs->load(
"mails");
169 $linkback =
'<a href="'.DOL_URL_ROOT.
'/holiday/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
171 $morehtmlref =
'<div class="refidno">';
173 $employee =
new User($db);
174 $employee->fetch(
$object->fk_user);
175 $morehtmlref .= $langs->trans(
"User").
' : '.$employee->getNomUrl(-1);
177 $morehtmlref .=
'</div>';
179 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
181 print
'<div class="fichecenter">';
182 print
'<div class="underbanner clearboth"></div>';
197 $out =
'&origin='.urlencode((
string) (
$object->element)).
'&originid='.urlencode((
string) (
$object->id));
198 $urlbacktopage = $_SERVER[
'PHP_SELF'].
'?id='.
$object->id;
199 $out .=
'&backtopage='.urlencode($urlbacktopage);
203 if ($user->hasRight(
'agenda',
'myactions',
'create') || $user->hasRight(
'agenda',
'allactions',
'create')) {
204 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'AddAction'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/comm/action/card.php?action=create'.$out);
206 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'AddAction'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/comm/action/card.php?action=create'.$out,
'', 0);
210 if (
isModEnabled(
'agenda') && ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
213 $param =
'&id='.$object->id.(!empty($socid) ?
'&socid='.$socid :
'');
214 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
215 $param .=
'&contextpage='.urlencode($contextpage);
217 if ($limit > 0 && $limit !=
$conf->liste_limit) {
218 $param .=
'&limit='.((int) $limit);
221 print_barre_liste($langs->trans(
"Actions"), 0, $_SERVER[
"PHP_SELF"],
'', $sortfield, $sortorder,
'', 0, -1,
'', 0, $morehtmlright,
'', 0, 1, 1);
225 $filters[
'search_agenda_label'] = $search_agenda_label;
226 $filters[
'search_rowid'] = $search_rowid;
229 show_actions_done(
$conf, $langs, $db, $object,
null, 0, $actioncode,
'', $filters, $sortfield, $sortorder);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
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.
Class of the module paid holiday.
Class to manage Dolibarr users.
show_actions_done($conf, $langs, $db, $filterobj, $objcon=null, $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep, a.id', $sortorder='DESC', $module='')
Show html area with actions (done or not, ignore the name of function).
dol_print_object_info($object, $usetable=0)
Show information on an object TODO Move this into html.formother.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
holiday_prepare_head($object)
Return array head with list of tabs to view object information.
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.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.