New: Can enter holiday for someone else if user has permission for.
This commit is contained in:
parent
9add45aea3
commit
40577ab445
@ -60,6 +60,7 @@ For users:
|
|||||||
- New: When a subscription is recorded with invoice and payment:
|
- New: When a subscription is recorded with invoice and payment:
|
||||||
- the document (PDF) of invoice is also generated.
|
- the document (PDF) of invoice is also generated.
|
||||||
- the invoice is set to status paid.
|
- the invoice is set to status paid.
|
||||||
|
- New: Can enter holiday for someone else if user has permission for.
|
||||||
- Fix: Project Task numbering customs rule works.
|
- Fix: Project Task numbering customs rule works.
|
||||||
- Fix: Add actions events not implemented.
|
- Fix: Add actions events not implemented.
|
||||||
- Fix: Price min of composition is not supplier price min by quantity.
|
- Fix: Price min of composition is not supplier price min by quantity.
|
||||||
|
|||||||
@ -134,42 +134,42 @@ class modHoliday extends DolibarrModules
|
|||||||
$r=0;
|
$r=0;
|
||||||
|
|
||||||
$this->rights[$r][0] = 20001; // Permission id (must not be already used)
|
$this->rights[$r][0] = 20001; // Permission id (must not be already used)
|
||||||
$this->rights[$r][1] = 'Lire/créer/modifier ses demandes de congés payés'; // Permission label
|
$this->rights[$r][1] = 'Create/modify your own holidays'; // Permission label
|
||||||
$this->rights[$r][3] = 1; // Permission by default for new user (0/1)
|
$this->rights[$r][3] = 1; // Permission by default for new user (0/1)
|
||||||
$this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
$this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||||
$r++;
|
$r++;
|
||||||
|
|
||||||
$this->rights[$r][0] = 20002; // Permission id (must not be already used)
|
$this->rights[$r][0] = 20002; // Permission id (must not be already used)
|
||||||
$this->rights[$r][1] = 'Lire/créer/modifier toutes les demandes de congés payés'; // Permission label
|
$this->rights[$r][1] = 'Create/modify hollidays for everybody'; // Permission label
|
||||||
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
|
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
|
||||||
$this->rights[$r][4] = 'lire_tous'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
$this->rights[$r][4] = 'write_all'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||||
$r++;
|
$r++;
|
||||||
|
|
||||||
$this->rights[$r][0] = 20003; // Permission id (must not be already used)
|
$this->rights[$r][0] = 20003; // Permission id (must not be already used)
|
||||||
$this->rights[$r][1] = 'Supprimer des demandes de congés payés'; // Permission label
|
$this->rights[$r][1] = 'Delete holidays'; // Permission label
|
||||||
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
|
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
|
||||||
$this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
$this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||||
$r++;
|
$r++;
|
||||||
|
|
||||||
$this->rights[$r][0] = 20004; // Permission id (must not be already used)
|
$this->rights[$r][0] = 20004; // Permission id (must not be already used)
|
||||||
$this->rights[$r][1] = 'Définir les congés payés des utilisateurs'; // Permission label
|
$this->rights[$r][1] = 'Setup holidays of users'; // Permission label
|
||||||
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
|
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
|
||||||
$this->rights[$r][4] = 'define_holiday'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
$this->rights[$r][4] = 'define_holiday'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||||
$r++;
|
$r++;
|
||||||
|
|
||||||
$this->rights[$r][0] = 20005; // Permission id (must not be already used)
|
$this->rights[$r][0] = 20005; // Permission id (must not be already used)
|
||||||
$this->rights[$r][1] = 'Voir les logs de modification des congés payés'; // Permission label
|
$this->rights[$r][1] = 'See logs for holidays requests'; // Permission label
|
||||||
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
|
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
|
||||||
$this->rights[$r][4] = 'view_log'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
$this->rights[$r][4] = 'view_log'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||||
$r++;
|
$r++;
|
||||||
|
|
||||||
$this->rights[$r][0] = 20006; // Permission id (must not be already used)
|
$this->rights[$r][0] = 20006; // Permission id (must not be already used)
|
||||||
$this->rights[$r][1] = 'Accéder au rapport mensuel des congés payés'; // Permission label
|
$this->rights[$r][1] = 'Read holidays monthly report'; // Permission label
|
||||||
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
|
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
|
||||||
$this->rights[$r][4] = 'month_report'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
$this->rights[$r][4] = 'month_report'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||||
@ -179,7 +179,7 @@ class modHoliday extends DolibarrModules
|
|||||||
$this->menus = array(); // List of menus to add
|
$this->menus = array(); // List of menus to add
|
||||||
$r=0;
|
$r=0;
|
||||||
|
|
||||||
|
|
||||||
/* Move to HRM menu
|
/* Move to HRM menu
|
||||||
// Add here entries to declare new menus
|
// Add here entries to declare new menus
|
||||||
$this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu
|
$this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu
|
||||||
@ -261,7 +261,7 @@ class modHoliday extends DolibarrModules
|
|||||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||||
$r++;
|
$r++;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Exports
|
// Exports
|
||||||
$r=1;
|
$r=1;
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, orwrite
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
@ -38,11 +38,11 @@ require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
|
|||||||
$myparam = GETPOST("myparam");
|
$myparam = GETPOST("myparam");
|
||||||
$action=GETPOST('action', 'alpha');
|
$action=GETPOST('action', 'alpha');
|
||||||
$id=GETPOST('id', 'int');
|
$id=GETPOST('id', 'int');
|
||||||
|
$userid = GETPOST('userid')?GETPOST('userid'):$user->id;
|
||||||
|
|
||||||
// Protection if external user
|
// Protection if external user
|
||||||
if ($user->societe_id > 0) accessforbidden();
|
if ($user->societe_id > 0) accessforbidden();
|
||||||
|
|
||||||
$user_id = $user->id;
|
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
|
|
||||||
|
|
||||||
@ -56,93 +56,96 @@ if ($action == 'create')
|
|||||||
$cp = new Holiday($db);
|
$cp = new Holiday($db);
|
||||||
|
|
||||||
// Si pas le droit de créer une demande
|
// Si pas le droit de créer une demande
|
||||||
if(!$user->rights->holiday->write)
|
if (($userid == $user->id && empty($user->rights->holiday->write)) || ($userid != $user->id && empty($user->rights->holiday->write_all)))
|
||||||
{
|
{
|
||||||
header('Location: fiche.php?action=request&error=CantCreate');
|
$error++;
|
||||||
exit;
|
setEventMessage($langs->trans('CantCreateCP'));
|
||||||
|
$action='request';
|
||||||
}
|
}
|
||||||
|
|
||||||
$date_debut = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year'));
|
if (! $error)
|
||||||
$date_fin = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year'));
|
|
||||||
$date_debut_gmt = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year'), 1);
|
|
||||||
$date_fin_gmt = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year'), 1);
|
|
||||||
$starthalfday=GETPOST('starthalfday');
|
|
||||||
$endhalfday=GETPOST('endhalfday');
|
|
||||||
$halfday=0;
|
|
||||||
if ($starthalfday == 'afternoon' && $endhalfday == 'morning') $halfday=2;
|
|
||||||
else if ($starthalfday == 'afternoon') $halfday=-1;
|
|
||||||
else if ($endhalfday == 'morning') $halfday=1;
|
|
||||||
|
|
||||||
$valideur = GETPOST('valideur');
|
|
||||||
$description = trim(GETPOST('description'));
|
|
||||||
$userID = GETPOST('userID');
|
|
||||||
|
|
||||||
// Si pas de date de début
|
|
||||||
if (empty($date_debut))
|
|
||||||
{
|
{
|
||||||
header('Location: fiche.php?action=request&error=nodatedebut');
|
$date_debut = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year'));
|
||||||
exit;
|
$date_fin = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year'));
|
||||||
|
$date_debut_gmt = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year'), 1);
|
||||||
|
$date_fin_gmt = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year'), 1);
|
||||||
|
$starthalfday=GETPOST('starthalfday');
|
||||||
|
$endhalfday=GETPOST('endhalfday');
|
||||||
|
$halfday=0;
|
||||||
|
if ($starthalfday == 'afternoon' && $endhalfday == 'morning') $halfday=2;
|
||||||
|
else if ($starthalfday == 'afternoon') $halfday=-1;
|
||||||
|
else if ($endhalfday == 'morning') $halfday=1;
|
||||||
|
|
||||||
|
$valideur = GETPOST('valideur');
|
||||||
|
$description = trim(GETPOST('description'));
|
||||||
|
$userID = GETPOST('userID');
|
||||||
|
|
||||||
|
// Si pas de date de début
|
||||||
|
if (empty($date_debut))
|
||||||
|
{
|
||||||
|
header('Location: fiche.php?action=request&error=nodatedebut');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Si pas de date de fin
|
||||||
|
if (empty($date_fin))
|
||||||
|
{
|
||||||
|
header('Location: fiche.php?action=request&error=nodatefin');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Si date de début après la date de fin
|
||||||
|
if ($date_debut > $date_fin)
|
||||||
|
{
|
||||||
|
header('Location: fiche.php?action=request&error=datefin');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if there is already holiday for this period
|
||||||
|
$verifCP = $cp->verifDateHolidayCP($userID, $date_debut, $date_fin, $halfday);
|
||||||
|
if (! $verifCP)
|
||||||
|
{
|
||||||
|
header('Location: fiche.php?action=request&error=alreadyCP');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Si aucun jours ouvrés dans la demande
|
||||||
|
$nbopenedday=num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday);
|
||||||
|
if($nbopenedday < 1)
|
||||||
|
{
|
||||||
|
header('Location: fiche.php?action=request&error=DureeHoliday');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Si pas de validateur choisi
|
||||||
|
if ($valideur < 1)
|
||||||
|
{
|
||||||
|
header('Location: fiche.php?action=request&error=Valideur');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$cp->fk_user = $userid;
|
||||||
|
$cp->description = $description;
|
||||||
|
$cp->date_debut = $date_debut;
|
||||||
|
$cp->date_fin = $date_fin;
|
||||||
|
$cp->fk_validator = $valideur;
|
||||||
|
$cp->halfday = $halfday;
|
||||||
|
|
||||||
|
$verif = $cp->create($userid);
|
||||||
|
|
||||||
|
// Si pas d'erreur SQL on redirige vers la fiche de la demande
|
||||||
|
if ($verif > 0)
|
||||||
|
{
|
||||||
|
header('Location: fiche.php?id='.$verif);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Sinon on affiche le formulaire de demande avec le message d'erreur SQL
|
||||||
|
header('Location: fiche.php?action=request&error=SQL_Create&msg='.$cp->error);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si pas de date de fin
|
|
||||||
if (empty($date_fin))
|
|
||||||
{
|
|
||||||
header('Location: fiche.php?action=request&error=nodatefin');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Si date de début après la date de fin
|
|
||||||
if ($date_debut > $date_fin)
|
|
||||||
{
|
|
||||||
header('Location: fiche.php?action=request&error=datefin');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if there is already holiday for this period
|
|
||||||
$verifCP = $cp->verifDateHolidayCP($userID, $date_debut, $date_fin, $halfday);
|
|
||||||
if (! $verifCP)
|
|
||||||
{
|
|
||||||
header('Location: fiche.php?action=request&error=alreadyCP');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Si aucun jours ouvrés dans la demande
|
|
||||||
$nbopenedday=num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday);
|
|
||||||
if($nbopenedday < 1)
|
|
||||||
{
|
|
||||||
header('Location: fiche.php?action=request&error=DureeHoliday');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Si pas de validateur choisi
|
|
||||||
if ($valideur < 1)
|
|
||||||
{
|
|
||||||
header('Location: fiche.php?action=request&error=Valideur');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$cp->fk_user = $user_id;
|
|
||||||
$cp->description = $description;
|
|
||||||
$cp->date_debut = $date_debut;
|
|
||||||
$cp->date_fin = $date_fin;
|
|
||||||
$cp->fk_validator = $valideur;
|
|
||||||
$cp->halfday = $halfday;
|
|
||||||
|
|
||||||
$verif = $cp->create($user_id);
|
|
||||||
|
|
||||||
// Si pas d'erreur SQL on redirige vers la fiche de la demande
|
|
||||||
if ($verif > 0)
|
|
||||||
{
|
|
||||||
header('Location: fiche.php?id='.$verif);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Sinon on affiche le formulaire de demande avec le message d'erreur SQL
|
|
||||||
header('Location: fiche.php?action=request&error=SQL_Create&msg='.$cp->error);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'update')
|
if ($action == 'update')
|
||||||
@ -159,7 +162,7 @@ if ($action == 'update')
|
|||||||
else if ($endhalfday == 'morning') $halfday=1;
|
else if ($endhalfday == 'morning') $halfday=1;
|
||||||
|
|
||||||
// Si pas le droit de modifier une demande
|
// Si pas le droit de modifier une demande
|
||||||
if(!$user->rights->holiday->write)
|
if (! $user->rights->holiday->write)
|
||||||
{
|
{
|
||||||
header('Location: fiche.php?action=request&error=CantUpdate');
|
header('Location: fiche.php?action=request&error=CantUpdate');
|
||||||
exit;
|
exit;
|
||||||
@ -168,11 +171,13 @@ if ($action == 'update')
|
|||||||
$cp = new Holiday($db);
|
$cp = new Holiday($db);
|
||||||
$cp->fetch($_POST['holiday_id']);
|
$cp->fetch($_POST['holiday_id']);
|
||||||
|
|
||||||
// Si en attente de validation
|
$canedit=(($user->id == $cp->fk_user && $user->rights->holiday->write) || ($user->id != $cp->fk_user && $user->rights->holiday->write_all));
|
||||||
|
|
||||||
|
// Si en attente de validation
|
||||||
if ($cp->statut == 1)
|
if ($cp->statut == 1)
|
||||||
{
|
{
|
||||||
// Si c'est le créateur ou qu'il a le droit de tout lire / modifier
|
// Si c'est le créateur ou qu'il a le droit de tout lire / modifier
|
||||||
if ($user->id == $cp->fk_user || $user->rights->holiday->lire_tous)
|
if ($canedit)
|
||||||
{
|
{
|
||||||
$valideur = $_POST['valideur'];
|
$valideur = $_POST['valideur'];
|
||||||
$description = trim($_POST['description']);
|
$description = trim($_POST['description']);
|
||||||
@ -247,11 +252,13 @@ if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes')
|
|||||||
$cp = new Holiday($db);
|
$cp = new Holiday($db);
|
||||||
$cp->fetch($id);
|
$cp->fetch($id);
|
||||||
|
|
||||||
|
$canedit=(($user->id == $cp->fk_user && $user->rights->holiday->write) || ($user->id != $cp->fk_user && $user->rights->holiday->write_all));
|
||||||
|
|
||||||
// Si c'est bien un brouillon
|
// Si c'est bien un brouillon
|
||||||
if ($cp->statut == 1 || $cp->statut == 3)
|
if ($cp->statut == 1 || $cp->statut == 3)
|
||||||
{
|
{
|
||||||
// Si l'utilisateur à le droit de lire cette demande, il peut la supprimer
|
// Si l'utilisateur à le droit de lire cette demande, il peut la supprimer
|
||||||
if ($user->id == $cp->fk_user || $user->rights->holiday->lire_tous)
|
if ($canedit)
|
||||||
{
|
{
|
||||||
$result=$cp->delete($id);
|
$result=$cp->delete($id);
|
||||||
}
|
}
|
||||||
@ -653,13 +660,12 @@ $cp = new Holiday($db);
|
|||||||
|
|
||||||
$listhalfday=array('morning'=>$langs->trans("Morning"),"afternoon"=>$langs->trans("Afternoon"));
|
$listhalfday=array('morning'=>$langs->trans("Morning"),"afternoon"=>$langs->trans("Afternoon"));
|
||||||
|
|
||||||
|
|
||||||
llxHeader(array(),$langs->trans('CPTitreMenu'));
|
llxHeader(array(),$langs->trans('CPTitreMenu'));
|
||||||
|
|
||||||
if (empty($id) || $action == 'add' || $action == 'request')
|
if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create')
|
||||||
{
|
{
|
||||||
// Si l'utilisateur n'a pas le droit de faire une demande
|
// Si l'utilisateur n'a pas le droit de faire une demande
|
||||||
if(!$user->rights->holiday->write)
|
if (($userid == $user->id && empty($user->rights->holiday->write)) || ($userid != $user->id && empty($user->rights->holiday->write_all)))
|
||||||
{
|
{
|
||||||
$errors[]=$langs->trans('CantCreateCP');
|
$errors[]=$langs->trans('CantCreateCP');
|
||||||
}
|
}
|
||||||
@ -739,16 +745,26 @@ if (empty($id) || $action == 'add' || $action == 'request')
|
|||||||
// Formulaire de demande
|
// Formulaire de demande
|
||||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" onsubmit="return valider()" name="demandeCP">'."\n";
|
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" onsubmit="return valider()" name="demandeCP">'."\n";
|
||||||
print '<input type="hidden" name="action" value="create" />'."\n";
|
print '<input type="hidden" name="action" value="create" />'."\n";
|
||||||
print '<input type="hidden" name="userID" value="'.$user_id.'" />'."\n";
|
print '<input type="hidden" name="userID" value="'.$userid.'" />'."\n";
|
||||||
print '<div class="tabBar">';
|
print '<div class="tabBar">';
|
||||||
print '<span>'.$langs->trans('DelayToRequestCP',$cp->getConfCP('delayForRequest')).'</span><br /><br />';
|
print '<span>'.$langs->trans('DelayToRequestCP',$cp->getConfCP('delayForRequest')).'</span><br /><br />';
|
||||||
|
|
||||||
$nb_holiday = $cp->getCPforUser($user->id) / $cp->getConfCP('nbHolidayDeducted');
|
|
||||||
|
|
||||||
print '<span>'.$langs->trans('SoldeCPUser', round($nb_holiday,0)).'</span><br /><br />';
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
print '<tbody>';
|
print '<tbody>';
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
|
print '<td class="fieldrequired">'.$langs->trans("User").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
if (empty($user->rights->holiday->write_all))
|
||||||
|
{
|
||||||
|
print $form->select_users($userid,'useridbis',0,'',1);
|
||||||
|
print '<input type="hidden" name="userid" value="'.$userid.'">';
|
||||||
|
}
|
||||||
|
else print $form->select_users(GETPOST('userid')?GETPOST('userid'):$user->id,'userid',0,'',0);
|
||||||
|
$nb_holiday = $cp->getCPforUser($user->id) / $cp->getConfCP('nbHolidayDeducted');
|
||||||
|
print ' <span>'.$langs->trans('SoldeCPUser', round($nb_holiday,0)).'</span>';
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
print '<tr>';
|
||||||
print '<td class="fieldrequired">'.$langs->trans("DateDebCP").' ('.$langs->trans("FirstDayOfHoliday").')</td>';
|
print '<td class="fieldrequired">'.$langs->trans("DateDebCP").' ('.$langs->trans("FirstDayOfHoliday").')</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
// Si la demande ne vient pas de l'agenda
|
// Si la demande ne vient pas de l'agenda
|
||||||
@ -829,6 +845,8 @@ else
|
|||||||
{
|
{
|
||||||
$cp->fetch($id);
|
$cp->fetch($id);
|
||||||
|
|
||||||
|
$canedit=(($user->id == $cp->fk_user && $user->rights->holiday->write) || ($user->id != $cp->fk_user && $user->rights->holiday->write_all));
|
||||||
|
|
||||||
$valideur = new User($db);
|
$valideur = new User($db);
|
||||||
$valideur->fetch($cp->fk_validator);
|
$valideur->fetch($cp->fk_validator);
|
||||||
|
|
||||||
@ -875,9 +893,8 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
// On vérifie si l'utilisateur à le droit de lire cette demande
|
// On vérifie si l'utilisateur à le droit de lire cette demande
|
||||||
if($user->id == $cp->fk_user || $user->rights->holiday->lire_tous)
|
if ($canedit)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
if($user->rights->holiday->delete)
|
if($user->rights->holiday->delete)
|
||||||
@ -915,7 +932,7 @@ else
|
|||||||
|
|
||||||
dol_fiche_head($head,'card',$langs->trans("CPTitreMenu"),0,'holiday');
|
dol_fiche_head($head,'card',$langs->trans("CPTitreMenu"),0,'holiday');
|
||||||
|
|
||||||
if ($action == 'edit' && $user->id == $cp->fk_user && $cp->statut == 1)
|
if ($action == 'edit' && $cp->statut == 1)
|
||||||
{
|
{
|
||||||
$edit = true;
|
$edit = true;
|
||||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$_GET['id'].'">'."\n";
|
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$_GET['id'].'">'."\n";
|
||||||
@ -935,6 +952,11 @@ else
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
print '<td>'.$langs->trans("User").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
print $userRequest->getNomUrl(1);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
$starthalfday=($cp->halfday == -1 || $cp->halfday == 2)?'afternoon':'morning';
|
$starthalfday=($cp->halfday == -1 || $cp->halfday == 2)?'afternoon':'morning';
|
||||||
$endhalfday=($cp->halfday == 1 || $cp->halfday == 2)?'morning':'afternoon';
|
$endhalfday=($cp->halfday == 1 || $cp->halfday == 2)?'morning':'afternoon';
|
||||||
|
|
||||||
@ -1019,19 +1041,24 @@ else
|
|||||||
|
|
||||||
print '<br><br>';
|
print '<br><br>';
|
||||||
|
|
||||||
|
// Info workflow
|
||||||
print '<table class="border" width="50%">'."\n";
|
print '<table class="border" width="50%">'."\n";
|
||||||
print '<tbody>';
|
print '<tbody>';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td colspan="2">'.$langs->trans("InfosWorkflowCP").'</td>';
|
print '<td colspan="2">'.$langs->trans("InfosWorkflowCP").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr>';
|
if (! empty($cp->fk_user_create))
|
||||||
print '<td>'.$langs->trans('RequestByCP').'</td>';
|
{
|
||||||
print '<td>'.$userRequest->getNomUrl(1).'</td>';
|
$userCreate=new User($db);
|
||||||
print '</tr>';
|
$userCreate->fetch($cp->fk_user_create);
|
||||||
|
print '<tr>';
|
||||||
|
print '<td>'.$langs->trans('RequestByCP').'</td>';
|
||||||
|
print '<td>'.$userCreate->getNomUrl(1).'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
if(!$edit) {
|
if (!$edit) {
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td width="50%">'.$langs->trans('ReviewedByCP').'</td>';
|
print '<td width="50%">'.$langs->trans('ReviewedByCP').'</td>';
|
||||||
print '<td>'.$valideur->getNomUrl(1).'</td>';
|
print '<td>'.$valideur->getNomUrl(1).'</td>';
|
||||||
@ -1076,10 +1103,10 @@ else
|
|||||||
print '</tbody>';
|
print '</tbody>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
if ($edit && $user->id == $cp->fk_user && $cp->statut == 1)
|
if ($action == 'edit' && $cp->statut == 1)
|
||||||
{
|
{
|
||||||
print '<br><div align="center">';
|
print '<br><div align="center">';
|
||||||
if($user->rights->holiday->write && $_GET['action'] == 'edit' && $cp->statut == 1)
|
if ($canedit && $cp->statut == 1)
|
||||||
{
|
{
|
||||||
print '<input type="submit" value="'.$langs->trans("UpdateButtonCP").'" class="button">';
|
print '<input type="submit" value="'.$langs->trans("UpdateButtonCP").'" class="button">';
|
||||||
}
|
}
|
||||||
@ -1095,11 +1122,11 @@ else
|
|||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
// Boutons d'actions
|
// Boutons d'actions
|
||||||
if($user->rights->holiday->write && $_GET['action'] != 'edit' && $cp->statut == 1)
|
if ($canedit && $cp->statut == 1)
|
||||||
{
|
{
|
||||||
print '<a href="fiche.php?id='.$_GET['id'].'&action=edit" class="butAction">'.$langs->trans("EditCP").'</a>';
|
print '<a href="fiche.php?id='.$_GET['id'].'&action=edit" class="butAction">'.$langs->trans("EditCP").'</a>';
|
||||||
}
|
}
|
||||||
if($user->id == $cp->fk_user && $cp->statut == 1)
|
if ($canedit && $cp->statut == 1)
|
||||||
{
|
{
|
||||||
print '<a href="fiche.php?id='.$_GET['id'].'&action=sendToValidate" class="butAction">'.$langs->trans("Validate").'</a>';
|
print '<a href="fiche.php?id='.$_GET['id'].'&action=sendToValidate" class="butAction">'.$langs->trans("Validate").'</a>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -173,7 +173,7 @@ if ($id > 0)
|
|||||||
$user_id = $fuser->id;
|
$user_id = $fuser->id;
|
||||||
}
|
}
|
||||||
// Récupération des congés payés de l'utilisateur ou de tous les users
|
// Récupération des congés payés de l'utilisateur ou de tous les users
|
||||||
if (!$user->rights->holiday->lire_tous || $id > 0)
|
if (!$user->rights->holiday->write_all || $id > 0)
|
||||||
{
|
{
|
||||||
$holiday_payes = $holiday->fetchByUser($user_id,$order,$filter);
|
$holiday_payes = $holiday->fetchByUser($user_id,$order,$filter);
|
||||||
}
|
}
|
||||||
@ -278,7 +278,7 @@ $formother->select_year($year_create,'year_create',1, $min_year, 0);
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// UTILISATEUR
|
// UTILISATEUR
|
||||||
if($user->rights->holiday->lire_tous) {
|
if($user->rights->holiday->write_all) {
|
||||||
print '<td class="liste_titre" align="left">';
|
print '<td class="liste_titre" align="left">';
|
||||||
$form->select_users($search_employe,"search_employe",1,"",0,'');
|
$form->select_users($search_employe,"search_employe",1,"",0,'');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -287,7 +287,7 @@ if($user->rights->holiday->lire_tous) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// VALIDEUR
|
// VALIDEUR
|
||||||
if($user->rights->holiday->lire_tous)
|
if($user->rights->holiday->write_all)
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" align="left">';
|
print '<td class="liste_titre" align="left">';
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,10 @@
|
|||||||
|
|
||||||
ALTER TABLE llx_societe DROP COLUMN datea;
|
ALTER TABLE llx_societe DROP COLUMN datea;
|
||||||
|
|
||||||
|
ALTER TABLE llx_holiday ADD COLUMN fk_user_create integer;
|
||||||
|
ALTER TABLE llx_holiday ADD INDEX idx_holiday_fk_user_create (fk_user_create);
|
||||||
|
ALTER TABLE llx_holiday ADD INDEX idx_holiday_date_create (date_create);
|
||||||
|
ALTER TABLE llx_holiday ADD INDEX idx_holiday_fk_validator (fk_validator);
|
||||||
|
|
||||||
create table llx_c_email_templates
|
create table llx_c_email_templates
|
||||||
(
|
(
|
||||||
|
|||||||
@ -17,5 +17,8 @@
|
|||||||
-- ===================================================================
|
-- ===================================================================
|
||||||
|
|
||||||
ALTER TABLE llx_holiday ADD INDEX idx_holiday_fk_user (fk_user);
|
ALTER TABLE llx_holiday ADD INDEX idx_holiday_fk_user (fk_user);
|
||||||
|
ALTER TABLE llx_holiday ADD INDEX idx_holiday_fk_user_create (fk_user_create);
|
||||||
|
ALTER TABLE llx_holiday ADD INDEX idx_holiday_date_create (date_create);
|
||||||
ALTER TABLE llx_holiday ADD INDEX idx_holiday_date_debut (date_debut);
|
ALTER TABLE llx_holiday ADD INDEX idx_holiday_date_debut (date_debut);
|
||||||
ALTER TABLE llx_holiday ADD INDEX idx_holiday_date_fin (date_fin);
|
ALTER TABLE llx_holiday ADD INDEX idx_holiday_date_fin (date_fin);
|
||||||
|
ALTER TABLE llx_holiday ADD INDEX idx_holiday_fk_validator (fk_validator);
|
||||||
|
|||||||
@ -20,6 +20,7 @@ CREATE TABLE llx_holiday
|
|||||||
(
|
(
|
||||||
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
fk_user integer NOT NULL,
|
fk_user integer NOT NULL,
|
||||||
|
fk_user_create integer,
|
||||||
date_create DATETIME NOT NULL,
|
date_create DATETIME NOT NULL,
|
||||||
description VARCHAR( 255 ) NOT NULL,
|
description VARCHAR( 255 ) NOT NULL,
|
||||||
date_debut DATE NOT NULL,
|
date_debut DATE NOT NULL,
|
||||||
|
|||||||
@ -141,9 +141,10 @@ HolidaysRefused=Denied holidays
|
|||||||
HolidaysRefusedBody=Your request for holidays for %s to %s has been denied for the following reason :
|
HolidaysRefusedBody=Your request for holidays for %s to %s has been denied for the following reason :
|
||||||
HolidaysCanceled=Canceled holidays
|
HolidaysCanceled=Canceled holidays
|
||||||
HolidaysCanceledBody=Your request for holidays for %s to %s has been canceled.
|
HolidaysCanceledBody=Your request for holidays for %s to %s has been canceled.
|
||||||
Permission20001=Read/create/modify their holidays
|
Permission20000=Read you own holidays
|
||||||
Permission20002=Read/modify all requests of holidays
|
Permission20001=Create/modify your holidays
|
||||||
Permission20003=Delete their holidays requests
|
Permission20002=Create/modify holidays for everybody
|
||||||
Permission20004=Define users holidays
|
Permission20003=Delete holidays requests
|
||||||
|
Permission20004=Setup users holidays
|
||||||
Permission20005=Review log of modified holidays
|
Permission20005=Review log of modified holidays
|
||||||
Permission20006=Access holidays monthly report
|
Permission20006=Read holidays monthly report
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user