Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Commit

Permalink
affichage du solde d'heure. fix #392 (#394)
Browse files Browse the repository at this point in the history
* solde des heures dans le tableau récapitulatif de l'employé

* un peu de sécu dans un code de brute :o

* solde employé pour admin

* correction revue de revue :)
  • Loading branch information
wouldsmina authored Apr 19, 2017
1 parent 4bc5ce3 commit 74f07fa
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
20 changes: 19 additions & 1 deletion App/ProtoControllers/Utilisateur.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,32 @@ public static function getGroupesId($user)
public static function getSoldeconge($login, $typeId)
{
$sql = \includes\SQL::singleton();
$req = 'SELECT su_solde FROM conges_solde_user WHERE su_login = \''.$login.'\'
$req = 'SELECT su_solde FROM conges_solde_user WHERE su_login = \'' . \includes\SQL::quote($login) . '\'
AND su_abs_id ='. (int) $typeId;
$query = $sql->query($req);
$solde = $query->fetch_array()[0];

return $solde;
}

/**
* Retourne le solde d'heure au format timestamp d'un utilisateur
*
* @param string $login
* @param int $typeId
*
* @return int $timestamp
*/
public static function getSoldeHeure($login)
{
$sql = \includes\SQL::singleton();
$req = 'SELECT u_heure_solde FROM conges_users WHERE u_login = \'' . \includes\SQL::quote($login) . '\'';
$query = $sql->query($req);
$timestamp = $query->fetch_array()[0];

return $timestamp;
}

/**
* Vérifie si l'utilisateur a des sorties en cours
*
Expand Down
11 changes: 10 additions & 1 deletion admin/Fonctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1341,9 +1341,14 @@ public static function userModule($session)
foreach ($tab_type_conges_exceptionnels as $id_type_cong => $libelle) {
$childTable .= '<th>' . _('divers_solde') . ' ' . $libelle . '</th>';
}

if($_SESSION['config']['gestion_heures']){
$childTable .= '<th>' . _('divers_solde') . ' ' . _('heures') . '</th>';
}

$childTable .= '<th></th>';
$childTable .= '<th></th>';
if($_SESSION['config']['admin_change_passwd']) {
if($_SESSION['config']['admin_change_passwd'] && ($_SESSION['config']['how_to_connect_user'] == "dbconges")) {
$childTable .= '<th></th>';
}
$childTable .= '</tr>';
Expand Down Expand Up @@ -1416,6 +1421,10 @@ public static function userModule($session)
}
}

if($_SESSION['config']['gestion_heures']){
$childTable .= '<td>' . \App\Helpers\Formatter::timestamp2Duree($tab_current_infos['solde_heure']) . '</td>';
}

$childTable .= '<td>' . $admin_modif_user . '</td>';
$childTable .= '<td>' . $admin_suppr_user . '</td>';
if(($_SESSION['config']['admin_change_passwd']) && ($_SESSION['config']['how_to_connect_user'] == "dbconges")) {
Expand Down
11 changes: 10 additions & 1 deletion fonctions_conges.php
Original file line number Diff line number Diff line change
Expand Up @@ -1841,7 +1841,9 @@ function affiche_tableau_bilan_conges_user($login)

$return .= '<table class="table table-hover table-responsive table-condensed table-bordered">';
$return .= '<thead>';
$return .= '<tr><td></td><td colspan="' . (count($tab_cong_user) * 2 ) . '">SOLDES</td></tr>';
$colspan = count($tab_cong_user) * 2 + 1 ;
$colspan = $_SESSION['config']['gestion_heures'] ? $colspan + 1 : $colspan;
$return .= '<tr><td></td><td colspan="' . $colspan . '">SOLDES</td></tr>';
$return .= '<tr>';
$return .= '<th class="titre">'. _('divers_quotite') .'</th>';

Expand All @@ -1852,6 +1854,9 @@ function affiche_tableau_bilan_conges_user($login)
$return .= '<th class="annuel">' . $id . ' / ' . _('divers_an_maj') . '</th><th class="solde">' . $id . '</th>';
}
}
if($_SESSION['config']['gestion_heures']){
$return .= '<th class="solde">' . _('heure') . '</th>';
}
$return .= '</tr>';
$return .= '</thead>';
$return .= '<tbody>';
Expand All @@ -1864,6 +1869,10 @@ function affiche_tableau_bilan_conges_user($login)
$return .= '<td class="annuel">' . $val['nb_an'] . '</td><td class="solde">' . $val['solde'] . ($val['reliquat'] > 0 ? ' (' . _('dont_reliquat') . ' ' . $val['reliquat'] . ')' : '') . '</td>';
}
}
if($_SESSION['config']['gestion_heures']){
$timestampSolde = \App\ProtoControllers\Utilisateur::getSoldeHeure($login);
$return .= '<td class="solde">'. \App\Helpers\Formatter::timestamp2Duree($timestampSolde) .'</td>';
}
$return .= '</tr>';
$return .= '</tbody>';
$return .= '</table>';
Expand Down

0 comments on commit 74f07fa

Please sign in to comment.