Qual: Clean module
This commit is contained in:
parent
b20c8d97c0
commit
84438d82f4
@ -1060,7 +1060,7 @@ class Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
//if ($obj->admin) $out.= ' *';
|
//if ($obj->admin) $out.= ' *';
|
||||||
if ($conf->global->MAIN_SHOW_LOGIN) $out.= ' ('.$obj->login.')';
|
if (! empty($conf->global->MAIN_SHOW_LOGIN)) $out.= ' ('.$obj->login.')';
|
||||||
$out.= '</option>';
|
$out.= '</option>';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -184,55 +184,87 @@ class modHoliday extends DolibarrModules
|
|||||||
|
|
||||||
// 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
|
||||||
'type'=>'top', // This is a Top menu entry
|
'type'=>'top', // This is a Top menu entry
|
||||||
'titre'=>'CPTitreMenu',
|
'titre'=>'CPTitreMenu',
|
||||||
'mainmenu'=>'holiday',
|
'mainmenu'=>'holiday',
|
||||||
'url'=>'/holiday/index.php?leftmenu=holiday',
|
'leftmenu'=>'holiday',
|
||||||
'langs'=>'holiday', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
'url'=>'/holiday/index.php',
|
||||||
'position'=>100,
|
'langs'=>'holiday', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||||
'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
'position'=>100,
|
||||||
'perms'=>'$user->rights->holiday->write', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
||||||
'target'=>'',
|
'perms'=>'$user->rights->holiday->write', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
'target'=>'',
|
||||||
// $r++;
|
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||||
//
|
$r++;
|
||||||
// Example to declare a Left Menu entry:
|
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=holiday', // Put 0 if this is a top menu
|
||||||
// $this->menu[$r]=array( 'fk_menu'=>'r=0', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
|
'type'=>'left', // This is a Top menu entry
|
||||||
// 'type'=>'left', // This is a Left menu entry
|
'titre'=>'CPTitreMenu',
|
||||||
// 'titre'=>'MyModule left menu 1',
|
'mainmenu'=>'holiday',
|
||||||
// 'mainmenu'=>'mymodule',
|
'leftmenu'=>'holiday',
|
||||||
// 'url'=>'/mymodule/pagelevel1.php',
|
'url'=>'/holiday/index.php?mainmenu=holiday&leftmenu=holiday',
|
||||||
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
'langs'=>'holiday', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||||
// 'position'=>100,
|
'position'=>100,
|
||||||
// 'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
||||||
// 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
'perms'=>'$user->rights->holiday->write', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||||
// 'target'=>'',
|
'target'=>'',
|
||||||
// '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++;
|
||||||
//
|
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=holiday,fk_leftmenu=holiday', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
|
||||||
// Example to declare another Left Menu entry:
|
'type'=>'left', // This is a Left menu entry
|
||||||
// $this->menu[$r]=array( 'fk_menu'=>'r=1', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
|
'titre'=>'MenuAddCP',
|
||||||
// 'type'=>'left', // This is a Left menu entry
|
'mainmenu'=>'holiday',
|
||||||
// 'titre'=>'MyModule left menu 2',
|
'leftmenu'=>'holiday_add',
|
||||||
// 'mainmenu'=>'mymodule',
|
'url'=>'/holiday/fiche.php?mainmenu=holiday&action=request',
|
||||||
// 'url'=>'/mymodule/pagelevel2.php',
|
'langs'=>'holiday', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||||
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
'position'=>101,
|
||||||
// 'position'=>100,
|
'enabled'=>'$conf->holiday->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
||||||
// 'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
'perms'=>'$user->rights->holiday->write', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||||
// 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
'target'=>'',
|
||||||
// 'target'=>'',
|
'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++;
|
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=holiday,fk_leftmenu=holiday', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
|
||||||
|
'type'=>'left', // This is a Left menu entry
|
||||||
|
'titre'=>'MenuConfCP',
|
||||||
|
'mainmenu'=>'holiday',
|
||||||
|
'leftmenu'=>'holiday_conf',
|
||||||
|
'url'=>'/holiday/define_holiday.php?mainmenu=holiday&action=request',
|
||||||
|
'langs'=>'holiday', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||||
|
'position'=>102,
|
||||||
|
'enabled'=>'$conf->holiday->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
||||||
|
'perms'=>'$user->rights->holiday->define_holiday', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||||
|
'target'=>'',
|
||||||
|
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||||
|
$r++;
|
||||||
|
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=holiday,fk_leftmenu=holiday', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
|
||||||
|
'type'=>'left', // This is a Left menu entry
|
||||||
|
'titre'=>'MenuLogCP',
|
||||||
|
'mainmenu'=>'holiday_def',
|
||||||
|
'url'=>'/holiday/view_log.php?mainmenu=holiday&action=request',
|
||||||
|
'leftmenu'=>'holiday',
|
||||||
|
'langs'=>'holiday', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||||
|
'position'=>103,
|
||||||
|
'enabled'=>'$conf->holiday->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
||||||
|
'perms'=>'$user->rights->holiday->view_log', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||||
|
'target'=>'',
|
||||||
|
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||||
|
$r++;
|
||||||
|
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=holiday,fk_leftmenu=holiday', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
|
||||||
|
'type'=>'left', // This is a Left menu entry
|
||||||
|
'titre'=>'MenuReportMonth',
|
||||||
|
'mainmenu'=>'holiday',
|
||||||
|
'leftmenu'=>'holiday_report',
|
||||||
|
'url'=>'/holiday/month_report.php?mainmenu=holiday&action=request',
|
||||||
|
'langs'=>'holiday', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||||
|
'position'=>104,
|
||||||
|
'enabled'=>'$conf->holiday->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
||||||
|
'perms'=>'$user->rights->holiday->view_log', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||||
|
'target'=>'',
|
||||||
|
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||||
|
$r++;
|
||||||
|
|
||||||
// Exports
|
// Exports
|
||||||
$r=1;
|
$r=1;
|
||||||
|
|
||||||
|
|
||||||
// Agenda
|
|
||||||
$this->Agenda = 1;
|
|
||||||
$this->agendas = array('holiday:holidayAgenda');
|
|
||||||
|
|
||||||
// Example:
|
// Example:
|
||||||
// $this->export_code[$r]=$this->rights_class.'_'.$r;
|
// $this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||||
// $this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
// $this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||||
|
|||||||
@ -20,18 +20,14 @@
|
|||||||
* \file holiday.class.php
|
* \file holiday.class.php
|
||||||
* \ingroup holiday
|
* \ingroup holiday
|
||||||
* \brief Class file of the module paid holiday.
|
* \brief Class file of the module paid holiday.
|
||||||
* \version $Id: holiday.class.php,v 1.00 2011/09/15 11:00:00 dmouillard Exp $
|
|
||||||
* \author dmouillard@teclib.com <Dimitri Mouillard>
|
|
||||||
* \remarks Class file of the module paid holiday.
|
|
||||||
*/
|
*/
|
||||||
|
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \class Holiday
|
* Class of the module paid holiday. Developed by Teclib ( http://www.teclib.com/ )
|
||||||
* \brief Class pour les Congés Payés
|
|
||||||
* \remarks Développé par Teclib ( http://www.teclib.com/ )
|
|
||||||
*/
|
*/
|
||||||
class Holiday // extends CommonObject
|
class Holiday extends CommonObject
|
||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
var $error;
|
var $error;
|
||||||
@ -65,7 +61,7 @@ class Holiday // extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param DB Database handler
|
* @param DoliDB $db Database handler
|
||||||
*/
|
*/
|
||||||
function __construct($db)
|
function __construct($db)
|
||||||
{
|
{
|
||||||
@ -81,10 +77,11 @@ class Holiday // extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Créer un congés payés dans la base de données
|
* Créer un congés payés dans la base de données
|
||||||
* \param user User that create
|
*
|
||||||
* \param notrigger 0=launch triggers after, 1=disable triggers
|
* @param User $user User that create
|
||||||
* \return int <0 if KO, Id of created object if OK
|
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||||
|
* @return int <0 if KO, Id of created object if OK
|
||||||
*/
|
*/
|
||||||
function create($user, $notrigger=0)
|
function create($user, $notrigger=0)
|
||||||
{
|
{
|
||||||
@ -158,9 +155,10 @@ class Holiday // extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Load object in memory from database
|
* Load object in memory from database
|
||||||
* \param id id object
|
*
|
||||||
* \return int <0 if KO, >0 if OK
|
* @param int $id Id object
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function fetch($id)
|
function fetch($id)
|
||||||
{
|
{
|
||||||
@ -227,11 +225,12 @@ class Holiday // extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Liste les congés payés pour un utilisateur
|
* Liste les congés payés pour un utilisateur
|
||||||
* \param user id ID de l'utilisateur à lister
|
*
|
||||||
* \param order Filtrage par ordre
|
* @param int $user_id ID de l'utilisateur à lister
|
||||||
* \param filter Filtre de séléction
|
* @param string $order Filtrage par ordre
|
||||||
* \return int -1 si erreur, 1 si OK et 2 si pas de résultat
|
* @param string $filter Filtre de séléction
|
||||||
|
* @return int -1 si erreur, 1 si OK et 2 si pas de résultat
|
||||||
*/
|
*/
|
||||||
function fetchByUser($user_id,$order='',$filter='')
|
function fetchByUser($user_id,$order='',$filter='')
|
||||||
{
|
{
|
||||||
@ -321,10 +320,11 @@ class Holiday // extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Liste les congés payés de tout les utilisateurs
|
* Liste les congés payés de tout les utilisateurs
|
||||||
* \param order Filtrage par ordre
|
*
|
||||||
* \param filter Filtre de séléction
|
* @param string $order Filtrage par ordre
|
||||||
* \return int -1 si erreur, 1 si OK et 2 si pas de résultat
|
* @param string $filter Filtre de séléction
|
||||||
|
* @return int -1 si erreur, 1 si OK et 2 si pas de résultat
|
||||||
*/
|
*/
|
||||||
function fetchAll($order,$filter)
|
function fetchAll($order,$filter)
|
||||||
{
|
{
|
||||||
@ -413,10 +413,11 @@ class Holiday // extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Update database
|
* Update database
|
||||||
* \param user User that modify
|
*
|
||||||
* \param notrigger 0=launch triggers after, 1=disable triggers
|
* @param User $user User that modify
|
||||||
* \return int <0 if KO, >0 if OK
|
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function update($user=0, $notrigger=0)
|
function update($user=0, $notrigger=0)
|
||||||
{
|
{
|
||||||
@ -521,9 +522,9 @@ class Holiday // extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Delete object in database
|
* Delete object in database
|
||||||
*
|
*
|
||||||
* @param user User that delete
|
* @param User $user User that delete
|
||||||
* @param notrigger 0=launch triggers after, 1=disable triggers
|
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function delete($user, $notrigger=0)
|
function delete($user, $notrigger=0)
|
||||||
{
|
{
|
||||||
@ -565,11 +566,12 @@ class Holiday // extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* verifDateHolidayCP
|
||||||
*
|
*
|
||||||
* @param unknown_type $fk_user
|
* @param int $fk_user Id user
|
||||||
* @param unknown_type $dateDebut
|
* @param date $dateDebut Start date
|
||||||
* @param unknown_type $dateFin
|
* @param date $dateFin End date
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function verifDateHolidayCP($fk_user,$dateDebut,$dateFin)
|
function verifDateHolidayCP($fk_user,$dateDebut,$dateFin)
|
||||||
{
|
{
|
||||||
@ -588,9 +590,10 @@ class Holiday // extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retourne la traduction du statut d'un congé payé
|
* Retourne la traduction du statut d'un congé payé
|
||||||
* \param statut int du statut du congé
|
*
|
||||||
* \return string retourne la traduction du statut
|
* @param int $statut int du statut du congé
|
||||||
|
* @return string retourne la traduction du statut
|
||||||
*/
|
*/
|
||||||
function getStatutCP($statut) {
|
function getStatutCP($statut) {
|
||||||
|
|
||||||
@ -620,9 +623,10 @@ class Holiday // extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Affiche un select HTML des statuts de congés payés
|
* Affiche un select HTML des statuts de congés payés
|
||||||
* \param selected int du statut séléctionné par défaut
|
*
|
||||||
* \return select affiche le select des statuts
|
* @param int $selected int du statut séléctionné par défaut
|
||||||
|
* @return string affiche le select des statuts
|
||||||
*/
|
*/
|
||||||
function selectStatutCP($selected='') {
|
function selectStatutCP($selected='') {
|
||||||
|
|
||||||
@ -652,9 +656,10 @@ class Holiday // extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retourne un select HTML des groupes d'utilisateurs
|
* Retourne un select HTML des groupes d'utilisateurs
|
||||||
* \param prefix nom du champ dans le formulaire
|
*
|
||||||
* \return select retourne le select des groupes
|
* @param string $prefix nom du champ dans le formulaire
|
||||||
|
* @return string retourne le select des groupes
|
||||||
*/
|
*/
|
||||||
function selectUserGroup($prefix)
|
function selectUserGroup($prefix)
|
||||||
{
|
{
|
||||||
@ -709,8 +714,9 @@ class Holiday // extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Met à jour une option du module Holiday Payés
|
* Met à jour une option du module Holiday Payés
|
||||||
*
|
*
|
||||||
* @param name nom du paramètre de configuration
|
* @param string $name nom du paramètre de configuration
|
||||||
* @return value vrai si mise à jour OK sinon faux
|
* @param string $value vrai si mise à jour OK sinon faux
|
||||||
|
* @return boolean ok or ko
|
||||||
*/
|
*/
|
||||||
function updateConfCP($name,$value) {
|
function updateConfCP($name,$value) {
|
||||||
|
|
||||||
@ -730,8 +736,8 @@ class Holiday // extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Retourne la valeur d'un paramètre de configuration
|
* Retourne la valeur d'un paramètre de configuration
|
||||||
*
|
*
|
||||||
* @param name nom du paramètre de configuration
|
* @param string $name nom du paramètre de configuration
|
||||||
* @return string retourne la valeur du paramètre
|
* @return string retourne la valeur du paramètre
|
||||||
*/
|
*/
|
||||||
function getConfCP($name)
|
function getConfCP($name)
|
||||||
{
|
{
|
||||||
@ -759,9 +765,11 @@ class Holiday // extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Met à jour le timestamp de la dernière mise à jour du solde des CP
|
* Met à jour le timestamp de la dernière mise à jour du solde des CP
|
||||||
*
|
*
|
||||||
* @return nothing ne retourne rien
|
* @param int $userID Id of user
|
||||||
|
* @param int $nbHoliday Nb of days
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function updateSoldeCP($userID='',$nbHoliday='')
|
function updateSoldeCP($userID='',$nbHoliday='')
|
||||||
{
|
{
|
||||||
@ -827,9 +835,10 @@ class Holiday // extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retourne un checked si vrai
|
* Retourne un checked si vrai
|
||||||
* \param name nom du paramètre de configuration
|
*
|
||||||
* \return string retourne checked si > 0
|
* @param string $name nom du paramètre de configuration
|
||||||
|
* @return string retourne checked si > 0
|
||||||
*/
|
*/
|
||||||
function getCheckOption($name) {
|
function getCheckOption($name) {
|
||||||
|
|
||||||
@ -851,9 +860,11 @@ class Holiday // extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Créer les entrées pour chaque utilisateur au moment de la configuration
|
* Créer les entrées pour chaque utilisateur au moment de la configuration
|
||||||
*
|
*
|
||||||
* @return nothing ne retourne rien
|
* @param boolean $single Single
|
||||||
|
* @param int $userid Id user
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function createCPusers($single=false,$userid='')
|
function createCPusers($single=false,$userid='')
|
||||||
{
|
{
|
||||||
@ -879,9 +890,10 @@ class Holiday // extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Supprime un utilisateur du module Congés Payés
|
* Supprime un utilisateur du module Congés Payés
|
||||||
* \param int ID de l'utilisateur à supprimer
|
*
|
||||||
* \return boolean Vrai si pas d'erreur, faut si Erreur
|
* @param int $user_id ID de l'utilisateur à supprimer
|
||||||
|
* @return boolean Vrai si pas d'erreur, faut si Erreur
|
||||||
*/
|
*/
|
||||||
function deleteCPuser($user_id) {
|
function deleteCPuser($user_id) {
|
||||||
|
|
||||||
@ -894,9 +906,10 @@ class Holiday // extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retourne le solde de congés payés pour un utilisateur
|
* Retourne le solde de congés payés pour un utilisateur
|
||||||
* \param user_id ID de l'utilisateur
|
*
|
||||||
* \return float Retourne le solde de congés payés de l'utilisateur
|
* @param int $user_id ID de l'utilisateur
|
||||||
|
* @return float Retourne le solde de congés payés de l'utilisateur
|
||||||
*/
|
*/
|
||||||
function getCPforUser($user_id) {
|
function getCPforUser($user_id) {
|
||||||
|
|
||||||
@ -919,9 +932,9 @@ class Holiday // extends CommonObject
|
|||||||
* Liste la liste des utilisateurs du module congés
|
* Liste la liste des utilisateurs du module congés
|
||||||
* uniquement pour vérifier si il existe de nouveau utilisateur
|
* uniquement pour vérifier si il existe de nouveau utilisateur
|
||||||
*
|
*
|
||||||
* @param boolean si vrai retourne une liste, si faux retourne un array
|
* @param boolean $liste si vrai retourne une liste, si faux retourne un array
|
||||||
* @param boolean si vrai retourne pour Dolibarr si faux retourne pour CP
|
* @param boolean $type si vrai retourne pour Dolibarr si faux retourne pour CP
|
||||||
* @return string retourne un tableau de tout les utilisateurs actifs
|
* @return string retourne un tableau de tout les utilisateurs actifs
|
||||||
*/
|
*/
|
||||||
function fetchUsers($liste=true,$type=true)
|
function fetchUsers($liste=true,$type=true)
|
||||||
{
|
{
|
||||||
@ -1093,8 +1106,9 @@ class Holiday // extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Compte le nombre d'utilisateur actifs dans Dolibarr
|
* Compte le nombre d'utilisateur actifs dans Dolibarr
|
||||||
* \return int retourne le nombre d'utilisateur
|
*
|
||||||
|
* @return int retourne le nombre d'utilisateur
|
||||||
*/
|
*/
|
||||||
function countActiveUsers() {
|
function countActiveUsers() {
|
||||||
|
|
||||||
@ -1109,10 +1123,11 @@ class Holiday // extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Compare le nombre d'utilisateur actif de Dolibarr à celui des utilisateurs des congés payés
|
* Compare le nombre d'utilisateur actif de Dolibarr à celui des utilisateurs des congés payés
|
||||||
* \param nbUsersDolibarr nombre d'utilisateur actifs dans Dolibarr
|
*
|
||||||
* \param nbUsersHoliday nombre d'utilisateur actifs dans le module congés payés
|
* @param int $userDolibarr nombre d'utilisateur actifs dans Dolibarr
|
||||||
* \return nothing ne retourne rien
|
* @param int $userCP nombre d'utilisateur actifs dans le module congés payés
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function verifNbUsers($userDolibarr,$userCP) {
|
function verifNbUsers($userDolibarr,$userCP) {
|
||||||
|
|
||||||
@ -1200,9 +1215,12 @@ class Holiday // extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retourne le nombre de jours ouvrés entre deux dates
|
* Retourne le nombre de jours ouvrés entre deux dates
|
||||||
* \param Date de début et date de fin au format TimeStamp
|
* Prise en compte des jours fériés en France
|
||||||
* \remarks Prise en compte des jours fériés en France
|
*
|
||||||
|
* @param date $date_start Start date
|
||||||
|
* @param date $date_stop Stop date
|
||||||
|
* @return int Nb of days
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getOpenDays($date_start, $date_stop) {
|
function getOpenDays($date_start, $date_stop) {
|
||||||
@ -1214,7 +1232,7 @@ class Holiday // extends CommonObject
|
|||||||
$diff_year = date('Y', $date_stop) - date('Y', $date_start);
|
$diff_year = date('Y', $date_stop) - date('Y', $date_start);
|
||||||
|
|
||||||
for ($i = 0; $i <= $diff_year; $i++) {
|
for ($i = 0; $i <= $diff_year; $i++) {
|
||||||
$year = (int)date('Y', $date_start) + $i;
|
$year = (int) date('Y', $date_start) + $i;
|
||||||
// Liste des jours feriés
|
// Liste des jours feriés
|
||||||
$arr_bank_holidays[] = '1_1_'.$year; // Jour de l'an
|
$arr_bank_holidays[] = '1_1_'.$year; // Jour de l'an
|
||||||
$arr_bank_holidays[] = '1_5_'.$year; // Fete du travail
|
$arr_bank_holidays[] = '1_5_'.$year; // Fete du travail
|
||||||
@ -1247,8 +1265,9 @@ class Holiday // extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Liste les évènements de congés payés enregistré
|
* Liste les évènements de congés payés enregistré
|
||||||
* \return int -1 si erreur, 1 si OK et 2 si pas de résultat
|
*
|
||||||
|
* @return int -1 si erreur, 1 si OK et 2 si pas de résultat
|
||||||
*/
|
*/
|
||||||
function fetchEventsCP()
|
function fetchEventsCP()
|
||||||
{
|
{
|
||||||
@ -1301,8 +1320,11 @@ class Holiday // extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Créer un évènement de congés payés
|
* Créer un évènement de congés payés
|
||||||
* \return int -1 si erreur, id si OK
|
*
|
||||||
|
* @param User $user User
|
||||||
|
* @param int $notrigger No trigger
|
||||||
|
* @return int -1 si erreur, id si OK
|
||||||
*/
|
*/
|
||||||
function createEventCP($user, $notrigger=0)
|
function createEventCP($user, $notrigger=0)
|
||||||
{
|
{
|
||||||
@ -1354,8 +1376,12 @@ class Holiday // extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Met à jour les évènements de congés payés
|
* Met à jour les évènements de congés payés
|
||||||
* \return int -1 si erreur, id si OK
|
*
|
||||||
|
* @param int $rowid Row id
|
||||||
|
* @param string $name Name
|
||||||
|
* @param value $value Value
|
||||||
|
* @return int -1 si erreur, id si OK
|
||||||
*/
|
*/
|
||||||
function updateEventCP($rowid, $name, $value) {
|
function updateEventCP($rowid, $name, $value) {
|
||||||
|
|
||||||
@ -1372,7 +1398,13 @@ class Holiday // extends CommonObject
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectEventCP() {
|
/**
|
||||||
|
* select event
|
||||||
|
*
|
||||||
|
* @return string|boolean
|
||||||
|
*/
|
||||||
|
function selectEventCP()
|
||||||
|
{
|
||||||
|
|
||||||
$sql = "SELECT *";
|
$sql = "SELECT *";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."holiday_events";
|
$sql.= " FROM ".MAIN_DB_PREFIX."holiday_events";
|
||||||
@ -1405,6 +1437,12 @@ class Holiday // extends CommonObject
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* deleteEvent
|
||||||
|
*
|
||||||
|
* @param int $rowid Row id
|
||||||
|
* @return boolean Success or not
|
||||||
|
*/
|
||||||
function deleteEventCP($rowid) {
|
function deleteEventCP($rowid) {
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."holiday_events";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."holiday_events";
|
||||||
@ -1419,6 +1457,12 @@ class Holiday // extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getValueEventCp
|
||||||
|
*
|
||||||
|
* @param int $rowid Row id
|
||||||
|
* @return string|boolean
|
||||||
|
*/
|
||||||
function getValueEventCp($rowid) {
|
function getValueEventCp($rowid) {
|
||||||
|
|
||||||
$sql = "SELECT value";
|
$sql = "SELECT value";
|
||||||
@ -1435,6 +1479,12 @@ class Holiday // extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getNameEventCp
|
||||||
|
*
|
||||||
|
* @param int $rowid Row id
|
||||||
|
* @return unknown|boolean
|
||||||
|
*/
|
||||||
function getNameEventCp($rowid) {
|
function getNameEventCp($rowid) {
|
||||||
|
|
||||||
$sql = "SELECT name";
|
$sql = "SELECT name";
|
||||||
@ -1451,6 +1501,15 @@ class Holiday // extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* addLogCP
|
||||||
|
*
|
||||||
|
* @param int $fk_user_action Id user creation
|
||||||
|
* @param int $fk_user_update Id user update
|
||||||
|
* @param int $type Type
|
||||||
|
* @param int $new_solde New value
|
||||||
|
* @return number|string
|
||||||
|
*/
|
||||||
function addLogCP($fk_user_action,$fk_user_update,$type,$new_solde) {
|
function addLogCP($fk_user_action,$fk_user_update,$type,$new_solde) {
|
||||||
|
|
||||||
global $conf, $langs, $db;
|
global $conf, $langs, $db;
|
||||||
@ -1513,10 +1572,11 @@ class Holiday // extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Liste le log des congés payés
|
* Liste le log des congés payés
|
||||||
* \param order Filtrage par ordre
|
*
|
||||||
* \param filter Filtre de séléction
|
* @param string $order Filtrage par ordre
|
||||||
* \return int -1 si erreur, 1 si OK et 2 si pas de résultat
|
* @param string $filter Filtre de séléction
|
||||||
|
* @return int -1 si erreur, 1 si OK et 2 si pas de résultat
|
||||||
*/
|
*/
|
||||||
function fetchLog($order,$filter)
|
function fetchLog($order,$filter)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,278 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2011 Anthony Hebert <ahebert@teclib.com>
|
|
||||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
|
||||||
* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file holidayagenda.class.php
|
|
||||||
* \ingroup holiday
|
|
||||||
* \brief Fichier d'agenda pour le module Congés Payés
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \class CommonAgenda
|
|
||||||
* \brief Classe mere pour heritage des classes Agenda
|
|
||||||
*/
|
|
||||||
|
|
||||||
// FIXME this class not exist
|
|
||||||
//require_once DOL_DOCUMENT_ROOT.'/core/class/commonagenda.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
|
||||||
|
|
||||||
|
|
||||||
class HolidayAgenda// extends CommonAgenda
|
|
||||||
{
|
|
||||||
var $db;
|
|
||||||
|
|
||||||
// Nombre de seconde à ajouter ou soustraire pour être GMT?
|
|
||||||
var $offset = 3600;
|
|
||||||
|
|
||||||
// Pays ou calendrier assujetti à l'heure d'été?
|
|
||||||
var $summerTime = 0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param DoliDB $db Database access handler
|
|
||||||
*/
|
|
||||||
function construct($db)
|
|
||||||
{
|
|
||||||
$this->db = $db;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fonction permettant d'altérer les paramètres javascript
|
|
||||||
* du calendrier
|
|
||||||
* @what string clé de paramètre recherché
|
|
||||||
*/
|
|
||||||
function getParams($what = ''){
|
|
||||||
|
|
||||||
$params = array( 'timeslotsPerHour' => 2,
|
|
||||||
'businessHours' => '{start: 0, end: 24, limitDisplay: true }');
|
|
||||||
|
|
||||||
if(empty($what)){
|
|
||||||
return $params;
|
|
||||||
}elseif(array_key_exists($what,$params)){
|
|
||||||
return $params[$what];
|
|
||||||
}else{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Accesseur des évènements à mettre dans l'agenda
|
|
||||||
* @param $start Timestamp de début
|
|
||||||
* @param $end Timestamp de fin
|
|
||||||
* @param $options Array stockage de paramètre à utiliser au besoin.
|
|
||||||
* @return $events Events encodés en Json
|
|
||||||
*/
|
|
||||||
function getEvents($start,$end,$options)
|
|
||||||
{
|
|
||||||
global $langs,$conf,$user,$db;
|
|
||||||
|
|
||||||
$langs->load('holiday');
|
|
||||||
$data = array();
|
|
||||||
|
|
||||||
if(!isset($options['user']) or empty($options['user'])):
|
|
||||||
$users_id = $user->id;
|
|
||||||
else:
|
|
||||||
$users_id = $options['user'];
|
|
||||||
endif;
|
|
||||||
|
|
||||||
$sql = "SELECT lcp.rowid as id,
|
|
||||||
UNIX_TIMESTAMP(date_debut) as start,
|
|
||||||
UNIX_TIMESTAMP(CONCAT(date_fin, ' 23:59:59')) as end,
|
|
||||||
lu.firstname as prenom,
|
|
||||||
lu.name as nom,
|
|
||||||
lcp.description as title,
|
|
||||||
lcp.statut as statut
|
|
||||||
FROM llx_holiday lcp
|
|
||||||
INNER JOIN llx_user lu
|
|
||||||
ON lu.rowid = lcp.fk_user
|
|
||||||
WHERE lcp.fk_user = {$users_id}
|
|
||||||
AND lcp.statut in (1,3)
|
|
||||||
AND (UNIX_TIMESTAMP(date_debut) BETWEEN LEFT('$start',10) AND LEFT('$end',10)
|
|
||||||
OR UNIX_TIMESTAMP(CONCAT(date_fin, ' 23:59:59')) BETWEEN LEFT('$start',10) AND LEFT('$end',10))
|
|
||||||
";
|
|
||||||
|
|
||||||
$qry = $db->query($sql);
|
|
||||||
$nbr = $db->num_rows($qry);
|
|
||||||
|
|
||||||
if($nbr)
|
|
||||||
{
|
|
||||||
$i = 0;
|
|
||||||
while($res = $db->fetch_object($qry))
|
|
||||||
{
|
|
||||||
$data[$i]['eventid'] = $res->id;
|
|
||||||
$data[$i]['readonly'] = 0;
|
|
||||||
$data[$i]['draggable'] = 0;
|
|
||||||
$data[$i]['resizable'] = 0;
|
|
||||||
$data[$i]['eventstart'] = (string)$res->start;
|
|
||||||
$data[$i]['eventend'] = (string)$res->end;
|
|
||||||
$data[$i]['eventmessage'] = $res->message;
|
|
||||||
$data[$i]['extraInfo'] = $res->message;
|
|
||||||
$data[$i]['color'] = "#7AAC22";
|
|
||||||
$data[$i]['type'] = $langs->trans('CPTitreMenu');
|
|
||||||
$data[$i]['icon'] = "<img src='".DOL_URL_ROOT."/holiday/img/holiday.png' height=13 width=13 />";
|
|
||||||
|
|
||||||
|
|
||||||
$data[$i]['eventtitle'] = "<strong>{$res->prenom} {$res->nom}<br />{$res->title}</strong>";
|
|
||||||
$data[$i]['eventtitle'] .= ($res->statut == 1) ? "<br />{$langs->trans('ToValidateCP')}" : "<br />{$langs->trans('ValidateCP')}";
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function getFormItems()
|
|
||||||
{
|
|
||||||
global $conf;
|
|
||||||
|
|
||||||
$fields = array(
|
|
||||||
'selectedTab' => 'input',
|
|
||||||
'user' => 'select'
|
|
||||||
|
|
||||||
);
|
|
||||||
|
|
||||||
return $fields;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Accesseur d'un formulaire à mettre en en-tête de l'agenda
|
|
||||||
* @return $form code html
|
|
||||||
*/
|
|
||||||
function getForm($get,$post)
|
|
||||||
{
|
|
||||||
global $user,$langs,$conf,$db;
|
|
||||||
|
|
||||||
$post = $get + $post;
|
|
||||||
|
|
||||||
if($user->admin){
|
|
||||||
$sql = "SELECT * from llx_user where statut = 1";
|
|
||||||
$options = "";
|
|
||||||
$qry = $db->query($sql);
|
|
||||||
while($res = $db->fetch_object($qry)){
|
|
||||||
$options .= ((isset($_POST['user']) && $res->rowid == $_POST['user']) or ($res->rowid == $user->id and !isset($_POST['user'])))
|
|
||||||
? "<option value={$res->rowid} selected='selected'>{$res->firstname} {$res->name}</option>"
|
|
||||||
: "<option value={$res->rowid}>{$res->firstname} {$res->name}</option>";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$options = "<option value={$user->id} selected='selected'>{$user->prenom} {$user->nom}</option>";
|
|
||||||
}
|
|
||||||
|
|
||||||
$HTML = <<<HTML
|
|
||||||
<form method='post' action="{$_SERVER["PHP_SELF"]}">
|
|
||||||
<table class='border' width='100%'>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
{$langs->trans('Collab')}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<select name='user' id='user'>
|
|
||||||
{$options}
|
|
||||||
</select>
|
|
||||||
<input type='hidden' name='selectedTab' value='holidayagenda' />
|
|
||||||
<input type='submit' value='Envoyer' class='button' />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</form>
|
|
||||||
HTML;
|
|
||||||
$form = $HTML;
|
|
||||||
return $form;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exporteur au format iCal
|
|
||||||
* @see http://tools.ietf.org/html/rfc5545
|
|
||||||
* @todo Export en iCal
|
|
||||||
* @return $iCal calendrier au format iCal
|
|
||||||
*/
|
|
||||||
static function exportIniCal()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Générateur du lien public d'accès au calendrier iCal
|
|
||||||
* @see http://tools.ietf.org/html/rfc5545
|
|
||||||
* @todo Générer le lien
|
|
||||||
* @return $iCal calendrier au format iCal
|
|
||||||
*/
|
|
||||||
function getiCalLink()
|
|
||||||
{
|
|
||||||
global $conf,$user,$langs;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Accesseur du label à afficher par print_fiche_titre()
|
|
||||||
* @return $label Label de l'agenda
|
|
||||||
*/
|
|
||||||
function getLabel()
|
|
||||||
{
|
|
||||||
global $user,$langs,$conf;
|
|
||||||
$langs->load('holiday');
|
|
||||||
ob_start();
|
|
||||||
print_fiche_titre($langs->trans('ListeCP'));
|
|
||||||
$label = ob_get_contents();
|
|
||||||
ob_end_clean();
|
|
||||||
|
|
||||||
return $label;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function getTitle()
|
|
||||||
{
|
|
||||||
global $langs;
|
|
||||||
$langs->load('holiday');
|
|
||||||
return $langs->trans('CPTitreMenu');
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function getLink($action = "")
|
|
||||||
{
|
|
||||||
global $conf,$user;
|
|
||||||
|
|
||||||
$action = ($action == 'create') ? 'request' : '';
|
|
||||||
$url = DOL_URL_ROOT."/holiday/fiche.php";
|
|
||||||
|
|
||||||
return (empty($action)) ? $url : $url."?action={$action}";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
@ -25,8 +25,9 @@
|
|||||||
* \author dmouillard@teclib.com <Dimitri Mouillard>
|
* \author dmouillard@teclib.com <Dimitri Mouillard>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require('pre.inc.php');
|
require('../main.inc.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT. "/user/class/user.class.php");
|
require_once(DOL_DOCUMENT_ROOT. "/user/class/user.class.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT. "/holiday/common.inc.php");
|
||||||
|
|
||||||
// Protection if external user
|
// Protection if external user
|
||||||
if ($user->societe_id > 0) accessforbidden();
|
if ($user->societe_id > 0) accessforbidden();
|
||||||
@ -41,7 +42,9 @@ $action=GETPOST('action');
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader($langs->trans('CPTitreMenu'));
|
$form = new Form($db);
|
||||||
|
|
||||||
|
llxHeader(array(),$langs->trans('CPTitreMenu'));
|
||||||
|
|
||||||
print_fiche_titre($langs->trans('MenuConfCP'));
|
print_fiche_titre($langs->trans('MenuConfCP'));
|
||||||
|
|
||||||
@ -111,7 +114,25 @@ elseif($action == 'add_event')
|
|||||||
$var=true;
|
$var=true;
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
print '<div class="tabBar">';
|
$cp_events = $holiday->fetchEventsCP();
|
||||||
|
|
||||||
|
if($cp_events == 1)
|
||||||
|
{
|
||||||
|
print '<br><form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||||
|
print '<input type="hidden" name="action" value="add_event" />';
|
||||||
|
|
||||||
|
print_fiche_titre($langs->trans('DefineEventUserCP'),'','');
|
||||||
|
|
||||||
|
print $langs->trans('MotifCP').' : ';
|
||||||
|
print $holiday->selectEventCP();
|
||||||
|
print ' '.$langs->trans('UserCP').' : ';
|
||||||
|
print $form->select_users('',"userCP",1,"",0,'');
|
||||||
|
print ' <input type="submit" value="'.$langs->trans("addEventToUserCP").'" name="bouton" class="button"/>';
|
||||||
|
|
||||||
|
print '</form><br>';
|
||||||
|
}
|
||||||
|
|
||||||
|
dol_fiche_head();
|
||||||
|
|
||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||||
print '<input type="hidden" name="action" value="update" />';
|
print '<input type="hidden" name="action" value="update" />';
|
||||||
@ -148,27 +169,9 @@ foreach($listUsers as $users)
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
$cp_events = $holiday->fetchEventsCP();
|
dol_fiche_end();
|
||||||
|
|
||||||
if($cp_events == 1) {
|
|
||||||
|
|
||||||
$html = new Form($db);
|
|
||||||
|
|
||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
|
||||||
print '<input type="hidden" name="action" value="add_event" />';
|
|
||||||
|
|
||||||
print '<h3>'.$langs->trans('DefineEventUserCP').'</h3>';
|
|
||||||
print $langs->trans('MotifCP').' : ';
|
|
||||||
print $holiday->selectEventCP();
|
|
||||||
print ' '.$langs->trans('UserCP').' : ';
|
|
||||||
print $html->select_users('',"userCP",1,"",0,'');
|
|
||||||
print ' <input type="submit" value="'.$langs->trans("addEventToUserCP").'" name="bouton" class="button"/>';
|
|
||||||
|
|
||||||
|
|
||||||
print '</form>';
|
|
||||||
}
|
|
||||||
print '</div>';
|
|
||||||
// Fin de page
|
|
||||||
$db->close();
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -25,12 +25,13 @@
|
|||||||
* \remarks Form and file creation of paid holiday.
|
* \remarks Form and file creation of paid holiday.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require('pre.inc.php');
|
require('../main.inc.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT. "/core/class/html.form.class.php");
|
require_once(DOL_DOCUMENT_ROOT. "/core/class/html.form.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT. "/user/class/usergroup.class.php");
|
require_once(DOL_DOCUMENT_ROOT. "/user/class/usergroup.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT. "/core/class/html.formfile.class.php");
|
require_once(DOL_DOCUMENT_ROOT. "/core/class/html.formfile.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT. "/core/class/CMailFile.class.php");
|
require_once(DOL_DOCUMENT_ROOT. "/core/class/CMailFile.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT. "/core/class/html.formmail.class.php");
|
require_once(DOL_DOCUMENT_ROOT. "/core/class/html.formmail.class.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT. "/holiday/common.inc.php");
|
||||||
|
|
||||||
// Get parameters
|
// Get parameters
|
||||||
$myparam = GETPOST("myparam");
|
$myparam = GETPOST("myparam");
|
||||||
@ -61,9 +62,9 @@ if ($action == 'add')
|
|||||||
$date_debut = dol_mktime(0, 0, 0, $_POST['date_debut_month'], $_POST['date_debut_day'], $_POST['date_debut_year']);
|
$date_debut = dol_mktime(0, 0, 0, $_POST['date_debut_month'], $_POST['date_debut_day'], $_POST['date_debut_year']);
|
||||||
$date_fin = dol_mktime(0, 0, 0, $_POST['date_fin_month'], $_POST['date_fin_day'], $_POST['date_fin_year']);
|
$date_fin = dol_mktime(0, 0, 0, $_POST['date_fin_month'], $_POST['date_fin_day'], $_POST['date_fin_year']);
|
||||||
|
|
||||||
$valideur = $_POST['valideur'];
|
$valideur = GETPOST('valideur');
|
||||||
$description = trim($_POST['description']);
|
$description = trim(GETPOST('description'));
|
||||||
$userID = $_POST['userID'];
|
$userID = GETPOST('userID');
|
||||||
|
|
||||||
// Si pas de date de début
|
// Si pas de date de début
|
||||||
if (empty($date_debut))
|
if (empty($date_debut))
|
||||||
@ -108,7 +109,7 @@ if ($action == 'add')
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Si pas de validateur choisi
|
// Si pas de validateur choisi
|
||||||
if($valideur < 1)
|
if ($valideur < 1)
|
||||||
{
|
{
|
||||||
header('Location: fiche.php?action=request&error=Valideur');
|
header('Location: fiche.php?action=request&error=Valideur');
|
||||||
exit;
|
exit;
|
||||||
@ -137,7 +138,7 @@ if ($action == 'add')
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($action == 'update')
|
if ($action == 'update')
|
||||||
{
|
{
|
||||||
|
|
||||||
// Si pas le droit de modifier une demande
|
// Si pas le droit de modifier une demande
|
||||||
@ -163,13 +164,13 @@ if($action == 'update')
|
|||||||
$description = trim($_POST['description']);
|
$description = trim($_POST['description']);
|
||||||
|
|
||||||
// Si pas de date de début
|
// Si pas de date de début
|
||||||
if(empty($_POST['date_debut_'])) {
|
if (empty($_POST['date_debut_'])) {
|
||||||
header('Location: fiche.php?id='.$_POST['holiday_id'].'&action=edit&error=nodatedebut');
|
header('Location: fiche.php?id='.$_POST['holiday_id'].'&action=edit&error=nodatedebut');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si pas de date de fin
|
// Si pas de date de fin
|
||||||
if(empty($_POST['date_fin_'])) {
|
if (empty($_POST['date_fin_'])) {
|
||||||
header('Location: fiche.php?id='.$_POST['holiday_id'].'&action=edit&error=nodatefin');
|
header('Location: fiche.php?id='.$_POST['holiday_id'].'&action=edit&error=nodatefin');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -178,19 +179,19 @@ if($action == 'update')
|
|||||||
$testDateFin = strtotime($date_fin);
|
$testDateFin = strtotime($date_fin);
|
||||||
|
|
||||||
// Si date de début après la date de fin
|
// Si date de début après la date de fin
|
||||||
if($testDateDebut > $testDateFin) {
|
if ($testDateDebut > $testDateFin) {
|
||||||
header('Location: fiche.php?id='.$_POST['holiday_id'].'&action=edit&error=datefin');
|
header('Location: fiche.php?id='.$_POST['holiday_id'].'&action=edit&error=datefin');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si pas de valideur choisi
|
// Si pas de valideur choisi
|
||||||
if($valideur < 1) {
|
if ($valideur < 1) {
|
||||||
header('Location: fiche.php?id='.$_POST['holiday_id'].'&action=edit&error=Valideur');
|
header('Location: fiche.php?id='.$_POST['holiday_id'].'&action=edit&error=Valideur');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si pas de jours ouvrés dans la demande
|
// Si pas de jours ouvrés dans la demande
|
||||||
if($cp->getOpenDays($testDateDebut,$testDateFin) < 1) {
|
if ($cp->getOpenDays($testDateDebut,$testDateFin) < 1) {
|
||||||
header('Location: fiche.php?id='.$_POST['holiday_id'].'&action=edit&error=DureeHoliday');
|
header('Location: fiche.php?id='.$_POST['holiday_id'].'&action=edit&error=DureeHoliday');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -203,10 +204,13 @@ if($action == 'update')
|
|||||||
$verif = $cp->update($user->id);
|
$verif = $cp->update($user->id);
|
||||||
|
|
||||||
// Si pas d'erreur SQL on redirige vers la fiche de la demande
|
// Si pas d'erreur SQL on redirige vers la fiche de la demande
|
||||||
if($verif > 0) {
|
if ($verif > 0)
|
||||||
|
{
|
||||||
header('Location: fiche.php?id='.$_POST['holiday_id']);
|
header('Location: fiche.php?id='.$_POST['holiday_id']);
|
||||||
exit;
|
exit;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Sinon on affiche le formulaire de demande avec le message d'erreur SQL
|
// Sinon on affiche le formulaire de demande avec le message d'erreur SQL
|
||||||
header('Location: fiche.php?id='.$_POST['holiday_id'].'&action=edit&error=SQL_Create&msg='.$cp->error);
|
header('Location: fiche.php?id='.$_POST['holiday_id'].'&action=edit&error=SQL_Create&msg='.$cp->error);
|
||||||
exit;
|
exit;
|
||||||
@ -223,7 +227,6 @@ if ($action == 'confirm_delete' && $_GET['confirm'] == 'yes')
|
|||||||
{
|
{
|
||||||
if($user->rights->holiday->delete)
|
if($user->rights->holiday->delete)
|
||||||
{
|
{
|
||||||
|
|
||||||
$cp = new Holiday($db);
|
$cp = new Holiday($db);
|
||||||
$cp->fetch($_GET['id']);
|
$cp->fetch($_GET['id']);
|
||||||
|
|
||||||
@ -568,17 +571,14 @@ if ($action == 'confirm_cancel' && $_GET['confirm'] == 'yes')
|
|||||||
* View
|
* View
|
||||||
****************************************************/
|
****************************************************/
|
||||||
|
|
||||||
llxHeader($langs->trans('CPTitreMenu'));
|
llxHeader(array(),$langs->trans('CPTitreMenu'));
|
||||||
|
|
||||||
if ($action == 'request')
|
if ($action == 'request')
|
||||||
{
|
{
|
||||||
|
|
||||||
// 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(!$user->rights->holiday->write)
|
||||||
{
|
{
|
||||||
print '<div class="tabBar">';
|
$errors[]=$langs->trans('CantCreateCP');
|
||||||
print $langs->trans('CantCreateCP');
|
|
||||||
print '</div>'."\n";
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -586,39 +586,36 @@ if ($action == 'request')
|
|||||||
print_fiche_titre($langs->trans('MenuAddCP'));
|
print_fiche_titre($langs->trans('MenuAddCP'));
|
||||||
|
|
||||||
// Si il y a une erreur
|
// Si il y a une erreur
|
||||||
if(isset($_GET['error'])) {
|
if (GETPOST('error')) {
|
||||||
|
|
||||||
switch($_GET['error']) {
|
switch(GETPOST('error')) {
|
||||||
case 'datefin' :
|
case 'datefin' :
|
||||||
$msg = $langs->trans('ErrorEndDateCP');
|
$errors[] = $langs->trans('ErrorEndDateCP');
|
||||||
break;
|
break;
|
||||||
case 'SQL_Create' :
|
case 'SQL_Create' :
|
||||||
$msg = $langs->trans('ErrorSQLCreateCP').' <b>'.htmlentities($_GET['msg']).'</b>';
|
$errors[] = $langs->trans('ErrorSQLCreateCP').' <b>'.htmlentities($_GET['msg']).'</b>';
|
||||||
break;
|
break;
|
||||||
case 'CantCreate' :
|
case 'CantCreate' :
|
||||||
$msg = $langs->trans('CantCreateCP');
|
$errors[] = $langs->trans('CantCreateCP');
|
||||||
break;
|
break;
|
||||||
case 'Valideur' :
|
case 'Valideur' :
|
||||||
$msg = $langs->trans('InvalidValidatorCP');
|
$errors[] = $langs->trans('InvalidValidatorCP');
|
||||||
break;
|
break;
|
||||||
case 'nodatedebut' :
|
case 'nodatedebut' :
|
||||||
$msg = $langs->trans('NoDateDebut');
|
$errors[] = $langs->trans('NoDateDebut');
|
||||||
break;
|
break;
|
||||||
case 'nodatedebut' :
|
case 'nodatedebut' :
|
||||||
$msg = $langs->trans('NoDateFin');
|
$errors[] = $langs->trans('NoDateFin');
|
||||||
break;
|
break;
|
||||||
case 'DureeHoliday' :
|
case 'DureeHoliday' :
|
||||||
$msg = $langs->trans('ErrorDureeCP');
|
$errors[] = $langs->trans('ErrorDureeCP');
|
||||||
break;
|
break;
|
||||||
case 'alreadyCP' :
|
case 'alreadyCP' :
|
||||||
$msg = $langs->trans('alreadyCPexist');
|
$errors[] = $langs->trans('alreadyCPexist');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<div class="tabBar">';
|
dol_htmloutput_mesg('',$errors,'error');
|
||||||
print $msg;
|
|
||||||
print '</div>'."\n";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
@ -680,8 +677,8 @@ if ($action == 'request')
|
|||||||
if(!isset($_GET['datep'])) {
|
if(!isset($_GET['datep'])) {
|
||||||
$html->select_date($nextMonth,'date_debut_');
|
$html->select_date($nextMonth,'date_debut_');
|
||||||
} else {
|
} else {
|
||||||
$date = substr($_GET['datep'],0,4)."-".substr($_GET['datep'],4,2)."-".substr($_GET['datep'],6,2);
|
$tmpdate = dol_mktime(0, 0, 0, GETPOST('datepmonth'), GETPOST('datepday'), GETPOST('datepyear'));
|
||||||
$html->select_date($date,'date_debut_');
|
$html->select_date($tmpdate,'date_debut_');
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -692,8 +689,8 @@ if ($action == 'request')
|
|||||||
if(!isset($_GET['datep'])) {
|
if(!isset($_GET['datep'])) {
|
||||||
$html->select_date($nextMonth,'date_fin_');
|
$html->select_date($nextMonth,'date_fin_');
|
||||||
} else {
|
} else {
|
||||||
$date = substr($_GET['datef'],0,4)."-".substr($_GET['datef'],4,2)."-".substr($_GET['datef'],6,2);
|
$tmpdate = dol_mktime(0, 0, 0, GETPOST('datefmonth'), GETPOST('datefday'), GETPOST('datefyear'));
|
||||||
$html->select_date($date,'date_fin_');
|
$html->select_date($tmpdate,'date_fin_');
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -703,10 +700,10 @@ if ($action == 'request')
|
|||||||
$idGroupValid = $cp->getConfCP('userGroup');
|
$idGroupValid = $cp->getConfCP('userGroup');
|
||||||
|
|
||||||
$validator = new UserGroup($db,$idGroupValid);
|
$validator = new UserGroup($db,$idGroupValid);
|
||||||
$valideur = $validator->listUsersForGroup();
|
$valideurarray = $validator->listUsersForGroup();
|
||||||
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$html->select_users('',"valideur",1,"",0,$valideur,'');
|
print $html->select_dolusers($valideur,"valideur",1,"",0,$valideurarray,'');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
@ -758,42 +755,39 @@ elseif(isset($_GET['id']))
|
|||||||
//print_fiche_titre($langs->trans('TitreRequestCP'));
|
//print_fiche_titre($langs->trans('TitreRequestCP'));
|
||||||
|
|
||||||
// Si il y a une erreur
|
// Si il y a une erreur
|
||||||
if(isset($_GET['error'])) {
|
if (GETPOST('error')) {
|
||||||
|
|
||||||
switch($_GET['error']) {
|
switch(GETPOST('error')) {
|
||||||
case 'datefin' :
|
case 'datefin' :
|
||||||
$msg = $langs->trans('ErrorEndDateCP');
|
$errors[] = $langs->trans('ErrorEndDateCP');
|
||||||
break;
|
break;
|
||||||
case 'SQL_Create' :
|
case 'SQL_Create' :
|
||||||
$msg = $langs->trans('ErrorSQLCreateCP').' <b>'.htmlentities($_GET['msg']).'</b>';
|
$errors[] = $langs->trans('ErrorSQLCreateCP').' <b>'.htmlentities($_GET['msg']).'</b>';
|
||||||
break;
|
break;
|
||||||
case 'CantCreate' :
|
case 'CantCreate' :
|
||||||
$msg = $langs->trans('CantCreateCP');
|
$errors[] = $langs->trans('CantCreateCP');
|
||||||
break;
|
break;
|
||||||
case 'Valideur' :
|
case 'Valideur' :
|
||||||
$msg = $langs->trans('InvalidValidatorCP');
|
$errors[] = $langs->trans('InvalidValidatorCP');
|
||||||
break;
|
break;
|
||||||
case 'nodatedebut' :
|
case 'nodatedebut' :
|
||||||
$msg = $langs->trans('NoDateDebut');
|
$errors[] = $langs->trans('NoDateDebut');
|
||||||
break;
|
break;
|
||||||
case 'nodatedebut' :
|
case 'nodatedebut' :
|
||||||
$msg = $langs->trans('NoDateFin');
|
$errors[] = $langs->trans('NoDateFin');
|
||||||
break;
|
break;
|
||||||
case 'DureeHoliday' :
|
case 'DureeHoliday' :
|
||||||
$msg = $langs->trans('ErrorDureeCP');
|
$errors[] = $langs->trans('ErrorDureeCP');
|
||||||
break;
|
break;
|
||||||
case 'NoMotifRefuse' :
|
case 'NoMotifRefuse' :
|
||||||
$msg = $langs->trans('NoMotifRefuseCP');
|
$errors[] = $langs->trans('NoMotifRefuseCP');
|
||||||
break;
|
break;
|
||||||
case 'mail' :
|
case 'mail' :
|
||||||
$msg = $langs->trans('ErrorMailNotSend').'<br /><b>'.$_GET['error_content'].'</b>';
|
$errors[] = $langs->trans('ErrorMailNotSend').'<br /><b>'.$_GET['error_content'].'</b>';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<div class="tabBar">';
|
dol_htmloutput_mesg('',$errors,'error');
|
||||||
print $msg;
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// On vérifie si l'utilisateur à le droit de lire cette demande
|
// On vérifie si l'utilisateur à le droit de lire cette demande
|
||||||
@ -810,7 +804,7 @@ elseif(isset($_GET['id']))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Si envoi en validation
|
// Si envoi en validation
|
||||||
if($_GET['action'] == 'sendToValidate' && $cp->statut == 1 && $userID == $cp->fk_user) {
|
if ($action == 'sendToValidate' && $cp->statut == 1 && $userID == $cp->fk_user) {
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
|
||||||
$ret=$html->form_confirm("fiche.php?id=".$_GET['id'],$langs->trans("TitleToValidCP"),$langs->trans("ConfirmToValidCP"),"confirm_send", '', 0, 1);
|
$ret=$html->form_confirm("fiche.php?id=".$_GET['id'],$langs->trans("TitleToValidCP"),$langs->trans("ConfirmToValidCP"),"confirm_send", '', 0, 1);
|
||||||
@ -818,7 +812,7 @@ elseif(isset($_GET['id']))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Si validation de la demande
|
// Si validation de la demande
|
||||||
if($_GET['action'] == 'valid' && $cp->statut == 2 && $userID == $cp->fk_validator) {
|
if ($action == 'valid' && $cp->statut == 2 && $userID == $cp->fk_validator) {
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
|
||||||
$ret=$html->form_confirm("fiche.php?id=".$_GET['id'],$langs->trans("TitleValidCP"),$langs->trans("ConfirmValidCP"),"confirm_valid", '', 0, 1);
|
$ret=$html->form_confirm("fiche.php?id=".$_GET['id'],$langs->trans("TitleValidCP"),$langs->trans("ConfirmValidCP"),"confirm_valid", '', 0, 1);
|
||||||
@ -826,7 +820,7 @@ elseif(isset($_GET['id']))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Si refus de la demande
|
// Si refus de la demande
|
||||||
if($_GET['action'] == 'refuse' && $cp->statut == 2 && $userID == $cp->fk_validator) {
|
if ($action == 'refuse' && $cp->statut == 2 && $userID == $cp->fk_validator) {
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
|
||||||
$array_input = array(array('type'=>"text",'label'=>"Entrez ci-dessous un motif de refus :",'name'=>"detail_refuse",'size'=>"50",'value'=>""));
|
$array_input = array(array('type'=>"text",'label'=>"Entrez ci-dessous un motif de refus :",'name'=>"detail_refuse",'size'=>"50",'value'=>""));
|
||||||
@ -835,7 +829,7 @@ elseif(isset($_GET['id']))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Si annulation de la demande
|
// Si annulation de la demande
|
||||||
if($_GET['action'] == 'cancel' && $cp->statut == 2 && $userID == $cp->fk_validator) {
|
if ($action == 'cancel' && $cp->statut == 2 && $userID == $cp->fk_validator) {
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
|
||||||
$ret=$html->form_confirm("fiche.php?id=".$_GET['id'],$langs->trans("TitleCancelCP"),$langs->trans("ConfirmCancelCP"),"confirm_cancel", '', 0, 1);
|
$ret=$html->form_confirm("fiche.php?id=".$_GET['id'],$langs->trans("TitleCancelCP"),$langs->trans("ConfirmCancelCP"),"confirm_cancel", '', 0, 1);
|
||||||
@ -870,7 +864,7 @@ elseif(isset($_GET['id']))
|
|||||||
if(!$edit) {
|
if(!$edit) {
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans('DateDebCP').'</td>';
|
print '<td>'.$langs->trans('DateDebCP').'</td>';
|
||||||
print '<td>'.date('d-m-Y', strtotime($cp->date_debut)).'</td>';
|
print '<td>'.dol_print_date($cp->date_debut,'day').'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
} else {
|
} else {
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
@ -884,7 +878,7 @@ elseif(isset($_GET['id']))
|
|||||||
if(!$edit) {
|
if(!$edit) {
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans('DateFinCP').'</td>';
|
print '<td>'.$langs->trans('DateFinCP').'</td>';
|
||||||
print '<td>'.date('d-m-Y', strtotime($cp->date_fin)).'</td>';
|
print '<td>'.dol_print_date($cp->date_fin,'day').'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
} else {
|
} else {
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
|
|||||||
@ -23,15 +23,39 @@
|
|||||||
* \brief List of holiday.
|
* \brief List of holiday.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require('pre.inc.php');
|
require('../main.inc.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT. "/core/class/html.form.class.php");
|
require_once(DOL_DOCUMENT_ROOT. "/core/class/html.form.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT. "/core/class/html.formother.class.php");
|
require_once(DOL_DOCUMENT_ROOT. "/core/class/html.formother.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT. "/user/class/user.class.php");
|
require_once(DOL_DOCUMENT_ROOT. "/user/class/user.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT. "/user/class/usergroup.class.php");
|
require_once(DOL_DOCUMENT_ROOT. "/user/class/usergroup.class.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT. "/holiday/common.inc.php");
|
||||||
|
|
||||||
// Protection if external user
|
// Protection if external user
|
||||||
if ($user->societe_id > 0) accessforbidden();
|
if ($user->societe_id > 0) accessforbidden();
|
||||||
|
|
||||||
|
$sortfield = GETPOST("sortfield");
|
||||||
|
$sortorder = GETPOST("sortorder");
|
||||||
|
$page = GETPOST("page");
|
||||||
|
$page = is_numeric($page) ? $page : 0;
|
||||||
|
$page = $page == -1 ? 0 : $page;
|
||||||
|
|
||||||
|
if (! $sortfield) $sortfield="cp.rowid";
|
||||||
|
if (! $sortorder) $sortorder="DESC";
|
||||||
|
$offset = $conf->liste_limit * $page ;
|
||||||
|
$pageprev = $page - 1;
|
||||||
|
$pagenext = $page + 1;
|
||||||
|
|
||||||
|
$search_ref = GETPOST('search_ref');
|
||||||
|
$month_create = GETPOST('month_create');
|
||||||
|
$year_create = GETPOST('year_create');
|
||||||
|
$month_start = GETPOST('month_start');
|
||||||
|
$year_start = GETPOST('year_start');
|
||||||
|
$month_end = GETPOST('month_end');
|
||||||
|
$year_end = GETPOST('year_end');
|
||||||
|
$search_employe = GETPOST('search_employe');
|
||||||
|
$search_valideur = GETPOST('search_valideur');
|
||||||
|
$search_statut = GETPOST('select_statut');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -45,44 +69,12 @@ if ($user->societe_id > 0) accessforbidden();
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader($langs->trans('CPTitreMenu'));
|
|
||||||
|
|
||||||
/*****************************************
|
|
||||||
* Tri du tableau
|
|
||||||
*****************************************/
|
|
||||||
|
|
||||||
$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
|
|
||||||
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
|
||||||
$page = isset($_GET["page"])? $_GET["page"]:$_POST["page"];
|
|
||||||
$page = is_numeric($page) ? $page : 0;
|
|
||||||
$page = $page == -1 ? 0 : $page;
|
|
||||||
|
|
||||||
if (! $sortfield) $sortfield="cp.rowid";
|
|
||||||
if (! $sortorder) $sortorder="DESC";
|
|
||||||
$offset = $conf->liste_limit * $page ;
|
|
||||||
$pageprev = $page - 1;
|
|
||||||
$pagenext = $page + 1;
|
|
||||||
|
|
||||||
$order = " ORDER BY $sortfield $sortorder " . $db->plimit( $conf->liste_limit + 1 ,$offset);
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************
|
|
||||||
* Filtres de recherche
|
|
||||||
*************************************/
|
|
||||||
|
|
||||||
$max_year = 5;
|
$max_year = 5;
|
||||||
$min_year = 10;
|
$min_year = 10;
|
||||||
|
|
||||||
$search_ref = $_GET['search_ref'];
|
llxHeader(array(),$langs->trans('CPTitreMenu'));
|
||||||
$month_create = $_GET['month_create'];
|
|
||||||
$year_create = $_GET['year_create'];
|
$order = $db->order($sortfield,$sortorder).$db->plimit($conf->liste_limit + 1, $offset);
|
||||||
$month_start = $_GET['month_start'];
|
|
||||||
$year_start = $_GET['year_start'];
|
|
||||||
$month_end = $_GET['month_end'];
|
|
||||||
$year_end = $_GET['year_end'];
|
|
||||||
$search_employe = $_GET['search_employe'];
|
|
||||||
$search_valideur = $_GET['search_valideur'];
|
|
||||||
$search_statut = $_GET['select_statut'];
|
|
||||||
|
|
||||||
// WHERE
|
// WHERE
|
||||||
if(!empty($search_ref)){
|
if(!empty($search_ref)){
|
||||||
@ -219,7 +211,7 @@ print "</tr>\n";
|
|||||||
// FILTRES
|
// FILTRES
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre" align="left" width="50">';
|
print '<td class="liste_titre" align="left" width="50">';
|
||||||
print '<input class="flat" size="4" type="text" name="search_ref" value="'.$_GET['search_ref'].'">';
|
print '<input class="flat" size="4" type="text" name="search_ref" value="'.$search_ref.'">';
|
||||||
|
|
||||||
// DATE CREATE
|
// DATE CREATE
|
||||||
print '<td class="liste_titre" colspan="1" align="center">';
|
print '<td class="liste_titre" colspan="1" align="center">';
|
||||||
|
|||||||
@ -24,10 +24,11 @@
|
|||||||
* \author flegastelois@teclib.com <François Legastelois>
|
* \author flegastelois@teclib.com <François Legastelois>
|
||||||
* \remarks Monthly report of paid holiday.
|
* \remarks Monthly report of paid holiday.
|
||||||
*/
|
*/
|
||||||
require('pre.inc.php');
|
require('../main.inc.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/user/class/user.class.php');
|
require_once(DOL_DOCUMENT_ROOT.'/user/class/user.class.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php');
|
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php');
|
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php');
|
||||||
|
require_once(DOL_DOCUMENT_ROOT. "/holiday/common.inc.php");
|
||||||
|
|
||||||
// Protection if external user
|
// Protection if external user
|
||||||
if ($user->societe_id > 0) accessforbidden();
|
if ($user->societe_id > 0) accessforbidden();
|
||||||
@ -46,7 +47,7 @@ $html = new Form($db);
|
|||||||
$htmlother = new FormOther($db);
|
$htmlother = new FormOther($db);
|
||||||
|
|
||||||
|
|
||||||
llxHeader($langs->trans('CPTitreMenu'));
|
llxHeader(array(),$langs->trans('CPTitreMenu'));
|
||||||
|
|
||||||
$cp = new Holiday($db);
|
$cp = new Holiday($db);
|
||||||
|
|
||||||
|
|||||||
@ -1,112 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
||||||
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
|
|
||||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file pre.inc.php
|
|
||||||
* \ingroup holiday
|
|
||||||
* \brief Load files and menus.
|
|
||||||
*/
|
|
||||||
|
|
||||||
$res=0;
|
|
||||||
if (! $res && file_exists("../main.inc.php")) $res=@include("../main.inc.php"); // For root directory
|
|
||||||
if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php"); // For "custom" directory
|
|
||||||
if (! $res && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php");
|
|
||||||
if (! $res) die("Include of main fails");
|
|
||||||
|
|
||||||
dol_include_once("/holiday/class/holiday.class.php");
|
|
||||||
|
|
||||||
$langs->load("user");
|
|
||||||
$langs->load("other");
|
|
||||||
$langs->load("holiday");
|
|
||||||
|
|
||||||
|
|
||||||
if (empty($conf->holiday->enabled))
|
|
||||||
{
|
|
||||||
llxHeader('',$langs->trans('CPTitreMenu'));
|
|
||||||
print '<div class="tabBar">';
|
|
||||||
print '<span style="color: #FF0000;">'.$langs->trans('NotActiveModCP').'</span>';
|
|
||||||
print '</div>';
|
|
||||||
llxFooter();
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$verifConf.= "SELECT value";
|
|
||||||
$verifConf.= " FROM ".MAIN_DB_PREFIX."holiday_config";
|
|
||||||
$verifConf.= " WHERE name = 'userGroup'";
|
|
||||||
|
|
||||||
$result = $db->query($verifConf);
|
|
||||||
$obj = $db->fetch_object($result);
|
|
||||||
|
|
||||||
if($obj->value == NULL)
|
|
||||||
{
|
|
||||||
llxHeader('',$langs->trans('CPTitreMenu'));
|
|
||||||
print '<div class="tabBar">';
|
|
||||||
print '<span style="color: #FF0000;">'.$langs->trans('NotConfigModCP').'</span>';
|
|
||||||
print '</div>';
|
|
||||||
llxFooter();
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function llxHeader($title)
|
|
||||||
{
|
|
||||||
global $user, $conf, $langs;
|
|
||||||
|
|
||||||
top_htmlhead('',$title);
|
|
||||||
top_menu($head);
|
|
||||||
|
|
||||||
$menu = new Menu();
|
|
||||||
|
|
||||||
$menu->add("/holiday/index.php?mainmenu=holiday",$langs->trans("CPTitreMenu"));
|
|
||||||
if($user->rights->holiday->write) {
|
|
||||||
$menu->add("/holiday/fiche.php?mainmenu=holiday&action=request",$langs->trans("MenuAddCP"),2);
|
|
||||||
}
|
|
||||||
if($user->rights->holiday->define_holiday) {
|
|
||||||
$menu->add("/holiday/define_holiday.php?leftmenu=setup&mainmenu=holiday",$langs->trans("MenuConfCP"),2);
|
|
||||||
}
|
|
||||||
if($user->rights->holiday->view_log) {
|
|
||||||
$menu->add("/holiday/view_log.php?mainmenu=holiday",$langs->trans("MenuLogCP"),2);
|
|
||||||
}
|
|
||||||
if($user->rights->holiday->view_log) {
|
|
||||||
$menu->add("/holiday/month_report.php?mainmenu=holiday",$langs->trans("MenuReportMonth"),2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(in_array('employees', $conf->modules) && $user->rights->employees->module_access)
|
|
||||||
{
|
|
||||||
$menu->add("/employees/index.php",$langs->trans("Menu_Title_EMPLOYEE"));
|
|
||||||
$menu->add("/employees/index.php",$langs->trans("Menu_List_EMPLOYEE"),2);
|
|
||||||
$menu->add("/employees/fiche.php?action=create",$langs->trans("Menu_Add_EMPLOYEE"),2);
|
|
||||||
$menu->add("/employees/hire.php?action=create",$langs->trans("Menu_Add_HIRE"),2);
|
|
||||||
$menu->add("/employees/salary.php?action=create",$langs->trans("Menu_Add_SALARY"),2);
|
|
||||||
$menu->add("/employees/job.php?action=create",$langs->trans("Menu_Add_JOB"),2);
|
|
||||||
$menu->add("/employees/disease.php?action=create",$langs->trans("Menu_Add_DISEASE"),2);
|
|
||||||
$menu->add("/employees/month_report_disease.php",$langs->trans("Menu_Report_Disease"),2);
|
|
||||||
$menu->add("/employees/set_hire_type.php",$langs->trans("Menu_Set_Hire_type"),2);
|
|
||||||
|
|
||||||
if(!isset($_SESSION['employees_passphrase'])){
|
|
||||||
$menu->add("/employees/store_secure.php",$langs->trans("Menu_Store_Secure"),2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
left_menu($menu->liste);
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
@ -23,8 +23,9 @@
|
|||||||
* \ingroup holiday
|
* \ingroup holiday
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require('pre.inc.php');
|
require('../main.inc.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT. "/user/class/user.class.php");
|
require_once(DOL_DOCUMENT_ROOT. "/user/class/user.class.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT. "/holiday/common.inc.php");
|
||||||
|
|
||||||
// Protection if external user
|
// Protection if external user
|
||||||
if ($user->societe_id > 0) accessforbidden();
|
if ($user->societe_id > 0) accessforbidden();
|
||||||
@ -38,7 +39,7 @@ if(!$user->rights->holiday->view_log) accessforbidden();
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader($langs->trans('CPTitreMenu'));
|
llxHeader(array(),$langs->trans('CPTitreMenu'));
|
||||||
|
|
||||||
|
|
||||||
$cp = new Holiday($db);
|
$cp = new Holiday($db);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user