forked from Wavyzz/dolibarr
Merge remote-tracking branch 'origin/3.3' into develop
Conflicts: htdocs/holiday/class/holiday.class.php htdocs/user/fiche.php
This commit is contained in:
@@ -183,7 +183,7 @@ if ($action == 'add_action')
|
|||||||
if (! empty($conf->phenix->enabled) && GETPOST('add_phenix') == 'on') $actioncomm->use_phenix=1;
|
if (! empty($conf->phenix->enabled) && GETPOST('add_phenix') == 'on') $actioncomm->use_phenix=1;
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if ($actioncomm->type_code == 'AC_RDV' && ($datep == '' || $datef == ''))
|
if ($actioncomm->type_code == 'AC_RDV' && ($datep == '' || ($datef == '' && empty($fulldayevent))))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
@@ -559,7 +559,7 @@ if ($action == 'create')
|
|||||||
} else {
|
} else {
|
||||||
print $form->select_company('','socid','',1,1);
|
print $form->select_company('','socid','',1,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|||||||
@@ -32,14 +32,14 @@ class Holiday extends CommonObject
|
|||||||
{
|
{
|
||||||
public $element='holiday';
|
public $element='holiday';
|
||||||
public $table_element='holiday';
|
public $table_element='holiday';
|
||||||
|
|
||||||
var $db;
|
var $db;
|
||||||
var $error;
|
var $error;
|
||||||
var $errors=array();
|
var $errors=array();
|
||||||
|
|
||||||
var $rowid;
|
var $rowid;
|
||||||
var $ref;
|
var $ref;
|
||||||
|
|
||||||
var $fk_user;
|
var $fk_user;
|
||||||
var $date_create='';
|
var $date_create='';
|
||||||
var $description;
|
var $description;
|
||||||
@@ -72,16 +72,24 @@ class Holiday extends CommonObject
|
|||||||
function __construct($db)
|
function __construct($db)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
|
||||||
// Mets à jour les congés payés en début de mois
|
|
||||||
$this->updateSoldeCP();
|
|
||||||
|
|
||||||
// Vérifie le nombre d'utilisateur et mets à jour si besoin
|
|
||||||
$this->verifNbUsers($this->countActiveUsers(),$this->getConfCP('nbUser'));
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* updateSold
|
||||||
|
*
|
||||||
|
* @return int Return 1
|
||||||
|
*/
|
||||||
|
function updateSold()
|
||||||
|
{
|
||||||
|
// Mets à jour les congés payés en début de mois
|
||||||
|
$this->updateSoldeCP();
|
||||||
|
|
||||||
|
// Vérifie le nombre d'utilisateur et mets à jour si besoin
|
||||||
|
$this->verifNbUsers($this->countActiveUsers(),$this->getConfCP('nbUser'));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
*
|
*
|
||||||
@@ -358,10 +366,10 @@ class Holiday extends CommonObject
|
|||||||
|
|
||||||
$sql.= " uu.name as user_lastname,";
|
$sql.= " uu.name as user_lastname,";
|
||||||
$sql.= " uu.firstname as user_firstname,";
|
$sql.= " uu.firstname as user_firstname,";
|
||||||
|
|
||||||
$sql.= " ua.name as validator_lastname,";
|
$sql.= " ua.name as validator_lastname,";
|
||||||
$sql.= " ua.firstname as validator_firstname";
|
$sql.= " ua.firstname as validator_firstname";
|
||||||
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp, ".MAIN_DB_PREFIX."user as uu, ".MAIN_DB_PREFIX."user as ua";
|
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp, ".MAIN_DB_PREFIX."user as uu, ".MAIN_DB_PREFIX."user as ua";
|
||||||
$sql.= " WHERE cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid "; // Hack pour la recherche sur le tableau
|
$sql.= " WHERE cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid "; // Hack pour la recherche sur le tableau
|
||||||
|
|
||||||
@@ -415,10 +423,10 @@ class Holiday extends CommonObject
|
|||||||
|
|
||||||
$tab_result[$i]['user_firstname'] = $obj->user_firstname;
|
$tab_result[$i]['user_firstname'] = $obj->user_firstname;
|
||||||
$tab_result[$i]['user_lastname'] = $obj->user_lastname;
|
$tab_result[$i]['user_lastname'] = $obj->user_lastname;
|
||||||
|
|
||||||
$tab_result[$i]['validator_firstname'] = $obj->validator_firstname;
|
$tab_result[$i]['validator_firstname'] = $obj->validator_firstname;
|
||||||
$tab_result[$i]['validator_lastname'] = $obj->validator_lastname;
|
$tab_result[$i]['validator_lastname'] = $obj->validator_lastname;
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
// Retourne 1 et ajoute le tableau à la variable
|
// Retourne 1 et ajoute le tableau à la variable
|
||||||
@@ -601,13 +609,13 @@ class Holiday extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->fetchByUser($fk_user,'','');
|
$this->fetchByUser($fk_user,'','');
|
||||||
|
|
||||||
foreach($this->holiday as $infos_CP)
|
foreach($this->holiday as $infos_CP)
|
||||||
{
|
{
|
||||||
if ($infos_CP['statut'] == 4) continue; // ignore not validated holidays
|
if ($infos_CP['statut'] == 4) continue; // ignore not validated holidays
|
||||||
if ($infos_CP['statut'] == 5) continue; // ignore not validated holidays
|
if ($infos_CP['statut'] == 5) continue; // ignore not validated holidays
|
||||||
|
|
||||||
// TODO Also use halfday for the check
|
// TODO Also use halfday for the check
|
||||||
if ($dateDebut >= $infos_CP['date_debut'] && $dateDebut <= $infos_CP['date_fin'] || $dateFin <= $infos_CP['date_fin'] && $dateFin >= $infos_CP['date_debut'])
|
if ($dateDebut >= $infos_CP['date_debut'] && $dateDebut <= $infos_CP['date_fin'] || $dateFin <= $infos_CP['date_fin'] && $dateFin >= $infos_CP['date_debut'])
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -627,23 +635,24 @@ class Holiday extends CommonObject
|
|||||||
function getNomUrl($withpicto=0)
|
function getNomUrl($withpicto=0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/holiday/fiche.php?id='.$this->id.'">';
|
$lien = '<a href="'.DOL_URL_ROOT.'/holiday/fiche.php?id='.$this->id.'">';
|
||||||
$lienfin='</a>';
|
$lienfin='</a>';
|
||||||
|
|
||||||
$picto='holiday';
|
$picto='holiday';
|
||||||
|
|
||||||
$label=$langs->trans("Show").': '.$this->ref;
|
$label=$langs->trans("Show").': '.$this->ref;
|
||||||
|
|
||||||
if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin);
|
if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin);
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||||
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
|
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
|
||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the label status
|
* Returns the label status
|
||||||
*
|
*
|
||||||
@@ -654,7 +663,7 @@ class Holiday extends CommonObject
|
|||||||
{
|
{
|
||||||
return $this->LibStatut($this->statut, $mode, $this->date_debut);
|
return $this->LibStatut($this->statut, $mode, $this->date_debut);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the label of a statut
|
* Returns the label of a statut
|
||||||
*
|
*
|
||||||
@@ -678,7 +687,7 @@ class Holiday extends CommonObject
|
|||||||
if ($mode == 2)
|
if ($mode == 2)
|
||||||
{
|
{
|
||||||
$pictoapproved='statut6';
|
$pictoapproved='statut6';
|
||||||
if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
|
if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
|
||||||
if ($statut == 1) return img_picto($langs->trans('DraftCP'),'statut0').' '.$langs->trans('DraftCP'); // Draft
|
if ($statut == 1) return img_picto($langs->trans('DraftCP'),'statut0').' '.$langs->trans('DraftCP'); // Draft
|
||||||
if ($statut == 2) return img_picto($langs->trans('ToValidateCP'),'statut1').' '.$langs->trans('ToValidateCP'); // Waiting approval
|
if ($statut == 2) return img_picto($langs->trans('ToValidateCP'),'statut1').' '.$langs->trans('ToValidateCP'); // Waiting approval
|
||||||
if ($statut == 3) return img_picto($langs->trans('ValidateCP'),$pictoapproved).' '.$langs->trans('ValidateCP');
|
if ($statut == 3) return img_picto($langs->trans('ValidateCP'),$pictoapproved).' '.$langs->trans('ValidateCP');
|
||||||
@@ -688,18 +697,18 @@ class Holiday extends CommonObject
|
|||||||
if ($mode == 5)
|
if ($mode == 5)
|
||||||
{
|
{
|
||||||
$pictoapproved='statut6';
|
$pictoapproved='statut6';
|
||||||
if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
|
if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
|
||||||
if ($statut == 1) return $langs->trans('DraftCP').' '.img_picto($langs->trans('DraftCP'),'statut0'); // Draft
|
if ($statut == 1) return $langs->trans('DraftCP').' '.img_picto($langs->trans('DraftCP'),'statut0'); // Draft
|
||||||
if ($statut == 2) return $langs->trans('ToValidateCP').' '.img_picto($langs->trans('ToValidateCP'),'statut1'); // Waiting approval
|
if ($statut == 2) return $langs->trans('ToValidateCP').' '.img_picto($langs->trans('ToValidateCP'),'statut1'); // Waiting approval
|
||||||
if ($statut == 3) return $langs->trans('ValidateCP').' '.img_picto($langs->trans('ValidateCP'),$pictoapproved);
|
if ($statut == 3) return $langs->trans('ValidateCP').' '.img_picto($langs->trans('ValidateCP'),$pictoapproved);
|
||||||
if ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'),'statut5');
|
if ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'),'statut5');
|
||||||
if ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'),'statut5');
|
if ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'),'statut5');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $statut;
|
return $statut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Affiche un select HTML des statuts de congés payés
|
* Affiche un select HTML des statuts de congés payés
|
||||||
*
|
*
|
||||||
@@ -857,19 +866,21 @@ class Holiday extends CommonObject
|
|||||||
{
|
{
|
||||||
// Si mise à jour pour tout le monde en début de mois
|
// Si mise à jour pour tout le monde en début de mois
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
|
|
||||||
// Mois actuel
|
// Mois actuel
|
||||||
$month = date('m',$now);
|
$month = date('m',$now);
|
||||||
$lastUpdate = $this->getConfCP('lastUpdate');
|
$lastUpdate = $this->getConfCP('lastUpdate');
|
||||||
$monthLastUpdate = date('m', $lastUpdate);
|
$monthLastUpdate = $lastUpdate[4].$lastUpdate[5];
|
||||||
|
//print 'month: '.$month.' '.$lastUpdate.' '.$monthLastUpdate;
|
||||||
|
|
||||||
// Si la date du mois n'est pas la même que celle sauvegardée, on met à jour le timestamp
|
// Si la date du mois n'est pas la même que celle sauvegardée, on met à jour le timestamp
|
||||||
if ($month != $monthLastUpdate)
|
if ($month != $monthLastUpdate)
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."holiday_config SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."holiday_config SET";
|
||||||
$sql.= " value = '".$this->db->idate($now)."'";
|
$sql.= " value = '".dol_print_date($now,'%Y%m%d%H%M%S')."'";
|
||||||
$sql.= " WHERE name = 'lastUpdate'";
|
$sql.= " WHERE name = 'lastUpdate'";
|
||||||
|
|
||||||
|
dol_syslog(get_class($this).'::updateSoldeCP sql='.$sql);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
// On ajoute x jours à chaque utilisateurs
|
// On ajoute x jours à chaque utilisateurs
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ $sql.= " WHERE name = 'userGroup'";
|
|||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
|
|
||||||
if ($obj->value == null)
|
if ($obj->value == null || $obj->value < 0)
|
||||||
{
|
{
|
||||||
llxHeader('',$langs->trans('CPTitreMenu'));
|
llxHeader('',$langs->trans('CPTitreMenu'));
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,9 @@ $search_statut = GETPOST('select_statut');
|
|||||||
$holiday = new Holiday($db);
|
$holiday = new Holiday($db);
|
||||||
$holidaystatic=new Holiday($db);
|
$holidaystatic=new Holiday($db);
|
||||||
|
|
||||||
|
// Update sold
|
||||||
|
$holiday->updateSold();
|
||||||
|
|
||||||
$max_year = 5;
|
$max_year = 5;
|
||||||
$min_year = 10;
|
$min_year = 10;
|
||||||
$filter='';
|
$filter='';
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ CountryDM=Dominica
|
|||||||
CountryDO=República Dominicana
|
CountryDO=República Dominicana
|
||||||
CountryEC=Ecuador
|
CountryEC=Ecuador
|
||||||
CountryEG=Egipto
|
CountryEG=Egipto
|
||||||
CountrySV=Salvador
|
CountrySV=El Salvador
|
||||||
CountryGQ=Guinea Ecuatorial
|
CountryGQ=Guinea Ecuatorial
|
||||||
CountryER=Eritrea
|
CountryER=Eritrea
|
||||||
CountryEE=Estonia
|
CountryEE=Estonia
|
||||||
|
|||||||
@@ -324,9 +324,7 @@ if ($action == 'update' && ! $_POST["cancel"])
|
|||||||
$object->firstname = GETPOST("prenom");
|
$object->firstname = GETPOST("prenom");
|
||||||
$object->login = GETPOST("login");
|
$object->login = GETPOST("login");
|
||||||
$object->pass = GETPOST("password");
|
$object->pass = GETPOST("password");
|
||||||
if($user->admin == 1) { // A user can only be set admin by an admin
|
$object->admin = empty($user->admin)?0:GETPOST("admin"); // A user can only be set admin by an admin
|
||||||
$object->admin = GETPOST("admin");
|
|
||||||
}
|
|
||||||
$object->office_phone=GETPOST("office_phone");
|
$object->office_phone=GETPOST("office_phone");
|
||||||
$object->office_fax = GETPOST("office_fax");
|
$object->office_fax = GETPOST("office_fax");
|
||||||
$object->user_mobile= GETPOST("user_mobile");
|
$object->user_mobile= GETPOST("user_mobile");
|
||||||
|
|||||||
Reference in New Issue
Block a user