NEW Can upload files on leave requests. Use more standard permissions.
This commit is contained in:
parent
e02915cf8d
commit
b6efa5ed11
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
|
||||
* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012-2014 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
@ -109,15 +109,22 @@ if (! empty($conf->holiday->enabled))
|
||||
{
|
||||
$user_id = $user->id;
|
||||
|
||||
$nbaquis=$holiday->getCPforUser($user_id);
|
||||
$nbdeduced=$holiday->getConfCP('nbHolidayDeducted');
|
||||
$nb_holiday = $nbaquis / $nbdeduced;
|
||||
|
||||
print '<table class="noborder nohover" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Holidays").'</td></tr>';
|
||||
print "<tr ".$bc[0].">";
|
||||
print '<td colspan="3">';
|
||||
print $langs->trans('SoldeCPUser',round($nb_holiday,2)).($nbdeduced != 1 ? ' ('.$nbaquis.' / '.$nbdeduced.')' : '');
|
||||
|
||||
$out='';
|
||||
$typeleaves=$holiday->getTypes(1,1);
|
||||
foreach($typeleaves as $key => $val)
|
||||
{
|
||||
$nb_type = $holiday->getCPforUser($user->id, $val['rowid']);
|
||||
$nb_holiday += $nb_type;
|
||||
$out .= ' - '.$val['label'].': <strong>'.($nb_type?price2num($nb_type):0).'</strong><br>';
|
||||
}
|
||||
print $langs->trans('SoldeCPUser', round($nb_holiday,5)).'<br>';
|
||||
print $out;
|
||||
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</table><br>';
|
||||
|
||||
@ -866,14 +866,26 @@ class FormFile
|
||||
if (image_format_supported($file['name']) > 0)
|
||||
{
|
||||
$permtoedit=0;
|
||||
if ($user->rights->produit->creer && $object->type == Product::TYPE_PRODUCT) $permtoedit=1;
|
||||
if ($user->rights->service->creer && $object->type == Product::TYPE_SERVICE) $permtoedit=1;
|
||||
$newmodulepart=$modulepart;
|
||||
if ($modulepart == 'product' || $modulepart == 'produit' || $modulepart == 'service')
|
||||
{
|
||||
if ($user->rights->produit->creer && $object->type == Product::TYPE_PRODUCT) $permtoedit=1;
|
||||
if ($user->rights->service->creer && $object->type == Product::TYPE_SERVICE) $permtoedit=1;
|
||||
$newmodulepart='produit|service';
|
||||
}
|
||||
/* TODO Not yet working
|
||||
if ($modulepart == 'holiday')
|
||||
{
|
||||
if ($user->rights->holiday->write_all) $permtoedit=1;
|
||||
}
|
||||
*/
|
||||
|
||||
if (empty($conf->global->MAIN_UPLOAD_DOC)) $permtoedit=0;
|
||||
|
||||
if ($permtoedit)
|
||||
{
|
||||
// Link to resize
|
||||
print '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?modulepart='.urlencode('produit|service').'&id='.$object->id.'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"),DOL_URL_ROOT.'/theme/common/transform-crop-and-resize','',1).'</a> ';
|
||||
print '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?modulepart='.urlencode($newmodulepart).'&id='.$object->id.'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"),DOL_URL_ROOT.'/theme/common/transform-crop-and-resize','',1).'</a> ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3761,7 +3761,7 @@ function get_exdir($num,$level,$alpha,$withoutslash,$object,$modulepart)
|
||||
// TODO if object is null, load it from id and modulepart.
|
||||
|
||||
|
||||
if (! empty($level) && in_array($modulepart, array('cheque','user','category','shipment', 'member','don','donation','supplier_invoice','invoice_supplier')))
|
||||
if (! empty($level) && in_array($modulepart, array('cheque','user','category','holiday','shipment', 'member','don','donation','supplier_invoice','invoice_supplier')))
|
||||
{
|
||||
// This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided
|
||||
if (empty($alpha)) $num = preg_replace('/([^0-9])/i','',$num);
|
||||
@ -4313,17 +4313,16 @@ function dolGetFirstLastname($firstname,$lastname,$nameorder=-1)
|
||||
/**
|
||||
* Set event message in dol_events session object. Will be output by calling dol_htmloutput_events.
|
||||
* Note: Calling dol_htmloutput_events is done into pages by standard llxFooter() function.
|
||||
* Note: Prefer to use setEventMessages instead.
|
||||
*
|
||||
* @param mixed $mesgs Message string or array
|
||||
* @param string $style Which style to use ('mesgs' by default, 'warnings', 'errors')
|
||||
* @return void
|
||||
* @see dol_htmloutput_events
|
||||
* @deprecated Use setEventMessages instead
|
||||
*/
|
||||
function setEventMessage($mesgs, $style='mesgs')
|
||||
{
|
||||
dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
|
||||
|
||||
//dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); This is not deprecated, it is used by setEventMessages function
|
||||
if (! is_array($mesgs)) // If mesgs is a string
|
||||
{
|
||||
if ($mesgs) $_SESSION['dol_events'][$style][] = $mesgs;
|
||||
|
||||
@ -34,11 +34,16 @@ function holiday_prepare_head($object)
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT . '/holiday/card.php?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/holiday/card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/holiday/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Document');
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
|
||||
@ -1217,16 +1217,17 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
*/
|
||||
if ($mainmenu == 'hrm')
|
||||
{
|
||||
// Holiday module
|
||||
// Leave/Holiday/Vacation module
|
||||
if (! empty($conf->holiday->enabled))
|
||||
{
|
||||
$langs->load("holiday");
|
||||
|
||||
$newmenu->add("/holiday/index.php?&leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->write, '', $mainmenu, 'hrm');
|
||||
$newmenu->add("/holiday/index.php?&leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'hrm');
|
||||
$newmenu->add("/holiday/card.php?&action=request", $langs->trans("MenuAddCP"), 1,$user->rights->holiday->write);
|
||||
$newmenu->add("/holiday/index.php?&leftmenu=hrm", $langs->trans("List"), 1,$user->rights->holiday->read);
|
||||
$newmenu->add("/holiday/define_holiday.php?&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->define_holiday);
|
||||
$newmenu->add("/holiday/view_log.php?&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->view_log);
|
||||
$newmenu->add("/holiday/month_report.php?&action=request", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->month_report);
|
||||
$newmenu->add("/holiday/view_log.php?&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday);
|
||||
$newmenu->add("/holiday/month_report.php?&action=request", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->define_holiday);
|
||||
}
|
||||
|
||||
// Trips and expenses
|
||||
|
||||
@ -134,16 +134,16 @@ class modHoliday extends DolibarrModules
|
||||
$r=0;
|
||||
|
||||
$this->rights[$r][0] = 20001; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Create/modify your own holidays'; // Permission label
|
||||
$this->rights[$r][1] = 'Read your own holidays'; // Permission label
|
||||
$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] = 'read'; // 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++;
|
||||
|
||||
$this->rights[$r][0] = 20002; // Permission id (must not be already used)
|
||||
$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][4] = 'write_all'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||
$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][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)
|
||||
$r++;
|
||||
|
||||
@ -155,23 +155,23 @@ class modHoliday extends DolibarrModules
|
||||
$r++;
|
||||
|
||||
$this->rights[$r][0] = 20004; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Setup holidays of users'; // Permission label
|
||||
$this->rights[$r][1] = 'Read hollidays for everybody'; // Permission label
|
||||
$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] = 'read_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)
|
||||
$r++;
|
||||
|
||||
$this->rights[$r][0] = 20005; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'See logs for holidays requests'; // 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][4] = 'view_log'; // 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)
|
||||
$r++;
|
||||
|
||||
$this->rights[$r][0] = 20006; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Read holidays monthly report'; // Permission label
|
||||
$this->rights[$r][1] = 'Setup holidays of users (setup and update balance)'; // Permission label
|
||||
$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] = '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)
|
||||
$r++;
|
||||
|
||||
|
||||
@ -37,7 +37,6 @@
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
|
||||
$langs->load("products");
|
||||
$langs->load("other");
|
||||
@ -52,12 +51,19 @@ $cancel=GETPOST("cancel");
|
||||
// Security check
|
||||
if (empty($modulepart)) accessforbidden('Bad value for modulepart');
|
||||
$accessallowed=0;
|
||||
if ($modulepart=='produit|service')
|
||||
if ($modulepart == 'produit' || $modulepart == 'product' || $modulepart == 'service' || $modulepart == 'produit|service')
|
||||
{
|
||||
$result=restrictedArea($user,'produit|service',$id,'product&product');
|
||||
if ($modulepart=='produit|service' && (! $user->rights->produit->lire && ! $user->rights->service->lire)) accessforbidden();
|
||||
$accessallowed=1;
|
||||
}
|
||||
elseif ($modulepart == 'holiday')
|
||||
{
|
||||
$result=restrictedArea($user,'holiday',$id,'holiday');
|
||||
if ($modulepart=='holiday' && (! $user->rights->holiday->read)) accessforbidden();
|
||||
$accessallowed=1;
|
||||
}
|
||||
|
||||
|
||||
// Security:
|
||||
// Limit access if permissions are wrong
|
||||
@ -66,15 +72,32 @@ if (! $accessallowed)
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$object = new Product($db);
|
||||
if ($id > 0)
|
||||
// Define dir according to modulepart
|
||||
if ($modulepart == 'produit' || $modulepart == 'product' || $modulepart == 'service' || $modulepart == 'produit|service')
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
if ($result <= 0) dol_print_error($db,'Failed to load object');
|
||||
$dir=$conf->product->multidir_output[$object->entity]; // By default
|
||||
if ($object->type == Product::TYPE_PRODUCT) $dir=$conf->product->multidir_output[$object->entity];
|
||||
if ($object->type == Product::TYPE_SERVICE) $dir=$conf->service->multidir_output[$object->entity];
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
$object = new Product($db);
|
||||
if ($id > 0)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
if ($result <= 0) dol_print_error($db,'Failed to load object');
|
||||
$dir=$conf->product->multidir_output[$object->entity]; // By default
|
||||
if ($object->type == Product::TYPE_PRODUCT) $dir=$conf->product->multidir_output[$object->entity];
|
||||
if ($object->type == Product::TYPE_SERVICE) $dir=$conf->service->multidir_output[$object->entity];
|
||||
}
|
||||
}
|
||||
elseif ($modulepart == 'holiday')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
|
||||
$object = new Holiday($db);
|
||||
if ($id > 0)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
if ($result <= 0) dol_print_error($db,'Failed to load object');
|
||||
$dir=$conf->holiday->dir_output; // By default
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012-2103 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2012-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
|
||||
@ -1088,6 +1088,7 @@ else
|
||||
print '<td><textarea name="description" class="flat" rows="'.ROWS_3.'" cols="70">'.$cp->description.'</textarea></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</tbody>';
|
||||
print '</table>'."\n";
|
||||
|
||||
|
||||
@ -85,18 +85,30 @@ class Holiday extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* updateSold. Update sold and check table of users for holidays is complete. If not complete.
|
||||
* Update balance of vacations and check table of users for holidays is complete. If not complete.
|
||||
*
|
||||
* @return int Return 1
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function updateSold()
|
||||
function updateBalance()
|
||||
{
|
||||
// Mets à jour les congés payés en début de mois
|
||||
$this->updateSoldeCP();
|
||||
$this->db->begin();
|
||||
|
||||
// Update sold of vocations
|
||||
$result = $this->updateSoldeCP();
|
||||
|
||||
// Vérifie le nombre d'utilisateur et mets à jour si besoin
|
||||
$this->verifNbUsers($this->countActiveUsersWithoutCP(),$this->getConfCP('nbUser'));
|
||||
return 1;
|
||||
if ($result > 0) $result = $this->verifNbUsers($this->countActiveUsersWithoutCP(), $this->getConfCP('nbUser'));
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -901,8 +913,9 @@ class Holiday extends CommonObject
|
||||
// Si mise à jour pour tout le monde en début de mois
|
||||
$now=dol_now();
|
||||
|
||||
// Mois actuel
|
||||
$month = date('m',$now);
|
||||
|
||||
// Get month of last update
|
||||
$lastUpdate = $this->getConfCP('lastUpdate');
|
||||
$monthLastUpdate = $lastUpdate[4].$lastUpdate[5];
|
||||
//print 'month: '.$month.' '.$lastUpdate.' '.$monthLastUpdate;exit;
|
||||
@ -1127,12 +1140,11 @@ class Holiday extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Liste la liste des utilisateurs du module congés
|
||||
* uniquement pour vérifier si il existe de nouveau utilisateur
|
||||
* Get list of Users or list of vacation balance.
|
||||
*
|
||||
* @param boolean $liste si vrai retourne une liste, si faux retourne un array
|
||||
* @param boolean $type si vrai retourne pour Dolibarr, si faux retourne pour CP
|
||||
* @return string retourne un tableau de tout les utilisateurs actifs
|
||||
* @param boolean $liste If true return a string list. If false, return an array
|
||||
* @param boolean $type If true, read Dolibarr user list, if false, return vacation balance list.
|
||||
* @return array|string Return an array
|
||||
*/
|
||||
function fetchUsers($liste=true,$type=true)
|
||||
{
|
||||
@ -1182,9 +1194,10 @@ class Holiday extends CommonObject
|
||||
|
||||
}
|
||||
else
|
||||
{ // Si utilisateur du module Congés Payés
|
||||
$sql = "SELECT u.fk_user";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."holiday_users as u";
|
||||
{
|
||||
// Si utilisateur du module Congés Payés
|
||||
$sql = "SELECT cpu.fk_user, cpu.fk_type, cpu.nb_holidays, u.lastname, u.firstname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."holiday_users as cpu";
|
||||
|
||||
dol_syslog(get_class($this)."::fetchUsers", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
@ -1224,7 +1237,7 @@ class Holiday extends CommonObject
|
||||
else
|
||||
{ // Si faux donc user Congés Payés
|
||||
|
||||
// Si c'est pour les utilisateurs de Dolibarr
|
||||
// List for Dolibarr users
|
||||
if ($type)
|
||||
{
|
||||
$sql = "SELECT u.rowid, u.lastname, u.firstname";
|
||||
@ -1248,7 +1261,10 @@ class Holiday extends CommonObject
|
||||
|
||||
$tab_result[$i]['rowid'] = $obj->rowid;
|
||||
$tab_result[$i]['name'] = $obj->lastname;
|
||||
$tab_result[$i]['lastname'] = $obj->lastname;
|
||||
$tab_result[$i]['firstname'] = $obj->firstname;
|
||||
$tab_result[$i]['type'] = $obj->type;
|
||||
$tab_result[$i]['nb_holidays'] = $obj->nb_holidays;
|
||||
|
||||
$i++;
|
||||
}
|
||||
@ -1261,13 +1277,11 @@ class Holiday extends CommonObject
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Si c'est pour les utilisateurs du module Congés Payés
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$sql = "SELECT DISTINCT cpu.fk_user, u.lastname, u.firstname";
|
||||
// List of vacation balance users
|
||||
$sql = "SELECT cpu.fk_user, cpu.fk_type, cpu.nb_holidays, u.lastname, u.firstname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."holiday_users as cpu,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE cpu.fk_user = u.rowid";
|
||||
@ -1283,13 +1297,16 @@ class Holiday extends CommonObject
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
// Boucles du listage des utilisateurs
|
||||
while($i < $num) {
|
||||
|
||||
while($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$tab_result[$i]['rowid'] = $obj->fk_user;
|
||||
$tab_result[$i]['name'] = $obj->lastname;
|
||||
$tab_result[$i]['lastname'] = $obj->lastname;
|
||||
$tab_result[$i]['firstname'] = $obj->firstname;
|
||||
$tab_result[$i]['type'] = $obj->type;
|
||||
$tab_result[$i]['nb_holidays'] = $obj->nb_holidays;
|
||||
|
||||
$i++;
|
||||
}
|
||||
@ -1344,9 +1361,9 @@ class Holiday extends CommonObject
|
||||
*
|
||||
* @param int $userDolibarrWithoutCP Number of active users in Dolibarr without holidays
|
||||
* @param int $userCP Number of active users into table of holidays
|
||||
* @return void
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function verifNbUsers($userDolibarrWithoutCP,$userCP)
|
||||
function verifNbUsers($userDolibarrWithoutCP, $userCP)
|
||||
{
|
||||
if (empty($userCP)) $userCP=0;
|
||||
dol_syslog(get_class($this).'::verifNbUsers userDolibarr='.$userDolibarrWithoutCP.' userCP='.$userCP);
|
||||
@ -1437,6 +1454,7 @@ class Holiday extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -39,6 +39,8 @@ $action=GETPOST('action');
|
||||
|
||||
$holiday = new Holiday($db);
|
||||
|
||||
$langs->load('users');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -100,7 +102,7 @@ if ($action == 'update' && isset($_POST['update_cp']))
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error) setEventMessage($langs->trans('UpdateConfCPOK'));
|
||||
if (! $error) setEventMessages($langs->trans('UpdateConfCPOK'), '', 'mesgs');
|
||||
}
|
||||
elseif($action == 'add_event')
|
||||
{
|
||||
@ -120,7 +122,7 @@ elseif($action == 'add_event')
|
||||
|
||||
if ($error)
|
||||
{
|
||||
setEventMessage($langs->trans('ErrorAddEventToUserCP'), 'errors');
|
||||
setEventMessages($langs->trans('ErrorAddEventToUserCP'), '', 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -133,7 +135,7 @@ elseif($action == 'add_event')
|
||||
|
||||
$holiday->updateSoldeCP($userCP,$new_holiday);
|
||||
|
||||
setEventMessage($langs->trans('AddEventToUserOkCP'));
|
||||
setEventMessages($langs->trans('AddEventToUserOkCP'), '', 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,13 +147,20 @@ elseif($action == 'add_event')
|
||||
$form = new Form($db);
|
||||
$userstatic=new User($db);
|
||||
|
||||
$langs->load('users');
|
||||
|
||||
llxHeader(array(),$langs->trans('CPTitreMenu'));
|
||||
|
||||
print_fiche_titre($langs->trans('MenuConfCP'), '', 'title_hrm.png');
|
||||
|
||||
$holiday->updateSold(); // Create users into table holiday if they don't exists. TODO Remove if we use field into table user.
|
||||
print '<div class="info">'.$langs->trans('LastUpdateCP').': '."\n";
|
||||
if ($cp->getConfCP('lastUpdate')) print '<strong>'.dol_print_date($db->jdate($cp->getConfCP('lastUpdate')),'dayhour','tzuser').'</strong>';
|
||||
else print $langs->trans('None');
|
||||
print "</div><br>\n";
|
||||
|
||||
$result = $holiday->updateBalance(); // Create users into table holiday if they don't exists. TODO Remove this whif we use field into table user.
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($holiday->error, $holiday->errors, 'errors');
|
||||
}
|
||||
|
||||
$listUsers = $holiday->fetchUsers(false,true);
|
||||
|
||||
|
||||
236
htdocs/holiday/document.php
Normal file
236
htdocs/holiday/document.php
Normal file
@ -0,0 +1,236 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.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 3 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 htdocs/holiday/document.php
|
||||
* \ingroup fichinter
|
||||
* \brief Page des documents joints sur les contrats
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/holiday.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
|
||||
$langs->load("other");
|
||||
$langs->load("holidays");
|
||||
$langs->load("companies");
|
||||
|
||||
$id = GETPOST('id','int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action','alpha');
|
||||
$confirm = GETPOST('confirm','alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'holiday', $id, 'holiday');
|
||||
|
||||
|
||||
// Get parameters
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="name";
|
||||
|
||||
|
||||
$object = new Holiday($db);
|
||||
$object->fetch($id, $ref);
|
||||
|
||||
$upload_dir = $conf->holiday->dir_output.'/'.get_exdir($object->id, 0, 0, 0, $object, 'holiday').dol_sanitizeFileName($object->ref);
|
||||
$modulepart='holiday';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$listhalfday=array('morning'=>$langs->trans("Morning"),"afternoon"=>$langs->trans("Afternoon"));
|
||||
|
||||
llxHeader("","",$langs->trans("InterventionCard"));
|
||||
|
||||
|
||||
if ($object->id)
|
||||
{
|
||||
$valideur = new User($db);
|
||||
$valideur->fetch($object->fk_validator);
|
||||
|
||||
$userRequest = new User($db);
|
||||
$userRequest->fetch($object->fk_user);
|
||||
|
||||
$head=holiday_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'documents',$langs->trans("CPTitreMenu"),0,'holiday');
|
||||
|
||||
|
||||
// Construit liste des fichiers
|
||||
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
$totalsize=0;
|
||||
foreach($filearray as $key => $file)
|
||||
{
|
||||
$totalsize+=$file['size'];
|
||||
}
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback='';
|
||||
|
||||
print '<tr>';
|
||||
print '<td width="25%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td>';
|
||||
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<td>'.$langs->trans("User").'</td>';
|
||||
print '<td>';
|
||||
print $userRequest->getNomUrl(1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Type
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
print '<td>';
|
||||
$typeleaves=$object->getTypes(1,1);
|
||||
print $typeleaves[$object->fk_type]['label'];
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$starthalfday=($object->halfday == -1 || $object->halfday == 2)?'afternoon':'morning';
|
||||
$endhalfday=($object->halfday == 1 || $object->halfday == 2)?'morning':'afternoon';
|
||||
|
||||
if(!$edit)
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')</td>';
|
||||
print '<td>'.dol_print_date($object->date_debut,'day');
|
||||
print ' ';
|
||||
print $langs->trans($listhalfday[$starthalfday]);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')</td>';
|
||||
print '<td>';
|
||||
$form->select_date($object->date_debut,'date_debut_');
|
||||
print ' ';
|
||||
print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday')?GETPOST('starthalfday'):$starthalfday));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if (!$edit)
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')</td>';
|
||||
print '<td>'.dol_print_date($object->date_fin,'day');
|
||||
print ' ';
|
||||
print $langs->trans($listhalfday[$endhalfday]);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')</td>';
|
||||
print '<td>';
|
||||
$form->select_date($object->date_fin,'date_fin_');
|
||||
print ' ';
|
||||
print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday')?GETPOST('endhalfday'):$endhalfday));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('NbUseDaysCP').'</td>';
|
||||
print '<td>'.num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Status
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('StatutCP').'</td>';
|
||||
print '<td>'.$object->getLibStatut(2).'</td>';
|
||||
print '</tr>';
|
||||
if ($object->statut == 5)
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('DetailRefusCP').'</td>';
|
||||
print '<td>'.$object->detail_refuse.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Description
|
||||
if (!$edit)
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('DescCP').'</td>';
|
||||
print '<td>'.nl2br($object->description).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('DescCP').'</td>';
|
||||
print '<td><textarea name="description" class="flat" rows="'.ROWS_3.'" cols="70">'.$object->description.'</textarea></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
$modulepart = 'holiday';
|
||||
$permission = $user->rights->holiday->write;
|
||||
$param = '&id=' . $object->id;
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("ErrorUnknown");
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
|
||||
* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
/* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
|
||||
* Copyright (C) 2013-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* 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
|
||||
@ -96,7 +96,7 @@ $holidaystatic=new Holiday($db);
|
||||
$fuser = new User($db);
|
||||
|
||||
// Update sold
|
||||
$holiday->updateSold();
|
||||
$result = $holiday->updateBalance();
|
||||
|
||||
$max_year = 5;
|
||||
$min_year = 10;
|
||||
@ -187,7 +187,7 @@ if ($id > 0)
|
||||
$user_id = $fuser->id;
|
||||
}
|
||||
// Récupération des congés payés de l'utilisateur ou de tous les users
|
||||
if (!$user->rights->holiday->write_all || $id > 0)
|
||||
if (empty($user->rights->holiday->write_all) || $id > 0)
|
||||
{
|
||||
$holiday_payes = $holiday->fetchByUser($user_id,$order,$filter); // Load array $holiday->holiday
|
||||
}
|
||||
@ -292,13 +292,18 @@ $formother->select_year($year_create,'year_create',1, $min_year, 0);
|
||||
print '</td>';
|
||||
|
||||
// UTILISATEUR
|
||||
if($user->rights->holiday->write_all)
|
||||
if ($user->rights->holiday->write_all)
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print $form->select_dolusers($search_employe,"search_employe",1,"",0,'','',0,32);
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
//print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print $form->select_dolusers($user->id,"search_employe",1,"",1,'','',0,32);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// VALIDEUR
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2007-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 François Legastelois <flegastelois@teclib.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -34,7 +34,7 @@ if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
|
||||
// Si l'utilisateur n'a pas le droit de lire cette page
|
||||
if(!$user->rights->holiday->month_report) accessforbidden();
|
||||
if(!$user->rights->holiday->read_all) accessforbidden();
|
||||
|
||||
|
||||
|
||||
@ -73,18 +73,24 @@ $num = $db->num_rows($result);
|
||||
|
||||
print_fiche_titre($langs->trans('MenuReportMonth'), '', 'title_hrm.png');
|
||||
|
||||
print '<div class="tabBar">';
|
||||
// Get month of last update
|
||||
$lastUpdate = $cp->getConfCP('lastUpdate', 0);
|
||||
$monthLastUpdate = $lastUpdate[4].$lastUpdate[5];
|
||||
$yearLastUpdate = $lastUpdate[0].$lastUpdate[1].$lastUpdate[2].$lastUpdate[3];
|
||||
print $langs->trans("MonthOfLastMonthlyUpdate").': <strong>'.$yearLastUpdate.'-'.$monthLastUpdate.'</strong><br><br>'."\n";
|
||||
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print $langs->trans('Month').': ';
|
||||
print $htmlother->select_month($month, 'month_start').' ';
|
||||
print $htmlother->select_year($year,'year_start',1,10,3);
|
||||
|
||||
print '<input type="submit" value="'.$langs->trans("Refresh").'" class="button" />';
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
$var=true;
|
||||
@ -137,7 +143,11 @@ if($num == '0') {
|
||||
}
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
// Fin de page
|
||||
llxFooter();
|
||||
|
||||
@ -1,124 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
|
||||
*
|
||||
* 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 3 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 define_congespayes.php
|
||||
* \ingroup congespayes
|
||||
* \brief File that defines the balance of paid leave of users.
|
||||
* \version $Id: define_congespayes.php,v 1.00 2011/09/15 11:00:00 dmouillard Exp $
|
||||
* \author dmouillard@teclib.com <Dimitri Mouillard>
|
||||
* \remarks File that defines the balance of paid leave of users.
|
||||
*/
|
||||
|
||||
require('../main.inc.php');
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
|
||||
|
||||
// Protection if external user
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
// If the user does not have perm to read the page
|
||||
if(!$user->rights->holiday->define_holiday) accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader(array(),$langs->trans('CPTitreMenu'));
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans('MenuConfCP'));
|
||||
|
||||
$congespayes = new Holiday($db);
|
||||
$listUsers = $congespayes->fetchUsers(false, true);
|
||||
|
||||
// Si il y a une action de mise à jour
|
||||
if (isset($_POST['action']) && $_POST['action'] == 'update') {
|
||||
|
||||
$fk_type = $_POST['fk_type'];
|
||||
|
||||
foreach ($_POST['nb_conges'] as $user_id => $compteur) {
|
||||
if (!empty($compteur)) {
|
||||
$userValue = str_replace(',', '.', $compteur);
|
||||
$userValue = number_format($userValue, 2, '.', '');
|
||||
} else {
|
||||
$userValue = '0.00';
|
||||
}
|
||||
$congespayes->updateSoldeCP($user_id,$userValue,$fk_type);
|
||||
}
|
||||
|
||||
print '<div class="tabBar">';
|
||||
print $langs->trans('UpdateConfCPOK');
|
||||
print '</div>';
|
||||
|
||||
}
|
||||
|
||||
$var = true;
|
||||
$i = 0;
|
||||
|
||||
foreach($congespayes->getTypes() as $type)
|
||||
{
|
||||
if($type['affect']==1)
|
||||
{
|
||||
print '<div class="tabBar" style="float:left;width:300px;margin-right:10px;">';
|
||||
|
||||
print '<h3>'.$type['label'].'</h3>';
|
||||
|
||||
print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">' . "\n";
|
||||
print '<input type="hidden" name="action" value="update" />';
|
||||
print '<input type="hidden" name="fk_type" value="'.$type['rowid'].'" />';
|
||||
|
||||
print '<table class="noborder" width="100%;">';
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print '<td width="50%">' . $langs->trans('Employee') . '</td>';
|
||||
print '<td width="30%">' . $langs->trans('Counter') . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
foreach ($listUsers as $users) {
|
||||
$var = !$var;
|
||||
print '<tr ' . $bc[$var] . '>';
|
||||
print '<td>' . $users['name'] . ' ' . $users['firstname'] . '</td>';
|
||||
print '<td>';
|
||||
print '<input type="text" value="' .
|
||||
$congespayes->getCPforUser($users['rowid'],$type['rowid']) .
|
||||
'" name="nb_conges[' . $users['rowid'] . ']"
|
||||
size="5" style="text-align: center;"/>';
|
||||
print ' jours</td>' . "\n";
|
||||
print '</tr>';
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
echo "<tr>";
|
||||
print '<td colspan="2"><input type="submit" value="'
|
||||
. $langs->trans("UpdateEventOptionCP") .
|
||||
' ' . $type['label'] .
|
||||
'" name="bouton" class="button" style="margin: 10px;"></td>';
|
||||
echo "</tr>";
|
||||
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Fin de page
|
||||
$db->close();
|
||||
llxFooter();
|
||||
@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
// Si l'utilisateur n'a pas le droit de lire cette page
|
||||
if(!$user->rights->holiday->view_log) accessforbidden();
|
||||
if(!$user->rights->holiday->read_all) accessforbidden();
|
||||
|
||||
$year=GETPOST('year');
|
||||
if (empty($year))
|
||||
@ -41,22 +41,27 @@ if (empty($year))
|
||||
$year=$tmpdate['year'];
|
||||
}
|
||||
|
||||
$langs->load('users');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$langs->load('users');
|
||||
$cp = new Holiday($db);
|
||||
|
||||
llxHeader(array(),$langs->trans('CPTitreMenu').' ('.$langs->trans("Year").' '.$year.')');
|
||||
|
||||
|
||||
$cp = new Holiday($db);
|
||||
// Recent changes are more important than old changes
|
||||
$log_holiday = $cp->fetchLog('ORDER BY cpl.rowid DESC', " AND date_action BETWEEN '".$db->idate(dol_get_first_day($year,1,1))."' AND '".$db->idate(dol_get_last_day($year,12,1))."'"); // Load $cp->logs
|
||||
|
||||
print load_fiche_titre($langs->trans('LogCP'), '<div class="pagination"><ul><li class="pagination"><a href="'.$_SERVER["PHP_SELF"].'?year='.($year-1).'"><</a><li class="pagination"><a href="">'.$langs->trans("Year").' '.$year.'</a></li><li class="pagination"><a href="'.$_SERVER["PHP_SELF"].'?year='.($year+1).'">></a></li></lu></div>', 'title_hrm.png');
|
||||
|
||||
print '<div class="info">'.$langs->trans('LastUpdateCP').': '."\n";
|
||||
if ($cp->getConfCP('lastUpdate')) print '<strong>'.dol_print_date($db->jdate($cp->getConfCP('lastUpdate')),'dayhour','tzuser').'</strong>';
|
||||
else print $langs->trans('None');
|
||||
print "</div><br>\n";
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tbody>';
|
||||
print '<tr class="liste_titre">';
|
||||
@ -107,6 +112,6 @@ print '</tbody>'."\n";
|
||||
print '</table>'."\n";
|
||||
|
||||
|
||||
// Fin de page
|
||||
$db->close();
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -364,7 +364,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
|
||||
{
|
||||
migrate_event_assignement($db,$langs,$conf);
|
||||
}
|
||||
|
||||
|
||||
// Scripts for lat version
|
||||
$afterversionarray=explode('.','3.7.9');
|
||||
$beforeversionarray=explode('.','3.8.9');
|
||||
@ -381,6 +381,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
|
||||
'MAIN_MODULE_ECM',
|
||||
'MAIN_MODULE_FACTURE',
|
||||
'MAIN_MODULE_FOURNISSEUR',
|
||||
'MAIN_MODULE_HOLIDAY',
|
||||
'MAIN_MODULE_OPENSURVEY',
|
||||
'MAIN_MODULE_PAYBOX',
|
||||
'MAIN_MODULE_PRODUIT',
|
||||
@ -3824,7 +3825,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array())
|
||||
if ($moduletoreload == 'MAIN_MODULE_SERVICE') // Permission has changed into 2.7
|
||||
{
|
||||
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Service");
|
||||
|
||||
|
||||
$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modService.class.php';
|
||||
if ($res) {
|
||||
$mod=new modService($db);
|
||||
@ -3835,7 +3836,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array())
|
||||
if ($moduletoreload == 'MAIN_MODULE_COMMANDE') // Permission has changed into 2.9
|
||||
{
|
||||
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Commande");
|
||||
|
||||
|
||||
$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modCommande.class.php';
|
||||
if ($res) {
|
||||
$mod=new modCommande($db);
|
||||
|
||||
@ -3,7 +3,7 @@ HRM=HRM
|
||||
Holidays=Leaves
|
||||
CPTitreMenu=Leaves
|
||||
MenuReportMonth=Monthly statement
|
||||
MenuAddCP=Make a leave request
|
||||
MenuAddCP=New leave request
|
||||
NotActiveModCP=You must enable the module Leaves to view this page.
|
||||
NotConfigModCP=You must configure the module Leaves to view this page. To do this, <a href="./admin/holiday.php?leftmenu=setup&mainmenu=home" style="font-weight: normal; color: red; text-decoration: underline;"> click here </ a>.
|
||||
NoCPforUser=You don't have any available day.
|
||||
@ -93,6 +93,7 @@ ValueOptionCP=Value
|
||||
GroupToValidateCP=Group with the ability to approve leave requests
|
||||
ConfirmConfigCP=Validate the configuration
|
||||
LastUpdateCP=Last automatic update of leaves allocation
|
||||
MonthOfLastMonthlyUpdate=Month of last automatic update of leaves allocation
|
||||
UpdateConfCPOK=Updated successfully.
|
||||
ErrorUpdateConfCP=An error occurred during the update, please try again.
|
||||
AddCPforUsers=Please add the balance of leaves allocation of users by <a href="../define_holiday.php" style="font-weight: normal; color: red; text-decoration: underline;">clicking here</a>.
|
||||
@ -140,12 +141,11 @@ HolidaysRefused=Request denied
|
||||
HolidaysRefusedBody=Your leave request for %s to %s has been denied for the following reason :
|
||||
HolidaysCanceled=Canceled leaved request
|
||||
HolidaysCanceledBody=Your leave request for %s to %s has been canceled.
|
||||
Permission20000=Read you own leave requests
|
||||
Permission20001=Create/modify your leave requests
|
||||
Permission20002=Create/modify leave requests for everybody
|
||||
Permission20001=Read you own leave requests
|
||||
Permission20002=Create/modify your leave requests
|
||||
Permission20003=Delete leave requests
|
||||
Permission20004=Setup users available vacation days
|
||||
Permission20005=Review log of modified leave requests
|
||||
Permission20006=Read leaves monthly report
|
||||
Permission20004=Read leave requests for everybody
|
||||
Permission20005=Create/modify leave requests for everybody
|
||||
Permission20006=Admin leave requests (setup and update balance)
|
||||
NewByMonth=Added per month
|
||||
GoIntoDictionaryHolidayTypes=Go into <strong>Home - Setup - Dictionaries - Type of leaves</strong> to setup the different types of leaves.
|
||||
@ -139,10 +139,3 @@ HolidaysRefused=Accès refusé
|
||||
HolidaysRefusedBody=Votre demande de congés payés %s à %s vient d'être refusée pour le motif suivant :
|
||||
HolidaysCanceled=Abandonner la demande de congés
|
||||
HolidaysCanceledBody=Votre demande de congés du %s au %s a été annulée.
|
||||
Permission20000=Lire ses propres demandes de congés
|
||||
Permission20001=Créer/modifier une demande de congés
|
||||
Permission20002=Créer/modifier les congés pour tout le monde
|
||||
Permission20003=Supprimer la demande de Congés
|
||||
Permission20004=Configuration des jours disponibles
|
||||
Permission20005=Voir l'historique des demandes de congés
|
||||
Permission20006=Accéder au rapport mensuel des congés
|
||||
|
||||
@ -87,10 +87,10 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
if (empty($reshook))
|
||||
{
|
||||
//Delete line if product propal merge is linked to a file
|
||||
if (!empty($conf->global->PRODUIT_PDF_MERGE_PROPAL)) {
|
||||
if (!empty($conf->global->PRODUIT_PDF_MERGE_PROPAL))
|
||||
{
|
||||
if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
{
|
||||
print 'toto';
|
||||
//extract file name
|
||||
$urlfile = GETPOST('urlfile', 'alpha');
|
||||
$filename = basename($urlfile);
|
||||
@ -109,7 +109,8 @@ if (empty($reshook))
|
||||
|
||||
}
|
||||
|
||||
if ($action=='filemerge') {
|
||||
if ($action=='filemerge')
|
||||
{
|
||||
$is_refresh = GETPOST('refresh');
|
||||
if (empty($is_refresh)) {
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user