Fix #yogosha5645
This commit is contained in:
parent
71e7f10a54
commit
1495630254
@ -51,6 +51,8 @@ $fuserid = (GETPOST('fuserid', 'int') ?GETPOST('fuserid', 'int') : $user->id);
|
|||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("other", "holiday", "mails"));
|
$langs->loadLangs(array("other", "holiday", "mails"));
|
||||||
|
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
$childids = $user->getAllChildIds(1);
|
$childids = $user->getAllChildIds(1);
|
||||||
@ -60,8 +62,6 @@ if (!empty($conf->global->HOLIDAY_HIDE_FOR_NON_SALARIES)) {
|
|||||||
$morefilter = 'AND employee = 1';
|
$morefilter = 'AND employee = 1';
|
||||||
}
|
}
|
||||||
|
|
||||||
$error = 0;
|
|
||||||
|
|
||||||
$object = new Holiday($db);
|
$object = new Holiday($db);
|
||||||
|
|
||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
|
|||||||
@ -44,12 +44,6 @@ $ref = GETPOST('ref', 'alpha');
|
|||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
$confirm = GETPOST('confirm', 'alpha');
|
$confirm = GETPOST('confirm', 'alpha');
|
||||||
|
|
||||||
// Security check
|
|
||||||
if ($user->socid) {
|
|
||||||
$socid = $user->socid;
|
|
||||||
}
|
|
||||||
$result = restrictedArea($user, 'holiday', $id, 'holiday');
|
|
||||||
|
|
||||||
// Get parameters
|
// Get parameters
|
||||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||||
@ -69,12 +63,64 @@ if (!$sortfield) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$childids = $user->getAllChildIds(1);
|
||||||
|
|
||||||
|
$morefilter = '';
|
||||||
|
if (!empty($conf->global->HOLIDAY_HIDE_FOR_NON_SALARIES)) {
|
||||||
|
$morefilter = 'AND employee = 1';
|
||||||
|
}
|
||||||
|
|
||||||
$object = new Holiday($db);
|
$object = new Holiday($db);
|
||||||
$object->fetch($id, $ref);
|
|
||||||
|
$extrafields = new ExtraFields($db);
|
||||||
|
|
||||||
|
// fetch optionals attributes and labels
|
||||||
|
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
|
|
||||||
|
if (($id > 0) || $ref) {
|
||||||
|
$object->fetch($id, $ref);
|
||||||
|
|
||||||
|
// Check current user can read this leave request
|
||||||
|
$canread = 0;
|
||||||
|
if (!empty($user->rights->holiday->readall)) {
|
||||||
|
$canread = 1;
|
||||||
|
}
|
||||||
|
if (!empty($user->rights->holiday->read) && in_array($object->fk_user, $childids)) {
|
||||||
|
$canread = 1;
|
||||||
|
}
|
||||||
|
if (!$canread) {
|
||||||
|
accessforbidden();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*$cancreate = 0;
|
||||||
|
|
||||||
|
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->holiday->writeall_advance)) {
|
||||||
|
$cancreate = 1;
|
||||||
|
}
|
||||||
|
if (!empty($user->rights->holiday->write) && in_array($fuserid, $childids)) {
|
||||||
|
$cancreate = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$candelete = 0;
|
||||||
|
if (!empty($user->rights->holiday->delete)) {
|
||||||
|
$candelete = 1;
|
||||||
|
}
|
||||||
|
if ($object->statut == Holiday::STATUS_DRAFT && $user->rights->holiday->write && in_array($object->fk_user, $childids)) {
|
||||||
|
$candelete = 1;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
$upload_dir = $conf->holiday->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, '');
|
$upload_dir = $conf->holiday->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, '');
|
||||||
$modulepart = 'holiday';
|
$modulepart = 'holiday';
|
||||||
|
|
||||||
|
// Protection if external user
|
||||||
|
if ($user->socid) {
|
||||||
|
$socid = $user->socid;
|
||||||
|
}
|
||||||
|
$result = restrictedArea($user, 'holiday', $object->id, 'holiday');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
|
|||||||
@ -34,26 +34,30 @@ $langs->load("holiday");
|
|||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
$ref = GETPOST('ref', 'alpha');
|
$ref = GETPOST('ref', 'alpha');
|
||||||
|
|
||||||
|
|
||||||
$childids = $user->getAllChildIds(1);
|
$childids = $user->getAllChildIds(1);
|
||||||
|
|
||||||
// Security check
|
$morefilter = '';
|
||||||
if ($user->socid) {
|
if (!empty($conf->global->HOLIDAY_HIDE_FOR_NON_SALARIES)) {
|
||||||
$socid = $user->socid;
|
$morefilter = 'AND employee = 1';
|
||||||
}
|
}
|
||||||
$result = restrictedArea($user, 'holiday', $id, 'holiday');
|
|
||||||
|
|
||||||
$object = new Holiday($db);
|
$object = new Holiday($db);
|
||||||
if (!$object->fetch($id, $ref) > 0) {
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($object->id > 0) {
|
$extrafields = new ExtraFields($db);
|
||||||
// Check current user can read this expense report
|
|
||||||
|
// fetch optionals attributes and labels
|
||||||
|
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
|
|
||||||
|
if (($id > 0) || $ref) {
|
||||||
|
$object->fetch($id, $ref);
|
||||||
|
|
||||||
|
// Check current user can read this leave request
|
||||||
$canread = 0;
|
$canread = 0;
|
||||||
if (!empty($user->rights->holiday->readall)) {
|
if (!empty($user->rights->holiday->readall)) {
|
||||||
$canread = 1;
|
$canread = 1;
|
||||||
}
|
}
|
||||||
if (!empty($user->rights->holiday->lire) && in_array($object->fk_user_author, $childids)) {
|
if (!empty($user->rights->holiday->read) && in_array($object->fk_user, $childids)) {
|
||||||
$canread = 1;
|
$canread = 1;
|
||||||
}
|
}
|
||||||
if (!$canread) {
|
if (!$canread) {
|
||||||
@ -61,6 +65,12 @@ if ($object->id > 0) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Security check
|
||||||
|
if ($user->socid) {
|
||||||
|
$socid = $user->socid;
|
||||||
|
}
|
||||||
|
$result = restrictedArea($user, 'holiday', $object->id, 'holiday');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user