if ($_SESSION['config']['affiche_date_traitement']) {
     echo "<td>" . _('divers_date_traitement') . "</td>\n";
 }
 echo "</tr>\n";
 echo "</thead>\n";
 echo "<tbody>\n";
 $i = true;
 while ($resultat2 = $ReqLog2->fetch_array()) {
     $sql_p_date_deb = eng_date_to_fr($resultat2["p_date_deb"], $DEBUG);
     $sql_p_demi_jour_deb = $resultat2["p_demi_jour_deb"];
     if ($sql_p_demi_jour_deb == "am") {
         $demi_j_deb = "mat";
     } else {
         $demi_j_deb = "aprm";
     }
     $sql_p_date_fin = eng_date_to_fr($resultat2["p_date_fin"], $DEBUG);
     $sql_p_demi_jour_fin = $resultat2["p_demi_jour_fin"];
     if ($sql_p_demi_jour_fin == "am") {
         $demi_j_fin = "mat";
     } else {
         $demi_j_fin = "aprm";
     }
     $sql_p_nb_jours = $resultat2["p_nb_jours"];
     $sql_p_commentaire = $resultat2["p_commentaire"];
     //$sql_p_type = $resultat2["p_type"];
     $sql_p_type = $resultat2["ta_libelle"];
     $sql_p_etat = $resultat2["p_etat"];
     $sql_p_motif_refus = $resultat2["p_motif_refus"];
     $sql_p_date_demande = $resultat2["p_date_demande"];
     $sql_p_date_traitement = $resultat2["p_date_traitement"];
     echo '<tr class="' . ($i ? 'i' : 'p') . '">';
function edition($user_login, $edit_id, $session, $DEBUG = FALSE)
{
    $tab_info_user = recup_info_user_pour_edition($user_login, $DEBUG);
    // recup infos de l'édition
    $tab_info_edition = recup_info_edition($edit_id, $DEBUG);
    // recup du tableau des types de conges exceptionnels (seulement les conge sexceptionnels )
    $tab_type_cong = recup_tableau_types_conges($DEBUG);
    // recup du tableau des types de conges (seulement les conges)
    if ($_SESSION['config']['gestion_conges_exceptionnels']) {
        $tab_type_conges_exceptionnels = recup_tableau_types_conges_exceptionnels($DEBUG);
    } else {
        $tab_type_conges_exceptionnels = array();
    }
    // recup du tableau de tous les types de conges
    $tab_type_all_cong = recup_tableau_tout_types_abs($DEBUG);
    head_ed($tab_info_user, $tab_info_edition, $tab_type_cong, $tab_type_conges_exceptionnels, $edit_id, $DEBUG);
    if ($DEBUG) {
        echo "tab_info_user :<br>\n";
        print_r($tab_info_user);
        echo "<br><br>\n";
        echo "tab_info_edition :<br>\n";
        print_r($tab_info_edition);
        echo "<br><br>\n";
        echo "tab_type_cong :<br>\n";
        print_r($tab_type_cong);
        echo "<br><br>\n";
        echo "tab_type_conges_exceptionnels :<br>\n";
        print_r($tab_type_conges_exceptionnels);
        echo "<br><br>\n";
        echo "tab_type_all_cong :<br>\n";
        print_r($tab_type_all_cong);
        echo "<br><br>\n";
        echo "numero edition = {$edit_id}<br>\n";
    }
    /*********************************************/
    /* Tableau Historique des Conges et demandes */
    /*********************************************/
    echo "\n<!-- Tableau Historique des Conges et demandes -->\n";
    echo "<tr align=\"center\">\n";
    echo "<td>\n";
    // Récupération des informations
    // on ne recup QUE les periodes de l'edition choisie
    $sql2 = "SELECT p_login, p_date_deb, p_demi_jour_deb, p_date_fin, p_demi_jour_fin, p_nb_jours, p_commentaire, p_type, p_etat, p_date_demande, p_date_traitement ";
    $sql2 = $sql2 . "FROM conges_periode ";
    $sql2 = $sql2 . "WHERE p_edition_id = {$edit_id} ";
    $sql2 = $sql2 . "ORDER BY p_date_deb ASC ";
    $ReqLog2 = SQL::query($sql2);
    $count2 = $ReqLog2->num_rows;
    if ($count2 == 0) {
        echo "<b>" . _('editions_aucun_conges') . "</b><br>\n";
    } else {
        // AFFICHAGE TABLEAU
        if ($_SESSION['config']['affiche_date_traitement']) {
            echo "<table cellpadding=\"2\" class=\"tablo-edit\" width=\"850\">\n";
        } else {
            echo "<table cellpadding=\"2\" class=\"tablo-edit\" width=\"750\">\n";
        }
        /*************************************/
        /* affichage anciens soldes          */
        /*************************************/
        echo "\n<!-- affichage anciens soldes -->\n";
        echo "<tr>\n";
        echo "<td colspan=\"5\">\n";
        $edition_precedente_id = get_id_edition_precedente_user($user_login, $edit_id, $DEBUG);
        if ($edition_precedente_id == 0) {
            echo "<b>" . _('editions_soldes_precedents_inconnus') . " !... ";
        } else {
            $tab_edition_precedente = recup_info_edition($edition_precedente_id, $DEBUG);
            foreach ($tab_type_cong as $id_abs => $libelle) {
                echo _('editions_solde_precedent') . " <b>{$libelle} : " . $tab_edition_precedente['conges'][$id_abs] . "</b><br>\n";
            }
            foreach ($tab_type_conges_exceptionnels as $id_abs => $libelle) {
                echo _('editions_solde_precedent') . " <b>{$libelle} : " . $tab_edition_precedente['conges'][$id_abs] . "</b><br>\n";
            }
        }
        echo "<td>\n";
        echo "</tr>\n";
        /*************************************/
        /* affichage lignes de l'edition     */
        /*************************************/
        echo "\n<!-- affichage lignes de l'edition -->\n";
        echo "<tr>\n";
        echo " <td class=\"titre-edit\">" . _('divers_type_maj_1') . "</td>\n";
        echo " <td class=\"titre-edit\">" . _('divers_etat_maj_1') . "</td>\n";
        echo " <td class=\"titre-edit\">" . _('divers_nb_jours_maj_1') . "</td>\n";
        echo " <td class=\"titre-edit\">" . _('divers_debut_maj_1') . "</td>\n";
        echo " <td class=\"titre-edit\">" . _('divers_fin_maj_1') . "</td>\n";
        echo " <td class=\"titre-edit\">" . _('divers_comment_maj_1') . "</td>\n";
        if ($_SESSION['config']['affiche_date_traitement']) {
            echo "<td class=\"titre-edit\">" . _('divers_date_traitement') . "</td>\n";
        }
        echo "</tr>\n";
        while ($resultat2 = $ReqLog2->fetch_array()) {
            $sql_p_date_deb = eng_date_to_fr($resultat2["p_date_deb"]);
            $sql_p_demi_jour_deb = $resultat2["p_demi_jour_deb"];
            if ($sql_p_demi_jour_deb == "am") {
                $demi_j_deb = _('divers_am_short');
            } else {
                $demi_j_deb = _('divers_pm_short');
            }
            $sql_p_date_fin = eng_date_to_fr($resultat2["p_date_fin"]);
            $sql_p_demi_jour_fin = $resultat2["p_demi_jour_fin"];
            if ($sql_p_demi_jour_fin == "am") {
                $demi_j_fin = _('divers_am_short');
            } else {
                $demi_j_fin = _('divers_pm_short');
            }
            $sql_p_nb_jours = $resultat2["p_nb_jours"];
            $sql_p_commentaire = $resultat2["p_commentaire"];
            $sql_p_type = $resultat2["p_type"];
            $sql_p_etat = $resultat2["p_etat"];
            $sql_p_date_demande = $resultat2["p_date_demande"];
            $sql_p_date_traitement = $resultat2["p_date_traitement"];
            echo "<tr>\n";
            echo "<td class=\"histo-edit\">" . $tab_type_all_cong[$sql_p_type]['libelle'] . "</td>\n";
            echo "<td class=\"histo-edit\">";
            if ($sql_p_etat == "refus") {
                echo _('divers_refuse');
            } elseif ($sql_p_etat == "annul") {
                echo _('divers_annule');
            } else {
                echo "{$sql_p_etat}";
            }
            echo "</td>\n";
            if ($sql_p_etat == "ok") {
                echo "<td class=\"histo-big\"> -{$sql_p_nb_jours}</td>";
            } elseif ($sql_p_etat == "ajout") {
                echo "<td class=\"histo-big\"> +{$sql_p_nb_jours}</td>";
            } else {
                echo "<td> {$sql_p_nb_jours}</td>";
            }
            echo "<td class=\"histo-edit\">{$sql_p_date_deb} _ {$demi_j_deb}</td>";
            echo "<td class=\"histo-edit\">{$sql_p_date_fin} _ {$demi_j_fin}</td>";
            echo "<td class=\"histo-edit\">{$sql_p_commentaire}</td>";
            if ($_SESSION['config']['affiche_date_traitement']) {
                if ($sql_p_date_demande == NULL) {
                    echo "<td class=\"histo-left\">" . _('divers_demande') . " : {$sql_p_date_demande}<br>" . _('divers_traitement') . " : {$sql_p_date_traitement}</td>\n";
                } else {
                    echo "<td class=\"histo-left\">" . _('divers_demande') . " : {$sql_p_date_demande}<br>" . _('divers_traitement') . " : pas traité</td>\n";
                }
            }
            echo "</tr>\n";
        }
        /*************************************/
        /* affichage nouveaux soldes         */
        /*************************************/
        echo "\n<!-- affichage nouveaux soldes -->\n";
        echo "<tr>\n";
        echo "<td colspan=\"5\">\n";
        foreach ($tab_type_cong as $id_abs => $libelle) {
            echo _('editions_nouveau_solde') . " <b>{$libelle} : " . $tab_info_edition['conges'][$id_abs] . "</b><br>\n";
        }
        echo "<td>\n";
        echo "</tr>\n";
        echo "</table>\n\n";
    }
    echo "<br><br>\n";
    echo "</td>\n";
    echo "</tr>\n";
    echo "</table>\n";
    bottom_ed();
}
function recup_editions_user($login, $DEBUG = FALSE)
{
    $tab_ed = array();
    $sql2 = "SELECT ep_id, ep_date, ep_num_for_user ";
    $sql2 = $sql2 . "FROM conges_edition_papier WHERE ep_login = '******' ";
    $sql2 = $sql2 . "ORDER BY ep_num_for_user DESC ";
    $ReqLog2 = SQL::query($sql2);
    if ($ReqLog2->num_rows != 0) {
        while ($resultat2 = $ReqLog2->fetch_array()) {
            $tab = array();
            $sql_id = $resultat2["ep_id"];
            $tab['date'] = eng_date_to_fr($resultat2["ep_date"]);
            $tab['num_for_user'] = $resultat2["ep_num_for_user"];
            // recup du tab des soldes des conges pour cette edition
            $tab['conges'] = recup_solde_conges_of_edition($sql_id, $DEBUG);
            $tab_ed[$sql_id] = $tab;
        }
    }
    return $tab_ed;
}
function affiche_etat_conges_user_for_resp($user_login, $year_affichage, $tri_date, $onglet ,$DEBUG=FALSE)
{
    $PHP_SELF=$_SERVER['PHP_SELF']; ;
    $session=session_id() ;

    // affichage de l'année et des boutons de défilement
    $year_affichage_prec = $year_affichage-1 ;
    $year_affichage_suiv = $year_affichage+1 ;

    echo "<b>";
    echo "<a href=\"$PHP_SELF?session=$session&onglet=traite_user&user_login=$user_login&year_affichage=$year_affichage_prec\"><<</a>";
    echo "&nbsp&nbsp&nbsp  $year_affichage &nbsp&nbsp&nbsp";
    echo "<a href=\"$PHP_SELF?session=$session&onglet=traite_user&user_login=$user_login&year_affichage=$year_affichage_suiv\">>></a>";
    echo "</b><br><br>\n";


    // Récupération des informations de speriodes de conges/absences
    $sql3 = "SELECT p_login, p_date_deb, p_demi_jour_deb, p_date_fin, p_demi_jour_fin, p_nb_jours, p_commentaire, p_type, p_etat, p_motif_refus, p_date_demande, p_date_traitement, p_num FROM conges_periode " .
            "WHERE p_login = '******' " .
            "AND p_etat !='demande' " .
            "AND p_etat !='valid' " .
            "AND (p_date_deb LIKE '$year_affichage%' OR p_date_fin LIKE '$year_affichage%') ";
    if($tri_date=="descendant")
        $sql3=$sql3." ORDER BY p_date_deb DESC ";
    else
        $sql3=$sql3." ORDER BY p_date_deb ASC ";

    $ReqLog3 = SQL::query($sql3);

    $count3=$ReqLog3->num_rows;
    if($count3==0)
    {
        echo "<b>". _('resp_traite_user_aucun_conges') ."</b><br><br>\n";
    }
    else
    {
        // recup dans un tableau de tableau les infos des types de conges et absences
        $tab_types_abs = recup_tableau_tout_types_abs( $DEBUG) ;

        // AFFICHAGE TABLEAU
        echo "<form action=\"$PHP_SELF?session=$session&onglet=traite_user\" method=\"POST\"> \n";
        //echo "<table cellpadding=\"2\" class=\"tablo\" width=\"80%\">\n";
        echo "<table cellpadding=\"2\" class=\"tablo\">\n";
        echo "<thead>";
        echo "<tr align=\"center\">\n";
        echo " <th>\n";
        echo " <a href=\"$PHP_SELF?session=$session&user_login=$user_login&onglet=$onglet&tri_date=descendant\"><img src=\"". TEMPLATE_PATH ."img/1downarrow-16x16.png\" width=\"16\" height=\"16\" border=\"0\" title=\"trier\"></a>\n";
        echo " ". _('divers_debut_maj_1') ." \n";
        echo " <a href=\"$PHP_SELF?session=$session&user_login=$user_login&onglet=$onglet&tri_date=ascendant\"><img src=\"". TEMPLATE_PATH ."img/1uparrow-16x16.png\" width=\"16\" height=\"16\" border=\"0\" title=\"trier\"></a>\n";
        echo " </th>\n";
        echo " <th>". _('divers_fin_maj_1') ."</th>\n";
        echo " <th>". _('divers_nb_jours_pris_maj_1') ."</th>\n";
        echo " <th>". _('divers_comment_maj_1') ."<br><i>". _('resp_traite_user_motif_possible') ."</i></th>\n";
        echo " <th>". _('divers_type_maj_1') ."</th>\n";
        echo " <th>". _('divers_etat_maj_1') ."</th>\n";
        echo " <th>". _('resp_traite_user_annul') ."</th>\n";
        echo " <th>". _('resp_traite_user_motif_annul') ."</th>\n";
        if($_SESSION['config']['affiche_date_traitement'])
        {
            echo "<th>". _('divers_date_traitement') ."</th>\n" ;
        }
        echo "</tr>\n";
        echo "</thead>";
        echo "<tbody>";
        $tab_checkbox=array();
        $i = true;
        while ($resultat3 = $ReqLog3->fetch_array())
        {
                $sql_login=$resultat3["p_login"] ;
                $sql_date_deb=eng_date_to_fr($resultat3["p_date_deb"]) ;
                $sql_demi_jour_deb=$resultat3["p_demi_jour_deb"] ;
                if($sql_demi_jour_deb=="am")
                    $demi_j_deb =  _('divers_am_short') ;
                else
                    $demi_j_deb =  _('divers_pm_short') ;
                $sql_date_fin=eng_date_to_fr($resultat3["p_date_fin"]) ;
                $sql_demi_jour_fin=$resultat3["p_demi_jour_fin"] ;
                if($sql_demi_jour_fin=="am")
                    $demi_j_fin =  _('divers_am_short') ;
                else
                    $demi_j_fin =  _('divers_pm_short') ;
                $sql_nb_jours=affiche_decimal($resultat3["p_nb_jours"]) ;
                $sql_commentaire=$resultat3["p_commentaire"] ;
                $sql_type=$resultat3["p_type"] ;
                $sql_etat=$resultat3["p_etat"] ;
                $sql_motif_refus=$resultat3["p_motif_refus"] ;
                $sql_p_date_demande = $resultat3["p_date_demande"];
                $sql_p_date_traitement = $resultat3["p_date_traitement"];
                $sql_num=$resultat3["p_num"] ;

                if(($sql_etat=="annul") || ($sql_etat=="refus") || ($sql_etat=="ajout"))
                {
                    $casecocher1="";
                    if($sql_etat=="refus")
                    {
                        if($sql_motif_refus=="")
                            $sql_motif_refus =  _('divers_inconnu')  ;
                        //$text_annul="<i>motif du refus : $sql_motif_refus</i>";
                        $text_annul="<i>". _('resp_traite_user_motif') ." : $sql_motif_refus</i>";
                    }
                    elseif($sql_etat=="annul")
                    {
                        if($sql_motif_refus=="")
                            $sql_motif_refus =  _('divers_inconnu')  ;
                        //$text_annul="<i>motif de l'annulation : $sql_motif_refus</i>";
                        $text_annul="<i>". _('resp_traite_user_motif') ." : $sql_motif_refus</i>";
                    }
                    elseif($sql_etat=="ajout")
                    {
                        $text_annul="&nbsp;";
                    }
                }
                else
                {
                    $casecocher1=sprintf("<input type=\"checkbox\" name=\"tab_checkbox_annule[$sql_num]\" value=\"$sql_login--$sql_nb_jours--$sql_type--ANNULE\">");
                    $text_annul="<input type=\"text\" name=\"tab_text_annul[$sql_num]\" size=\"20\" max=\"100\">";
                }

                echo '<tr class="'.($i?'i':'p').'">';
                    echo "<td>$sql_date_deb _ $demi_j_deb</td>\n";
                    echo "<td>$sql_date_fin _ $demi_j_fin</td>\n";
                    echo "<td>$sql_nb_jours</td>\n";
                    echo "<td>$sql_commentaire</td>\n";
                    echo "<td>".$tab_types_abs[$sql_type]['libelle']."</td>\n";
                    echo "<td>";
                    if($sql_etat=="refus")
                        echo  _('divers_refuse') ;
                    elseif($sql_etat=="annul")
                        echo  _('divers_annule') ;
                    else
                        echo "$sql_etat";
                    echo "</td>\n";
                    echo "<td>$casecocher1</td>\n";
                    echo "<td>$text_annul</td>\n";
                    if($_SESSION['config']['affiche_date_traitement'])
                    {
                        if(empty($sql_p_date_traitement))
                            echo "<td class=\"histo-left\">". _('divers_demande') ." : $sql_p_date_demande<br>". _('divers_traitement') ." : pas traité</td>\n" ;
                        else
                            echo "<td class=\"histo-left\">". _('divers_demande') ." : $sql_p_date_demande<br>". _('divers_traitement') ." : $sql_p_date_traitement</td>\n" ;
                    }
                    echo "</tr>\n";
                $i = !$i;
            }
        echo "</tbody>";
        echo "</table>\n\n";

        echo "<input type=\"hidden\" name=\"user_login\" value=\"$user_login\">\n";
        echo "<br><input type=\"submit\" value=\"". _('form_submit') ."\">\n";
        echo " </form> \n";
    }
}
function confirmer($p_num, $onglet, $DEBUG = FALSE)
{
    $PHP_SELF = $_SERVER['PHP_SELF'];
    $session = session_id();
    // Récupération des informations
    $sql1 = 'SELECT p_login, p_date_deb, p_demi_jour_deb, p_date_fin, p_demi_jour_fin, p_nb_jours, p_commentaire, p_etat, p_num FROM conges_periode where p_num = \'' . SQL::quote($p_num) . '\'';
    $ReqLog1 = SQL::query($sql1);
    // AFFICHAGE TABLEAU
    echo '<form NAME="dem_conges" action="' . $PHP_SELF . '" method="POST">';
    echo "<table class=\"table table-responsive\">\n";
    echo '<thead>';
    // affichage première ligne : titres
    echo "<tr>\n";
    echo "<td>" . _('divers_debut_maj_1') . "</td>\n";
    echo "<td>" . _('divers_fin_maj_1') . "</td>\n";
    echo "<td>" . _('divers_nb_jours_maj_1') . "</td>\n";
    echo "<td>" . _('divers_comment_maj_1') . "</td>\n";
    echo "</tr>\n";
    echo '</thead>';
    echo '<tbody>';
    // affichage 2ieme ligne : valeurs actuelles
    echo "<tr>\n";
    while ($resultat1 = $ReqLog1->fetch_array()) {
        $sql_date_deb = eng_date_to_fr($resultat1["p_date_deb"]);
        $sql_demi_jour_deb = $resultat1["p_demi_jour_deb"];
        if ($sql_demi_jour_deb == "am") {
            $demi_j_deb = _('divers_am_short');
        } else {
            $demi_j_deb = _('divers_pm_short');
        }
        $sql_date_fin = eng_date_to_fr($resultat1["p_date_fin"]);
        $sql_demi_jour_fin = $resultat1["p_demi_jour_fin"];
        if ($sql_demi_jour_fin == "am") {
            $demi_j_fin = _('divers_am_short');
        } else {
            $demi_j_fin = _('divers_pm_short');
        }
        $sql_nb_jours = $resultat1["p_nb_jours"];
        $aff_nb_jours = affiche_decimal($sql_nb_jours);
        $sql_commentaire = $resultat1["p_commentaire"];
        $sql_etat = $resultat1["p_etat"];
        echo "<td>{$sql_date_deb} _ {$demi_j_deb}</td><td>{$sql_date_fin} _ {$demi_j_fin}</td><td>{$aff_nb_jours}</td><td>{$sql_commentaire}</td>\n";
        $compte = "";
        if ($_SESSION['config']['rempli_auto_champ_nb_jours_pris']) {
            $compte = 'onChange="compter_jours();return false;"';
        }
        $text_debut = "<input class=\"form-control date\" type=\"text\" name=\"new_debut\" size=\"10\" maxlength=\"30\" value=\"" . revert_date($sql_date_deb) . "\">";
        if ($sql_demi_jour_deb == "am") {
            $radio_deb_am = "<input type=\"radio\" {$compte} name=\"new_demi_jour_deb\" value=\"am\" checked>&nbsp;" . _('form_am');
            $radio_deb_pm = "<input type=\"radio\" {$compte} name=\"new_demi_jour_deb\" value=\"pm\">&nbsp;" . _('form_pm');
        } else {
            $radio_deb_am = "<input type=\"radio\" {$compte} name=\"new_demi_jour_deb\" value=\"am\">" . _('form_am');
            $radio_deb_pm = "<input type=\"radio\" {$compte} name=\"new_demi_jour_deb\" value=\"pm\" checked>" . _('form_pm');
        }
        $text_fin = "<input class=\"form-control date\" type=\"text\" name=\"new_fin\" size=\"10\" maxlength=\"30\" value=\"" . revert_date($sql_date_fin) . "\">";
        if ($sql_demi_jour_fin == "am") {
            $radio_fin_am = "<input type=\"radio\" {$compte} name=\"new_demi_jour_fin\" value=\"am\" checked>" . _('form_am');
            $radio_fin_pm = "<input type=\"radio\" {$compte} name=\"new_demi_jour_fin\" value=\"pm\">" . _('form_pm');
        } else {
            $radio_fin_am = "<input type=\"radio\" {$compte} name=\"new_demi_jour_fin\" value=\"am\">" . _('form_am');
            $radio_fin_pm = "<input type=\"radio\" {$compte} name=\"new_demi_jour_fin\" value=\"pm\" checked>" . _('form_pm');
        }
        if ($_SESSION['config']['disable_saise_champ_nb_jours_pris']) {
            $text_nb_jours = "<input class=\"form-control\" type=\"text\" name=\"new_nb_jours\" size=\"5\" maxlength=\"30\" value=\"{$sql_nb_jours}\" style=\"background-color: #D4D4D4; \" readonly=\"readonly\">";
        } else {
            $text_nb_jours = "<input class=\"form-control\" type=\"text\" name=\"new_nb_jours\" size=\"5\" maxlength=\"30\" value=\"{$sql_nb_jours}\">";
        }
        $text_commentaire = "<input class=\"form-control\" type=\"text\" name=\"new_comment\" size=\"15\" maxlength=\"30\" value=\"{$sql_commentaire}\">";
    }
    echo "</tr>\n";
    // affichage 3ieme ligne : saisie des nouvelles valeurs
    echo "<tr>\n";
    echo "<td>{$text_debut}<br>{$radio_deb_am} / {$radio_deb_pm}</td><td>{$text_fin}<br>{$radio_fin_am} / {$radio_fin_pm}</td><td>{$text_nb_jours}</td><td>{$text_commentaire}</td>\n";
    echo "</tr>\n";
    echo '</tbody>';
    echo "</table>\n";
    echo '<hr/>';
    echo "<input type=\"hidden\" name=\"p_num_to_update\" value=\"{$p_num}\">\n";
    echo "<input type=\"hidden\" name=\"p_etat\" value=\"{$sql_etat}\">\n";
    echo "<input type=\"hidden\" name=\"session\" value=\"{$session}\">\n";
    echo '<input type="hidden" name="user_login" value="' . $_SESSION['userlogin'] . '">';
    echo "<input type=\"hidden\" name=\"onglet\" value=\"{$onglet}\">\n";
    echo '<p id="comment_nbj" style="color:red">&nbsp;</p>';
    echo "<input class=\"btn btn-success\" type=\"submit\" value=\"" . _('form_submit') . "\">\n";
    echo "<a class=\"btn\" href=\"{$PHP_SELF}?session={$session}&onglet=demandes_en_cours\">" . _('form_cancel') . "</a>\n";
    echo "</form>\n";
}
Beispiel #6
0
function affiche_tableau_conges_normal(&$pdf, $ReqLog2, $decalage, $tab_type_all_cong, $DEBUG = FALSE)
{
    // (largeur totale page = 210 ( - 2x10 de marge))
    // tailles des cellules du tableau
    $size_cell_type = 30;
    $size_cell_etat = 15;
    $size_cell_nb_jours = 20;
    //90
    $size_cell_debut = 30;
    $size_cell_fin = 30;
    $size_cell_comment = 60;
    //          total = 190 (185+decalage)
    /*************************************/
    /* affichage lignes de l'edition     */
    /*************************************/
    // decalage pour centrer
    $pdf->Cell($decalage);
    //$pdf->SetFont('Times', 'B', 10);
    $pdf->SetFont('Times', 'B', 10);
    $pdf->Cell($size_cell_type, 5, _('divers_type_maj_1'), 1, 0, 'C', 1);
    $pdf->Cell($size_cell_etat, 5, _('divers_etat_maj_1'), 1, 0, 'C', 1);
    $pdf->Cell($size_cell_nb_jours, 5, _('divers_nb_jours_maj_1'), 1, 0, 'C', 1);
    $pdf->Cell($size_cell_debut, 5, _('divers_debut_maj_1'), 1, 0, 'C', 1);
    $pdf->Cell($size_cell_fin, 5, _('divers_fin_maj_1'), 1, 0, 'C', 1);
    $pdf->Cell($size_cell_comment, 5, _('divers_comment_maj_1'), 1, 1, 'C', 1);
    while ($resultat2 = $ReqLog2->fetch_array()) {
        $sql_p_date_deb = eng_date_to_fr($resultat2["p_date_deb"]);
        $sql_p_demi_jour_deb = $resultat2["p_demi_jour_deb"];
        if ($sql_p_demi_jour_deb == "am") {
            $demi_j_deb = _('divers_am_short');
        } else {
            $demi_j_deb = _('divers_pm_short');
        }
        $sql_p_date_fin = eng_date_to_fr($resultat2["p_date_fin"]);
        $sql_p_demi_jour_fin = $resultat2["p_demi_jour_fin"];
        if ($sql_p_demi_jour_fin == "am") {
            $demi_j_fin = _('divers_am_short');
        } else {
            $demi_j_fin = _('divers_pm_short');
        }
        $sql_p_nb_jours = $resultat2["p_nb_jours"];
        $sql_p_commentaire = $resultat2["p_commentaire"];
        $sql_p_type = $resultat2["p_type"];
        $sql_p_etat = $resultat2["p_etat"];
        $sql_p_date_demande = $resultat2["p_date_demande"];
        $sql_p_date_traitement = $resultat2["p_date_traitement"];
        // decalage pour centrer
        $pdf->Cell($decalage);
        $hauteur_cellule = 5;
        $taille_font = 10;
        $pdf->SetFont('Times', '', $taille_font);
        $pdf->Cell($size_cell_type, $hauteur_cellule, $tab_type_all_cong[$sql_p_type]['libelle'], 1, 0, 'C');
        if ($sql_p_etat == "refus") {
            $text_etat = _('divers_refuse');
        } elseif ($sql_p_etat == "annul") {
            $text_etat = _('divers_annule');
        } else {
            $text_etat = $sql_p_etat;
        }
        $pdf->Cell($size_cell_etat, $hauteur_cellule, $text_etat, 1, 0, 'C');
        if ($sql_p_etat == "refus" || $sql_p_etat == "annul") {
            $pdf->SetFont('Times', '', $taille_font);
        } else {
            $pdf->SetFont('Times', 'B', $taille_font);
        }
        if ($sql_p_etat == "ok") {
            $text_nb_jours = "-" . $sql_p_nb_jours;
        } elseif ($sql_p_etat == "ajout") {
            $text_nb_jours = "+" . $sql_p_nb_jours;
        } else {
            $text_nb_jours = $sql_p_nb_jours;
        }
        $pdf->Cell($size_cell_nb_jours, $hauteur_cellule, $text_nb_jours, 1, 0, 'C');
        $pdf->SetFont('Times', '', $taille_font);
        $pdf->Cell($size_cell_debut, $hauteur_cellule, $sql_p_date_deb . " _ " . $demi_j_deb, 1, 0, 'C');
        $pdf->Cell($size_cell_fin, $hauteur_cellule, $sql_p_date_fin . " _ " . $demi_j_fin, 1, 0, 'C');
        // reduction de la taille du commentaire pour rentrer dans la cellule
        if (strlen($sql_p_commentaire) > 39) {
            $sql_p_commentaire = substr($sql_p_commentaire, 0, 35) . " ...";
        }
        $pdf->Cell($size_cell_comment, $hauteur_cellule, $sql_p_commentaire, 1, 1, 'C');
    }
}
Beispiel #7
0
function affiche_nouvelle_edition($login, $DEBUG = FALSE)
{
    $session = session_id();
    echo "<CENTER>\n";
    /*************************************/
    /* Historique des Conges et demandes */
    /*************************************/
    // Récupération des informations
    // recup de ttes les periodes de type conges du user, sauf les demandes, qui ne sont pas dejà sur une édition papier
    $sql2 = "SELECT p_login, p_date_deb, p_demi_jour_deb, p_date_fin, p_demi_jour_fin, p_nb_jours, p_commentaire, p_type, p_etat, p_date_demande, p_date_traitement, ta_libelle ";
    $sql2 = $sql2 . "FROM conges_periode as a, conges_type_absence as b ";
    $sql2 = $sql2 . "WHERE (p_etat!='demande' AND p_etat!='valid') ";
    $sql2 = $sql2 . "AND p_edition_id IS NULL ";
    $sql2 = $sql2 . "AND (p_login = '******') ";
    $sql2 = $sql2 . "AND (a.p_type=b.ta_id AND  ( (b.ta_type='conges') OR (b.ta_type='conges_exceptionnels') ) )";
    $sql2 = $sql2 . "ORDER BY p_date_deb ASC ";
    $ReqLog2 = SQL::query($sql2);
    echo "<h3>" . _('editions_last_edition') . " :</h3>\n";
    $count2 = $ReqLog2->num_rows;
    if ($count2 == 0) {
        echo "<b>" . _('editions_aucun_conges') . "</b><br>\n";
    } else {
        // AFFICHAGE TABLEAU
        if ($_SESSION['config']['affiche_date_traitement']) {
            echo "<table cellpadding=\"2\" class=\"tablo\" width=\"850\">\n";
        } else {
            echo "<table cellpadding=\"2\" class=\"tablo\" width=\"750\">\n";
        }
        echo "<thead><tr align=\"center\">\n";
        echo " <th>" . _('divers_type_maj_1') . "</th>\n";
        echo " <th>" . _('divers_etat_maj_1') . "</th>\n";
        echo " <th>" . _('divers_nb_jours_maj_1') . "</th>\n";
        echo " <th>" . _('divers_debut_maj_1') . "</th>\n";
        echo " <th>" . _('divers_fin_maj_1') . "</th>\n";
        echo " <th>" . _('divers_comment_maj_1') . "</th>\n";
        if ($_SESSION['config']['affiche_date_traitement']) {
            echo "<th>" . _('divers_date_traitement') . "</td>\n";
        }
        echo "</tr></thead></tbody>\n";
        while ($resultat2 = $ReqLog2->fetch_array()) {
            $sql_p_date_deb = eng_date_to_fr($resultat2["p_date_deb"]);
            $sql_p_demi_jour_deb = $resultat2["p_demi_jour_deb"];
            if ($sql_p_demi_jour_deb == "am") {
                $demi_j_deb = "mat";
            } else {
                $demi_j_deb = "aprm";
            }
            $sql_p_date_fin = eng_date_to_fr($resultat2["p_date_fin"]);
            $sql_p_demi_jour_fin = $resultat2["p_demi_jour_fin"];
            if ($sql_p_demi_jour_fin == "am") {
                $demi_j_fin = "mat";
            } else {
                $demi_j_fin = "aprm";
            }
            $sql_p_nb_jours = $resultat2["p_nb_jours"];
            $sql_p_commentaire = $resultat2["p_commentaire"];
            $sql_p_type = $resultat2["ta_libelle"];
            $sql_p_etat = $resultat2["p_etat"];
            $sql_p_date_demande = $resultat2["p_date_demande"];
            $sql_p_date_traitement = $resultat2["p_date_traitement"];
            echo "<tr align=\"center\">\n";
            echo "<td>{$sql_p_type}</td>\n";
            echo "<td>";
            if ($sql_p_etat == "refus") {
                echo _('divers_refuse');
            } elseif ($sql_p_etat == "annul") {
                echo _('divers_annule');
            } else {
                echo "{$sql_p_etat}";
            }
            echo "</td>\n";
            if ($sql_p_etat == "ok") {
                echo "<td class=\"histo-big\"> -{$sql_p_nb_jours}</td>";
            } elseif ($sql_p_etat == "ajout") {
                echo "<td class=\"histo-big\"> +{$sql_p_nb_jours}</td>";
            } else {
                echo "<td> {$sql_p_nb_jours}</td>";
            }
            echo "<td>{$sql_p_date_deb} _ {$demi_j_deb}</td>";
            echo "<td>{$sql_p_date_fin} _ {$demi_j_fin}</td>";
            echo "<td>{$sql_p_commentaire}</td>";
            if ($_SESSION['config']['affiche_date_traitement']) {
                if ($sql_p_date_demande == NULL) {
                    echo "<td class=\"histo-left\">" . _('divers_traitement') . " : {$sql_p_date_traitement}</td>\n";
                } else {
                    echo "<td class=\"histo-left\">" . _('divers_demande') . " : {$sql_p_date_demande}<br>" . _('divers_traitement') . " : {$sql_p_date_traitement}</td>\n";
                }
            }
            echo "</tr>\n";
        }
        echo "</tbody></table>\n";
        echo "<br>\n";
        /******************/
        /* bouton editer  */
        /******************/
        echo "<table cellpadding=\"2\" width=\"400\">\n";
        echo "<tr align=\"center\">\n";
        echo " <td width=\"200\">\n";
        echo "<a href=\"edition_papier.php?session={$session}&user_login={$login}&edit_id=0\">\n";
        echo "<img src=\"" . TEMPLATE_PATH . "img/fileprint_2.png\" width=\"22\" height=\"22\" border=\"0\" title=\"" . _('editions_lance_edition') . "\" alt=\"" . _('editions_lance_edition') . "\">\n";
        echo "<b> " . _('editions_lance_edition') . " </b>\n";
        echo "</a>\n";
        echo "</td>\n";
        echo " <td width=\"200\">\n";
        echo "<a href=\"edition_papier.php?session={$session}&user_login={$login}&edit_id=0101010\">\n";
        echo "<img src=\"" . TEMPLATE_PATH . "img/fileprint_2.png\" width=\"22\" height=\"22\" border=\"0\" title=\"" . _('editions_lance_edition') . "\" alt=\"" . _('editions_lance_edition') . "\">\n";
        echo "<b> Edit for year </b>\n";
        echo "</a>\n";
        echo "</td>\n";
        echo " <td width=\"200\">\n";
        echo "<a href=\"edition_pdf.php?session={$session}&user_login={$login}&edit_id=0\">\n";
        echo "<img src=\"" . TEMPLATE_PATH . "img/pdf_22x22_2.png\" width=\"22\" height=\"22\" border=\"0\" title=\"" . _('editions_pdf_edition') . "\" alt=\"" . _('editions_pdf_edition') . "\">\n";
        echo "<b> " . _('editions_pdf_edition') . " </b>\n";
        echo "</a>\n";
        echo "</td>\n";
        echo "</tr>\n";
        echo "</table>\n";
    }
    echo "<br>\n";
    echo "</CENTER>\n";
    echo "<hr align=\"center\" size=\"2\" width=\"90%\">\n";
}
Beispiel #8
0
 /**
  * Encapsule le comportement du module de l'historique des autres absences
  *
  * @param string $onglet Nom de l'onglet à afficher
  * @param string $session  Clé de session
  * @param string $PHP_SELF
  *
  * @return void
  * @access public
  * @static
  */
 public static function historiqueAutresAbsencesModule($onglet, $session, $PHP_SELF)
 {
     $return = '';
     if ($_SESSION['config']['where_to_find_user_email'] == "ldap") {
         include_once CONFIG_PATH . 'config_ldap.php';
     }
     $tri_date = getpost_variable('tri_date', "ascendant");
     $year_affichage = getpost_variable('year_affichage', date("Y"));
     $return = '<h1>' . _('user_historique_abs') . ' :</h1>';
     // affichage de l'année et des boutons de défilement
     $year_affichage_prec = $year_affichage - 1;
     $year_affichage_suiv = $year_affichage + 1;
     $return .= '<b>';
     $return .= '<a href="' . $PHP_SELF . '?session=' . $session . '&onglet=historique_autres_absences&year_affichage=' . $year_affichage_prec . '"><<</a>';
     $return .= '&nbsp&nbsp&nbsp ' . $year_affichage . '&nbsp&nbsp&nbsp';
     $return .= '<a href="' . $PHP_SELF . '?session=' . $session . '&onglet=historique_autres_absences&year_affichage=' . $year_affichage_suiv . '">>></a>';
     $return .= '</b><br><br>';
     // Récupération des informations
     $sql4 = 'SELECT p_login, p_date_deb, p_demi_jour_deb, p_date_fin, p_demi_jour_fin, p_nb_jours, p_commentaire, p_type, p_etat, p_motif_refus, p_date_demande, p_date_traitement, p_num, ta_libelle
         FROM conges_periode as a, conges_type_absence as b
         WHERE a.p_login = "******"
         AND (a.p_type=b.ta_id)
         AND (b.ta_type=\'absences\')
         AND (p_date_deb LIKE \'' . intval($year_affichage) . '%\' OR p_date_fin LIKE \'' . intval($year_affichage) . '%\') ';
     if ($tri_date == "descendant") {
         $sql4 = $sql4 . " ORDER BY p_date_deb DESC ";
     } else {
         $sql4 = $sql4 . " ORDER BY p_date_deb ASC ";
     }
     $ReqLog4 = \includes\SQL::query($sql4);
     $count4 = $ReqLog4->num_rows;
     if ($count4 == 0) {
         $return .= '<b>' . _('user_abs_aucune_abs') . '</b><br>';
     } else {
         // AFFICHAGE TABLEAU
         $return .= '<table cellpadding="2"  class="tablo" width="80%">';
         $return .= '<thead>';
         $return .= '<tr>';
         $return .= '<td>';
         $return .= '<a href="' . $PHP_SELF . '?session=' . $session . '&onglet=' . $onglet . '&tri_date=descendant"><img src="' . TEMPLATE_PATH . 'img/1downarrow-16x16.png" width="16" height="16" border="0" title="trier"></a>';
         $return .= _('divers_debut_maj_1');
         $return .= '<a href="' . $PHP_SELF . '?session=' . $session . '&onglet=' . $onglet . '&tri_date=ascendant"><img src="' . TEMPLATE_PATH . 'img/1uparrow-16x16.png" width="16" height="16" border="0" title="trier"></a>';
         $return .= '</td>';
         $return .= '<td>' . _('divers_fin_maj_1') . '</td>';
         $return .= '<td>' . _('user_abs_type') . '</td>';
         $return .= '<td>' . _('divers_nb_jours_maj_1') . '</td>';
         $return .= '<td>' . _('divers_comment_maj_1') . '</td>';
         $return .= '<td>' . _('divers_etat_maj_1') . '</td>';
         $return .= '<td></td><td></td>';
         if ($_SESSION['config']['affiche_date_traitement']) {
             $return .= '<td>' . _('divers_date_traitement') . '</td>';
         }
         $return .= '</tr>';
         $return .= '</thead>';
         $return .= '<tbody>';
         $i = true;
         while ($resultat4 = $ReqLog4->fetch_array()) {
             $sql_login = $resultat4["p_login"];
             $sql_date_deb = eng_date_to_fr($resultat4["p_date_deb"]);
             $sql_p_demi_jour_deb = $resultat4["p_demi_jour_deb"];
             if ($sql_p_demi_jour_deb == "am") {
                 $demi_j_deb = "mat";
             } else {
                 $demi_j_deb = "aprm";
             }
             $sql_date_fin = eng_date_to_fr($resultat4["p_date_fin"]);
             $sql_p_demi_jour_fin = $resultat4["p_demi_jour_fin"];
             if ($sql_p_demi_jour_fin == "am") {
                 $demi_j_fin = "mat";
             } else {
                 $demi_j_fin = "aprm";
             }
             $sql_nb_jours = affiche_decimal($resultat4["p_nb_jours"]);
             $sql_commentaire = $resultat4["p_commentaire"];
             //$sql_type=$resultat4["p_type"];
             $sql_type = $resultat4["ta_libelle"];
             $sql_etat = $resultat4["p_etat"];
             $sql_motif_refus = $resultat4["p_motif_refus"];
             $sql_date_demande = $resultat4["p_date_demande"];
             $sql_date_traitement = $resultat4["p_date_traitement"];
             $sql_num = $resultat4["p_num"];
             // si le user a le droit de saisir lui meme ses absences et qu'elle n'est pas deja annulee, on propose de modifier ou de supprimer
             if ($sql_etat != "annul" && $_SESSION['config']['user_saisie_mission']) {
                 $user_modif_mission = "<a href=\"user_index.php?session={$session}&p_num={$sql_num}&onglet=modif_demande\">" . _('form_modif') . "</a>";
                 $user_suppr_mission = "<a href=\"user_index.php?session={$session}&p_num={$sql_num}&onglet=suppr_demande\">" . _('form_supprim') . "</a>";
             } else {
                 $user_modif_mission = " - ";
                 $user_suppr_mission = " - ";
             }
             $return .= '<tr class="' . ($i ? 'i' : 'p') . '">';
             $return .= '<td class="histo">' . schars($sql_date_deb) . ' _ ' . schars($demi_j_deb) . '</td>';
             $return .= '<td class="histo">' . schars($sql_date_fin) . ' _ ' . schars($demi_j_fin) . '</td>';
             $return .= '<td class="histo">' . schars($sql_type) . '</td>';
             $return .= '<td class="histo">' . affiche_decimal($sql_nb_jours) . '</td>';
             $return .= '<td class="histo">' . schars($sql_commentaire) . '</td>';
             if ($sql_etat == "refus") {
                 if ($sql_motif_refus == "") {
                     $sql_motif_refus = _('divers_inconnu');
                 }
                 $return .= '<br><i>".' . schars(_('divers_motif_refus')) . '." : ' . schars($sql_motif_refus) . '</i>';
             } elseif ($sql_etat == "annul") {
                 if ($sql_motif_refus == "") {
                     $sql_motif_refus = _('divers_inconnu');
                 }
                 $return .= '<br><i>".' . schars(_('divers_motif_annul')) . '." : ' . schars($sql_motif_refus) . '</i>';
             }
             $return .= '</td>';
             $return .= '<td>';
             if ($sql_etat == "refus") {
                 $return .= _('divers_refuse');
             } elseif ($sql_etat == "annul") {
                 $return .= _('divers_annule');
             } else {
                 $return .= schars($sql_etat);
             }
             $return .= '</td>';
             $return .= '<td class="histo">' . $user_modif_mission . '</td>';
             $return .= '<td class="histo">' . $user_suppr_mission . '</td>' . "\n";
             if ($_SESSION['config']['affiche_date_traitement']) {
                 $return .= '<td class="histo-left">' . schars(_('divers_demande')) . ' : ' . schars($sql_date_demande) . '<br>' . schars(_('divers_traitement')) . ' : ' . schars($sql_date_traitement) . '</td>';
             }
             $return .= '</tr>';
             $i = !$i;
         }
         $return .= '</tbody>';
         $return .= '</table>';
     }
     $return .= '<br><br>';
     return $return;
 }
Beispiel #9
0
function edition($login, $edit_id, $DEBUG = FALSE)
{
    //$DEBUG = TRUE ;
    $session = session_id();
    // recup infos du user
    $tab_info_user = recup_info_user_pour_edition($login, $DEBUG);
    // recup infos de l'édition
    $tab_info_edition = recup_info_edition($edit_id, $DEBUG);
    // recup du tableau des types de conges exceptionnels (seulement les conge sexceptionnels )
    $tab_type_cong = recup_tableau_types_conges($DEBUG);
    // recup du tableau des types de conges (seulement les conges)
    if ($_SESSION['config']['gestion_conges_exceptionnels']) {
        $tab_type_conges_exceptionnels = recup_tableau_types_conges_exceptionnels($DEBUG);
    } else {
        $tab_type_conges_exceptionnels = array();
    }
    // recup du tableau de tous les types de conges
    $tab_type_all_cong = recup_tableau_tout_types_abs($DEBUG);
    if ($DEBUG) {
        echo "tab_info_user :<br>\n";
        print_r($tab_info_user);
        echo "<br><br>\n";
        echo "tab_info_edition :<br>\n";
        print_r($tab_info_edition);
        echo "<br><br>\n";
        echo "tab_type_cong :<br>\n";
        print_r($tab_type_cong);
        echo "<br><br>\n";
        echo "tab_type_conges_exceptionnels :<br>\n";
        print_r($tab_type_conges_exceptionnels);
        echo "<br><br>\n";
        echo "tab_type_all_cong :<br>\n";
        print_r($tab_type_all_cong);
        echo "<br><br>\n";
        echo "numero edition = {$edit_id}<br>\n";
    }
    /**************************************/
    /* affichage du texte en haut de page */
    /**************************************/
    echo "\n<!-- affichage du texte en haut de page -->\n";
    echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"770\">\n";
    echo "<tr align=\"center\">\n";
    echo "<td>" . $_SESSION['config']['texte_haut_edition_papier'] . "<br><br></td>\n";
    echo "</tr>\n";
    echo "</table>\n";
    /**************************************/
    /* affichage du TITRE                 */
    /**************************************/
    echo "\n<!-- affichage du TITRE -->\n";
    echo "<H1>" . $tab_info_user['nom'] . "  " . $tab_info_user['prenom'] . "</H1>\n\n";
    $tab_date = explode("-", $tab_info_edition['date']);
    echo "<H2>" . _('editions_bilan_au') . " {$tab_date['2']} / {$tab_date['1']} / {$tab_date['0']}</H2>\n\n";
    /****************************/
    /* tableau Bilan des Conges */
    /****************************/
    // affichage du tableau récapitulatif des solde de congés d'un user DE cette edition !
    affiche_tableau_bilan_conges_user_edition($tab_info_user, $tab_info_edition, $tab_type_cong, $tab_type_conges_exceptionnels, $DEBUG);
    $quotite = $tab_info_user['quotite'];
    echo "<h3> " . _('divers_quotite') . "&nbsp; : &nbsp;{$quotite} % </h3>\n";
    echo "<br><br><br>\n";
    if ($_SESSION['config']['affiche_date_traitement']) {
        echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"1\" width=\"870\">\n";
    } else {
        echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"1\" width=\"770\">\n";
    }
    echo "<tr align=\"center\">\n";
    echo "<td><h3>" . _('editions_historique') . " :</h3></td>\n";
    echo "</tr>\n";
    /*********************************************/
    /* Tableau Historique des Conges et demandes */
    /*********************************************/
    echo "\n<!-- Tableau Historique des Conges et demandes -->\n";
    echo "<tr align=\"center\">\n";
    echo "<td>\n";
    // Récupération des informations
    // on ne recup QUE les periodes de l'edition choisie
    $sql2 = "SELECT p_login, p_date_deb, p_demi_jour_deb, p_date_fin, p_demi_jour_fin, p_nb_jours, p_commentaire, p_type, p_etat, p_date_demande, p_date_traitement ";
    $sql2 = $sql2 . "FROM conges_periode ";
    $sql2 = $sql2 . "WHERE p_edition_id = {$edit_id} ";
    $sql2 = $sql2 . "ORDER BY p_date_deb ASC ";
    $ReqLog2 = SQL::query($sql2);
    $count2 = $ReqLog2->num_rows;
    if ($count2 == 0) {
        echo "<b>" . _('editions_aucun_conges') . "</b><br>\n";
    } else {
        // AFFICHAGE TABLEAU
        if ($_SESSION['config']['affiche_date_traitement']) {
            echo "<table cellpadding=\"2\" class=\"tablo-edit\" width=\"850\">\n";
        } else {
            echo "<table cellpadding=\"2\" class=\"tablo-edit\" width=\"750\">\n";
        }
        /*************************************/
        /* affichage anciens soldes          */
        /*************************************/
        echo "\n<!-- affichage anciens soldes -->\n";
        echo "<tr>\n";
        echo "<td colspan=\"5\">\n";
        $edition_precedente_id = get_id_edition_precedente_user($login, $edit_id, $DEBUG);
        if ($edition_precedente_id == 0) {
            echo "<b>" . _('editions_soldes_precedents_inconnus') . " !... ";
        } else {
            $tab_edition_precedente = recup_info_edition($edition_precedente_id, $DEBUG);
            foreach ($tab_type_cong as $id_abs => $libelle) {
                echo _('editions_solde_precedent') . " <b>{$libelle} : " . $tab_edition_precedente['conges'][$id_abs] . "</b><br>\n";
            }
            foreach ($tab_type_conges_exceptionnels as $id_abs => $libelle) {
                echo _('editions_solde_precedent') . " <b>{$libelle} : " . $tab_edition_precedente['conges'][$id_abs] . "</b><br>\n";
            }
        }
        echo "<td>\n";
        echo "</tr>\n";
        /*************************************/
        /* affichage lignes de l'edition     */
        /*************************************/
        echo "\n<!-- affichage lignes de l'edition -->\n";
        echo "<tr>\n";
        echo " <td class=\"titre-edit\">" . _('divers_type_maj_1') . "</td>\n";
        echo " <td class=\"titre-edit\">" . _('divers_etat_maj_1') . "</td>\n";
        echo " <td class=\"titre-edit\">" . _('divers_nb_jours_maj_1') . "</td>\n";
        echo " <td class=\"titre-edit\">" . _('divers_debut_maj_1') . "</td>\n";
        echo " <td class=\"titre-edit\">" . _('divers_fin_maj_1') . "</td>\n";
        echo " <td class=\"titre-edit\">" . _('divers_comment_maj_1') . "</td>\n";
        if ($_SESSION['config']['affiche_date_traitement']) {
            echo "<td class=\"titre-edit\">" . _('divers_date_traitement') . "</td>\n";
        }
        echo "</tr>\n";
        while ($resultat2 = $ReqLog2->fetch_array()) {
            $sql_p_date_deb = eng_date_to_fr($resultat2["p_date_deb"]);
            $sql_p_demi_jour_deb = $resultat2["p_demi_jour_deb"];
            if ($sql_p_demi_jour_deb == "am") {
                $demi_j_deb = _('divers_am_short');
            } else {
                $demi_j_deb = _('divers_pm_short');
            }
            $sql_p_date_fin = eng_date_to_fr($resultat2["p_date_fin"]);
            $sql_p_demi_jour_fin = $resultat2["p_demi_jour_fin"];
            if ($sql_p_demi_jour_fin == "am") {
                $demi_j_fin = _('divers_am_short');
            } else {
                $demi_j_fin = _('divers_pm_short');
            }
            $sql_p_nb_jours = $resultat2["p_nb_jours"];
            $sql_p_commentaire = $resultat2["p_commentaire"];
            $sql_p_type = $resultat2["p_type"];
            $sql_p_etat = $resultat2["p_etat"];
            $sql_p_date_demande = $resultat2["p_date_demande"];
            $sql_p_date_traitement = $resultat2["p_date_traitement"];
            echo "<tr>\n";
            echo "<td class=\"histo-edit\">" . $tab_type_all_cong[$sql_p_type]['libelle'] . "</td>\n";
            echo "<td class=\"histo-edit\">";
            if ($sql_p_etat == "refus") {
                echo _('divers_refuse');
            } elseif ($sql_p_etat == "annul") {
                echo _('divers_annule');
            } else {
                echo "{$sql_p_etat}";
            }
            echo "</td>\n";
            if ($sql_p_etat == "ok") {
                echo "<td class=\"histo-big\"> -{$sql_p_nb_jours}</td>";
            } elseif ($sql_p_etat == "ajout") {
                echo "<td class=\"histo-big\"> +{$sql_p_nb_jours}</td>";
            } else {
                echo "<td> {$sql_p_nb_jours}</td>";
            }
            echo "<td class=\"histo-edit\">{$sql_p_date_deb} _ {$demi_j_deb}</td>";
            echo "<td class=\"histo-edit\">{$sql_p_date_fin} _ {$demi_j_fin}</td>";
            echo "<td class=\"histo-edit\">{$sql_p_commentaire}</td>";
            if ($_SESSION['config']['affiche_date_traitement']) {
                if ($sql_p_date_demande == NULL) {
                    echo "<td class=\"histo-left\">" . _('divers_demande') . " : {$sql_p_date_demande}<br>" . _('divers_traitement') . " : {$sql_p_date_traitement}</td>\n";
                } else {
                    echo "<td class=\"histo-left\">" . _('divers_demande') . " : {$sql_p_date_demande}<br>" . _('divers_traitement') . " : pas traité</td>\n";
                }
            }
            echo "</tr>\n";
        }
        /*************************************/
        /* affichage nouveaux soldes         */
        /*************************************/
        echo "\n<!-- affichage nouveaux soldes -->\n";
        echo "<tr>\n";
        echo "<td colspan=\"5\">\n";
        foreach ($tab_type_cong as $id_abs => $libelle) {
            echo _('editions_nouveau_solde') . " <b>{$libelle} : " . $tab_info_edition['conges'][$id_abs] . "</b><br>\n";
        }
        echo "<td>\n";
        echo "</tr>\n";
        echo "</table>\n\n";
    }
    echo "<br><br>\n";
    echo "</td>\n";
    echo "</tr>\n";
    echo "</table>\n";
    /*************************************/
    /* affichage des zones de signature  */
    /*************************************/
    echo "\n<!-- affichage des zones de signature -->\n";
    echo "<br>\n";
    echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"770\">\n";
    echo "<tr align=\"center\">\n";
    echo "<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\n";
    echo "<td align=\"left\">\n";
    echo "<b>" . _('editions_date') . " : <br>" . _('editions_signature_1') . " :</b><br><br><br><br><br><br><br><br><br><br>\n";
    echo "</td>\n";
    echo "<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\n";
    echo "<td align=\"left\">\n";
    echo "<b>" . _('editions_date') . " : <br>" . _('editions_signature_2') . " :</b><br><i>(" . _('editions_cachet_etab') . ")</i><br><br><br><br><br><br><br><br><br>\n";
    echo "</td>\n";
    echo "<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\n";
    echo "</tr>\n";
    echo "</table>\n";
    /*************************************/
    /* affichage du texte en bas de page */
    /*************************************/
    echo "\n<!-- affichage du texte en bas de page -->\n";
    echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"770\">\n";
    echo "<tr align=\"center\">\n";
    echo "<td><br>" . $_SESSION['config']['texte_bas_edition_papier'] . "</td>\n";
    echo "</tr>\n";
    echo "</table>\n";
}
function saisie_groupe_fermeture($DEBUG = FALSE)
{
    $PHP_SELF = $_SERVER['PHP_SELF'];
    $session = session_id();
    echo "<h3>fermeture pour tous ou pour un groupe ?</h3>\n";
    echo '<div class="row">';
    echo '<div class="col-md-6">';
    /********************/
    /* Choix Tous       */
    /********************/
    // AFFICHAGE TABLEAU
    echo "<form action=\"{$PHP_SELF}?session={$session}\" method=\"POST\">\n";
    echo "<input type=\"hidden\" name=\"groupe_id\" value=\"0\">\n";
    echo "<input type=\"hidden\" name=\"choix_action\" value=\"saisie_dates\">\n";
    echo "<input class=\"btn btn-success\" type=\"submit\" value=\"" . _('admin_jours_fermeture_fermeture_pour_tous') . " !\">  \n";
    echo "</form>\n";
    echo '</div>';
    echo '<div class="col-md-6">';
    /********************/
    /* Choix Groupe     */
    /********************/
    // Récuperation des informations :
    $sql_gr = "SELECT g_gid, g_groupename, g_comment FROM conges_groupe ORDER BY g_groupename";
    // AFFICHAGE TABLEAU
    echo "<form action=\"{$PHP_SELF}?session={$session}\" class=\"form-inline\" method=\"POST\">\n";
    echo '<div class="form-group" style="margin-right: 10px;">';
    $ReqLog_gr = SQL::query($sql_gr);
    echo "<select  class=\"form-control\" name=\"groupe_id\">";
    while ($resultat_gr = $ReqLog_gr->fetch_array()) {
        $sql_gid = $resultat_gr["g_gid"];
        $sql_group = $resultat_gr["g_groupename"];
        $sql_comment = $resultat_gr["g_comment"];
        echo "<option value=\"{$sql_gid}\">{$sql_group}";
    }
    echo "</select>";
    echo "<input type=\"hidden\" name=\"choix_action\" value=\"saisie_dates\">\n";
    echo '</div>';
    echo "<input class=\"btn btn-success\" type=\"submit\" value=\"" . _('admin_jours_fermeture_fermeture_par_groupe') . "\">  \n";
    echo "</form>\n";
    echo '</div>';
    /************************************************/
    // HISTORIQUE DES FERMETURES
    $tab_periodes_fermeture = array();
    get_tableau_periodes_fermeture($tab_periodes_fermeture, $DEBUG);
    if (count($tab_periodes_fermeture) != 0) {
        echo "<table class=\"table\">\n";
        echo "<thead>\n";
        echo "<tr>\n";
        echo "<th colspan=\"2\">Fermetures</th>\n";
        echo "</tr>\n";
        echo "</thead>\n";
        foreach ($tab_periodes_fermeture as $tab_periode) {
            $date_affiche_1 = eng_date_to_fr($tab_periode['date_deb']);
            $date_affiche_2 = eng_date_to_fr($tab_periode['date_fin']);
            $fermeture_id = $tab_periode['fermeture_id'];
            $groupe_id = $tab_periode['groupe_id'];
            $groupe_name = $tab_periode['groupe_name'];
            if ($groupe_id == 0) {
                $groupe_name = 'Tous';
            } else {
                $groupe_name = $groupe_name;
            }
            echo "<tr>\n";
            echo "<td>\n";
            echo _('divers_du') . " <b>{$date_affiche_1}</b> " . _('divers_au') . " <b>{$date_affiche_2}</b>  (id {$fermeture_id})</b>  " . $groupe_name . "\n";
            echo "</td>\n";
            echo "<td>\n";
            echo "<a href=\"{$PHP_SELF}?session={$session}&choix_action=annul_fermeture&fermeture_id={$fermeture_id}&groupe_id={$groupe_id}&fermeture_date_debut={$date_affiche_1}&fermeture_date_fin={$date_affiche_2}\">" . _('admin_annuler_fermeture') . "</a>\n";
            echo "</td>\n";
            echo "</tr>\n";
        }
        echo "</table>\n";
    }
    echo '</div>';
    echo "<hr>\n";
    echo "<a class=\"btn\" href=\"/admin/admin_index.php?session={$session}\">" . _('form_cancel') . "</a>\n";
}
function confirmer($p_num, $onglet, $DEBUG=FALSE)
{

	$PHP_SELF=$_SERVER['PHP_SELF'];
	$session=session_id() ;


	// Récupération des informations
	$sql1 = 'SELECT p_login, p_date_deb, p_demi_jour_deb, p_date_fin, p_demi_jour_fin, p_nb_jours, p_commentaire, p_type, p_num FROM conges_periode WHERE p_num = \''.SQL::quote($p_num).'\'';
	//printf("sql1 = %s<br>\n", $sql1);
	$ReqLog1 = SQL::query($sql1) ;

	// AFFICHAGE TABLEAU
	echo "<form action=\"$PHP_SELF\" method=\"POST\">\n"  ;
	echo "<table cellpadding=\"2\" class=\"tablo\" width=\"80%\">\n";
	echo "<thead>\n";
	echo "<tr align=\"center\">\n";
	echo "<td>". _('divers_debut_maj_1') ."</td>\n";
	echo "<td>". _('divers_fin_maj_1') ."</td>\n";
	echo "<td>". _('divers_nb_jours_maj_1') ."</td>\n";
	echo "<td>". _('divers_comment_maj_1') ."</td>\n";
	echo "<td>". _('divers_type_maj_1') ."</td>\n";
	echo "</tr>\n";
	echo "</thead>\n";
	echo "<tbody>\n";
	echo "<tr align=\"center\">\n";
	while ($resultat1 = $ReqLog1->fetch_array())
	{
		$sql_date_deb=eng_date_to_fr($resultat1["p_date_deb"]);
		$sql_demi_jour_deb = $resultat1["p_demi_jour_deb"];
		if($sql_demi_jour_deb=="am")
			$demi_j_deb= _('divers_am_short') ;
		else
			$demi_j_deb= _('divers_pm_short') ;
		$sql_date_fin=eng_date_to_fr($resultat1["p_date_fin"]);
		$sql_demi_jour_fin = $resultat1["p_demi_jour_fin"];
		if($sql_demi_jour_fin=="am")
			$demi_j_fin= _('divers_am_short') ;
		else
			$demi_j_fin= _('divers_pm_short') ;
		$sql_nb_jours=affiche_decimal($resultat1["p_nb_jours"]);
		//$sql_type=$resultat1["p_type"];
		$sql_type=get_libelle_abs($resultat1["p_type"], $DEBUG);
		$sql_comment=$resultat1["p_commentaire"];

		if( $DEBUG ) { echo "$sql_date_deb _ $demi_j_deb : $sql_date_fin _ $demi_j_fin : $sql_nb_jours : $sql_comment : $sql_type<br>\n"; }

		echo "<td>$sql_date_deb _ $demi_j_deb</td>\n";
		echo "<td>$sql_date_fin _ $demi_j_fin</td>\n";
		echo "<td>$sql_nb_jours</td>\n";
		echo "<td>$sql_comment</td>\n";
		echo "<td>$sql_type</td>\n";
	}
	echo "</tr>\n";
	echo "</tbody>\n";
	echo "</table><br>\n\n";
	echo "<input type=\"hidden\" name=\"p_num_to_delete\" value=\"$p_num\">\n";
	echo "<input type=\"hidden\" name=\"session\" value=\"$session\">\n";
	echo "<input type=\"hidden\" name=\"onglet\" value=\"$onglet\">\n";
	echo "<input type=\"submit\" value=\"". _('form_supprim') ."\">\n";
	echo "</form>\n" ;

}
function saisie_dates_fermeture($year, $groupe_id, $new_date_debut, $new_date_fin, $code_erreur, $DEBUG = FALSE)
{
    $PHP_SELF = $_SERVER['PHP_SELF'];
    $session = session_id();
    $tab_date_debut = explode("/", $new_date_debut);
    // date au format d/m/Y
    $timestamp_date_debut = mktime(0, 0, 0, $tab_date_debut[1], $tab_date_debut[0], $tab_date_debut[2]);
    $date_debut_yyyy_mm_dd = $tab_date_debut[2] . "-" . $tab_date_debut[1] . "-" . $tab_date_debut[0];
    $tab_date_fin = explode("/", $new_date_fin);
    // date au format d/m/Y
    $timestamp_date_fin = mktime(0, 0, 0, $tab_date_fin[1], $tab_date_fin[0], $tab_date_fin[2]);
    $date_fin_yyyy_mm_dd = $tab_date_fin[2] . "-" . $tab_date_fin[1] . "-" . $tab_date_fin[0];
    $timestamp_today = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
    //	$year=$tab_date_debut[2];
    // on construit le tableau de l'année considérée
    $tab_year = array();
    get_tableau_jour_fermeture($year, $tab_year, $groupe_id, $DEBUG);
    if ($DEBUG) {
        echo "tab_year = ";
        print_r($tab_year);
        echo "<br>\n";
    }
    /************************************************/
    // GESTION DES ERREURS DE SAISIE :
    //
    // $code_erreur=1 ;  // code erreur : jour feriés non saisis
    // $code_erreur=2 ;  // code erreur : $new_date_debut est posterieure a $new_date_fin
    // $code_erreur=3 ;  // code erreur : saisie de date passée
    // $code_erreur=4 ;  // code erreur : saisie de aujourd'hui
    // $code_erreur=5 ;  // code erreur : fermeture chevauche une periode deja saisie
    // on verifie que $new_date_debut est anterieure a $new_date_fin
    if ($code_erreur == 2) {
        echo "<br><center><h3><font color=\"red\">" . _('admin_jours_fermeture_dates_incompatibles') . ".</font></h3></center><br><br>\n";
    }
    // on verifie que ce ne sont pas des dates passées
    if ($code_erreur == 3) {
        echo "<br><center><h3><font color=\"red\">" . _('admin_jours_fermeture_date_passee_error') . ".</font></h3></center><br><br>\n";
    }
    // on verifie si les jours fériés de l'annee de la periode saisie sont enregistrés : sinon BUG au calcul des soldes des users !
    if ($code_erreur == 1) {
        echo "<br><center><h3><font color=\"red\">" . _('admin_jours_fermeture_annee_non_saisie') . ".</font></h3></center><br><br>\n";
    }
    // on verifie si la periode saisie ne chevauche pas une :
    // fabrication et initialisation du tableau des demi-jours de la date_debut à la date_fin
    if ($code_erreur == 4) {
        echo "<br><center><h3><font color=\"red\">" . _('admin_jours_fermeture_fermeture_aujourd_hui') . ".</font></h3></center><br><br>\n";
    }
    if ($code_erreur == 5) {
        echo "<br><center><h3><font color=\"red\">" . _('admin_jours_fermeture_chevauche_periode') . ".</font></h3></center><br><br>\n";
    }
    /************************************************/
    // FORMULAIRE DE SAISIE D'UNE NOUVELLE FERMETURE  + liens de navigation d'une annee a l'autre
    echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"width=\"100%\">\n";
    echo "<tr align=\"center\">\n";
    // cellulle de gauche : bouton annee precedente
    echo "<td align=\"left\">\n";
    $annee_precedente = $year - 1;
    echo '<a href="' . schars($PHP_SELF) . '?session=' . schars($session) . '&year=' . schars($annee_precedente) . '&groupe_id=' . schars($groupe_id) . '"> << ' . schars(_('admin_jours_chomes_annee_precedente')) . '</a>' . "\n";
    echo "</td>\n";
    // cellulle centrale : saisie d'une fermeture
    echo "<td width=\"450\">\n";
    echo "<fieldset class=\"cal_saisie\">\n";
    echo "<legend class=\"boxlogin\">" . _('admin_jours_fermeture_new_fermeture') . "</legend>\n";
    /************************************************/
    // FORMULAIRE
    echo "<form action=\"{$PHP_SELF}?session={$session}\" method=\"POST\">\n";
    /************************************************/
    // table contenant le fieldset
    echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n";
    echo "<tr align=\"center\">\n";
    echo "<td>\n";
    echo "<fieldset class=\"cal_saisie\">\n";
    // tableau contenant saisie de date (avec javascript pour afficher les calendriers)
    echo "<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\">\n";
    echo "<tr align=\"center\">\n";
    echo "<td>\n";
    echo _('divers_date_debut') . " : <input type=\"text\" name=\"new_date_debut\" class=\"calendrier DatePicker_trigger\" value=\"{$new_date_debut}\" />\n";
    echo "</td>\n";
    echo "</tr>\n";
    echo "</table>\n";
    echo "</fieldset>\n";
    echo "</td>\n";
    echo "<td>\n";
    echo "<fieldset class=\"cal_saisie\">\n";
    // tableau contenant les mois
    echo "<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\">\n";
    // ligne des boutons de défilement
    echo "<tr align=\"center\">\n";
    echo "<td>\n";
    echo _('divers_date_fin') . " : <input type=\"text\" name=\"new date_fin\" class=\"calendrier DatePicker_trigger\" value=\"{$new_date_fin}\"  />\n";
    echo "</td>\n";
    echo "</tr>\n";
    echo "</table>\n";
    echo "</fieldset>\n";
    echo "</td>\n";
    echo "</tr>\n";
    echo "</table>\n";
    /************************************************/
    // SELECTION DU TYPE DE CONGES AUQUEL AFFECTER CETTE FERMETURE
    echo "<br>\n";
    // Affichage d'un SELECT de formulaire pour choix d'un type d'absence
    echo _('admin_jours_fermeture_affect_type_conges');
    affiche_select_conges_id($DEBUG);
    /************************************************/
    //table contenant les boutons
    echo "<table cellpadding=\"2\" cellspacing=\"3\" border=\"0\" >\n";
    echo "<tr align=\"center\">\n";
    echo "<td>\n";
    echo "<input type=\"hidden\" name=\"groupe_id\" value=\"{$groupe_id}\">\n";
    echo "<input type=\"hidden\" name=\"choix_action\" value=\"commit_new_fermeture\">\n";
    echo "<input type=\"submit\" value=\"" . _('form_submit') . "\">  \n";
    echo "<input type=\"button\" value=\"" . _('form_cancel') . "\" onClick=\"javascript:window.close();\">\n";
    echo "</td>\n";
    echo "</tr>\n";
    echo "</table>\n";
    echo "</form>\n";
    // FIN FORMULAIRE
    echo "</fieldset>\n";
    echo "</td>\n";
    // cellulle de droite : bouton annee suivante
    echo "<td align=\"right\">\n";
    $annee_suivante = $year + 1;
    echo "<a href=\"{$PHP_SELF}?session={$session}&year={$annee_suivante}&groupe_id={$groupe_id}\">" . _('admin_jours_chomes_annee_suivante') . " >> </a>\n";
    echo "</td>\n";
    echo "</tr>\n";
    echo "</table>\n";
    /************************************************/
    // HISTORIQUE DES FERMETURES
    $tab_periodes_fermeture = array();
    get_tableau_periodes_fermeture($tab_periodes_fermeture, $groupe_id, $DEBUG);
    if (count($tab_periodes_fermeture) != 0) {
        echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n";
        echo "<tr align=\"center\">\n";
        echo "<td>\n";
        echo "<fieldset class=\"cal_saisie\">\n";
        echo "<legend class=\"boxlogin\">" . _('admin_jours_fermeture_enregistrees') . "</legend>\n";
        // tableau contenant saisie de date (avec javascript pour afficher les calendriers)
        echo "<table class=\"histo\">\n";
        foreach ($tab_periodes_fermeture as $tab_periode) {
            $date_affiche_1 = eng_date_to_fr($tab_periode['date_deb']);
            $date_affiche_2 = eng_date_to_fr($tab_periode['date_fin']);
            $fermeture_id = $tab_periode['fermeture_id'];
            echo "<tr align=\"center\">\n";
            echo "<td>\n";
            echo _('divers_du') . " <b>{$date_affiche_1}</b> " . _('divers_au') . " <b>{$date_affiche_2}</b>  (id {$fermeture_id})\n";
            echo "</td>\n";
            echo "<td>\n";
            echo "<a href=\"{$PHP_SELF}?session={$session}&choix_action=annul_fermeture&fermeture_id={$fermeture_id}&fermeture_date_debut={$date_affiche_1}&fermeture_date_fin={$date_affiche_2}\">" . _('admin_annuler_fermeture') . "</a>\n";
            echo "</td>\n";
            echo "</tr>\n";
        }
        echo "</table>\n";
        echo "</fieldset>\n";
        echo "</td>\n";
        echo "</tr>\n";
        echo "</table>\n";
    }
    /************************************************/
    // CALENDRIER DES FERMETURES
    echo "<br><br>\n";
    affiche_calendrier_fermeture($year, $tab_year, $DEBUG);
}
Beispiel #13
0
 public static function saisie_groupe_fermeture()
 {
     $PHP_SELF = $_SERVER['PHP_SELF'];
     $session = session_id();
     $return = '';
     $return .= '<div class="row">';
     $return .= '<div class="col-md-6">';
     /********************/
     /* Choix Tous       */
     /********************/
     // AFFICHAGE TABLEAU
     $return .= '<form action="' . $PHP_SELF . '?session=' . $session . '" method="POST">';
     $return .= '<input type="hidden" name="groupe_id" value="0">';
     $return .= '<input type="hidden" name="choix_action" value="saisie_dates">';
     $return .= '<input class="btn btn-success" type="submit" value="' . _('admin_jours_fermeture_fermeture_pour_tous') . ' !">';
     $return .= '</form>';
     $return .= '</div>';
     if ($_SESSION['config']['gestion_groupes'] && $_SESSION['config']['fermeture_par_groupe']) {
         /********************/
         /* Choix Groupe     */
         /********************/
         // Récuperation des informations :
         $sql_gr = "SELECT g_gid, g_groupename, g_comment FROM conges_groupe ORDER BY g_groupename";
         // AFFICHAGE TABLEAU
         $return .= '<div class="col-md-6">';
         $return .= '<form action="' . $PHP_SELF . '?session=' . $session . '" class="form-inline" method="POST">';
         $return .= '<div class="form-group" style="margin-right: 10px;">';
         $ReqLog_gr = \includes\SQL::query($sql_gr);
         $return .= '<select class="form-control" name="groupe_id">';
         while ($resultat_gr = $ReqLog_gr->fetch_array()) {
             $sql_gid = $resultat_gr["g_gid"];
             $sql_group = $resultat_gr["g_groupename"];
             $sql_comment = $resultat_gr["g_comment"];
             $return .= '<option value="' . $sql_gid . '">' . $sql_group;
         }
         $return .= '</select>';
         $return .= '<input type="hidden" name="choix_action" value="saisie_dates">';
         $return .= '</div>';
         $return .= '<input class="btn btn-success" type="submit" value="' . _('admin_jours_fermeture_fermeture_par_groupe') . '">';
         $return .= '</form>';
         $return .= '</div>';
     }
     /************************************************/
     // HISTORIQUE DES FERMETURES
     $tab_periodes_fermeture = array();
     \hr\Fonctions::get_tableau_periodes_fermeture($tab_periodes_fermeture);
     if (count($tab_periodes_fermeture) != 0) {
         $return .= '<table class="table">';
         $return .= '<thead>';
         $return .= '<tr>';
         $return .= '<th colspan="2">Fermetures</th>';
         $return .= '</tr>';
         $return .= '</thead>';
         foreach ($tab_periodes_fermeture as $tab_periode) {
             $date_affiche_1 = eng_date_to_fr($tab_periode['date_deb']);
             $date_affiche_2 = eng_date_to_fr($tab_periode['date_fin']);
             $fermeture_id = $tab_periode['fermeture_id'];
             $groupe_id = $tab_periode['groupe_id'];
             $groupe_name = $tab_periode['groupe_name'];
             if ($groupe_id == 0) {
                 $groupe_name = 'Tous';
             } else {
                 $groupe_name = $groupe_name;
             }
             $return .= '<tr>';
             $return .= '<td>';
             $return .= _('divers_du') . ' <b>' . $date_affiche_1 . '</b> ' . _('divers_au') . ' <b>' . $date_affiche_2 . '</b>  (id ' . $fermeture_id . ')</b> ' . $groupe_name;
             $return .= '</td>';
             $return .= '<td>';
             $return .= '<a href="' . $PHP_SELF . '?session=' . $session . '&choix_action=annul_fermeture&fermeture_id=' . $fermeture_id . '&groupe_id=' . $groupe_id . '&fermeture_date_debut=' . $date_affiche_1 . '&fermeture_date_fin=' . $date_affiche_2 . '">' . _('admin_annuler_fermeture') . '</a>';
             $return .= '</td>';
             $return .= '</tr>';
         }
         $return .= '</table>';
     }
     $return .= '</div>';
     $return .= '<hr>';
     $return .= '<a class="btn" href="/admin/admin_index.php?session=' . $session . '">' . _('form_cancel') . '</a>';
     return $return;
 }
function confirmer($p_num, $onglet, $DEBUG=FALSE)
{

	$PHP_SELF=$_SERVER['PHP_SELF'];
	$session=session_id();


	// Récupération des informations
	$sql1 = 'SELECT p_login, p_date_deb, p_demi_jour_deb, p_date_fin, p_demi_jour_fin, p_nb_jours, p_commentaire, p_etat, p_num FROM conges_periode where p_num = \''.SQL::quote($p_num).'\'';
	$ReqLog1 = SQL::query($sql1) ;

	// AFFICHAGE TABLEAU

	echo "<form action=\"$PHP_SELF\" method=\"POST\">\n" ;
	echo "<table cellpadding=\"2\" class=\"tablo\" width=\"80%\">\n" ;
	echo '<thead>';
	// affichage première ligne : titres
	echo "<tr align=\"center\">\n";
	echo "<td>". _('divers_debut_maj_1') ."</td>\n";
	echo "<td>". _('divers_fin_maj_1') ."</td>\n";
	echo "<td>". _('divers_nb_jours_maj_1') ."</td>\n";
	echo "<td>". _('divers_comment_maj_1') ."</td>\n";
	echo "</tr>\n" ;
	echo '</thead>';
	echo '<tbody>';
	// affichage 2ieme ligne : valeurs actuelles
	echo "<tr align=\"center\">\n" ;
	while ($resultat1 = $ReqLog1->fetch_array())
	{
		$sql_date_deb=eng_date_to_fr($resultat1["p_date_deb"]);
		$sql_demi_jour_deb = $resultat1["p_demi_jour_deb"];
		if($sql_demi_jour_deb=="am")
			$demi_j_deb= _('divers_am_short') ;
		else
			$demi_j_deb= _('divers_pm_short') ;
		$sql_date_fin=eng_date_to_fr($resultat1["p_date_fin"]);
		$sql_demi_jour_fin = $resultat1["p_demi_jour_fin"];
		if($sql_demi_jour_fin=="am")
			$demi_j_fin= _('divers_am_short') ;
		else
			$demi_j_fin= _('divers_pm_short') ;
		$sql_nb_jours=$resultat1["p_nb_jours"];
		$aff_nb_jours=affiche_decimal($sql_nb_jours);
		$sql_commentaire=$resultat1["p_commentaire"];
		$sql_etat=$resultat1["p_etat"];

		echo "<td>$sql_date_deb _ $demi_j_deb</td><td>$sql_date_fin _ $demi_j_fin</td><td>$aff_nb_jours</td><td>$sql_commentaire</td>\n" ;

		$text_debut="<input type=\"text\" name=\"new_debut\" size=\"10\" maxlength=\"30\" value=\"$sql_date_deb\">" ;
		if($sql_demi_jour_deb=="am")
		{
			$radio_deb_am="<input type=\"radio\" name=\"new_demi_jour_deb\" value=\"am\" checked>". _('form_am') ;
			$radio_deb_pm="<input type=\"radio\" name=\"new_demi_jour_deb\" value=\"pm\">". _('form_pm') ;
		}
		else
		{
			$radio_deb_am="<input type=\"radio\" name=\"new_demi_jour_deb\" value=\"am\">". _('form_am') ;
			$radio_deb_pm="<input type=\"radio\" name=\"new_demi_jour_deb\" value=\"pm\" checked>". _('form_pm') ;
		}
		$text_fin="<input type=\"text\" name=\"new_fin\" size=\"10\" maxlength=\"30\" value=\"$sql_date_fin\">" ;
		if($sql_demi_jour_fin=="am")
		{
			$radio_fin_am="<input type=\"radio\" name=\"new_demi_jour_fin\" value=\"am\" checked>". _('form_am') ;
			$radio_fin_pm="<input type=\"radio\" name=\"new_demi_jour_fin\" value=\"pm\">". _('form_pm') ;
		}
		else
		{
			$radio_fin_am="<input type=\"radio\" name=\"new_demi_jour_fin\" value=\"am\">". _('form_am') ;
			$radio_fin_pm="<input type=\"radio\" name=\"new_demi_jour_fin\" value=\"pm\" checked>". _('form_pm') ;
		}
		if($_SESSION['config']['disable_saise_champ_nb_jours_pris'])
			$text_nb_jours="<input type=\"text\" name=\"new_nb_jours\" size=\"5\" maxlength=\"30\" value=\"$sql_nb_jours\" style=\"background-color: #D4D4D4; \" readonly=\"readonly\">" ;
		else
			$text_nb_jours="<input type=\"text\" name=\"new_nb_jours\" size=\"5\" maxlength=\"30\" value=\"$sql_nb_jours\">" ;
		
		
		$text_commentaire="<input type=\"text\" name=\"new_comment\" size=\"15\" maxlength=\"30\" value=\"$sql_commentaire\">" ;
	}
	echo "</tr>\n";

	// affichage 3ieme ligne : saisie des nouvelles valeurs
	echo "<tr align=\"center\">\n" ;
	echo "<td>$text_debut<br>$radio_deb_am / $radio_deb_pm</td><td>$text_fin<br>$radio_fin_am / $radio_fin_pm</td><td>$text_nb_jours</td><td>$text_commentaire</td>\n" ;
	echo "</tr>\n" ;

	echo '</tbody>';
	echo "</table><br>\n\n" ;
	echo "<input type=\"hidden\" name=\"p_num_to_update\" value=\"$p_num\">\n" ;
	echo "<input type=\"hidden\" name=\"p_etat\" value=\"$sql_etat\">\n" ;
	echo "<input type=\"hidden\" name=\"session\" value=\"$session\">\n" ;
	echo "<input type=\"hidden\" name=\"onglet\" value=\"$onglet\">\n" ;
	echo "<input type=\"submit\" value=\"". _('form_submit') ."\">\n" ;
	echo "</form>\n" ;

}
function affiche_all_demandes_en_cours($tab_type_conges, $DEBUG = FALSE)
{
    $PHP_SELF = $_SERVER['PHP_SELF'];
    $session = session_id();
    $count1 = 0;
    $count2 = 0;
    $tab_type_all_abs = recup_tableau_tout_types_abs();
    // recup du tableau des types de conges (seulement les conges exceptionnels)
    $tab_type_conges_exceptionnels = array();
    if ($_SESSION['config']['gestion_conges_exceptionnels']) {
        $tab_type_conges_exceptionnels = recup_tableau_types_conges_exceptionnels($DEBUG);
    }
    /*********************************/
    // Récupération des informations
    /*********************************/
    // Récup dans un tableau de tableau des informations de tous les users dont $_SESSION['userlogin'] est responsable sauf lui meme
    $tab_all_users_du_resp = recup_infos_all_users_du_resp($_SESSION['userlogin'], $DEBUG);
    if ($DEBUG) {
        echo "tab_all_users_du_resp :<br>\n";
        print_r($tab_all_users_du_resp);
        echo "<br><br>\n";
    }
    // si tableau des users du resp n'est pas vide
    if (count($tab_all_users_du_resp) != 0) {
        // constitution de la liste (séparé par des virgules) des logins ...
        $list_users_du_resp = "";
        foreach ($tab_all_users_du_resp as $current_login => $tab_current_user) {
            if ($list_users_du_resp == "") {
                $list_users_du_resp = "'{$current_login}'";
            } else {
                $list_users_du_resp = $list_users_du_resp . ", '{$current_login}'";
            }
        }
    }
    // Récup dans un tableau de tableau des informations de tous les users dont $_SESSION['userlogin'] est GRAND responsable
    if ($_SESSION['config']['double_validation_conges']) {
        $tab_all_users_du_grand_resp = recup_infos_all_users_du_grand_resp($_SESSION['userlogin'], $DEBUG);
        // si tableau des users du grand resp n'est pas vide
        if (count($tab_all_users_du_grand_resp) != 0) {
            // constitution de la liste (séparé par des virgules) des logins ...
            $list_users_du_grand_resp = "";
            foreach ($tab_all_users_du_grand_resp as $current_login => $tab_current_user) {
                if ($list_users_du_grand_resp == "") {
                    $list_users_du_grand_resp = "'{$current_login}'";
                } else {
                    $list_users_du_grand_resp = $list_users_du_grand_resp . ", '{$current_login}'";
                }
            }
        }
    }
    /*********************************/
    echo " <form action=\"{$PHP_SELF}?session={$session}&onglet=traitement_demandes\" method=\"POST\"> \n";
    /*********************************/
    /* TABLEAU DES DEMANDES DES USERS DONT ON EST LE RESP */
    /*********************************/
    // si tableau des users du resp n'est pas vide
    if (count($tab_all_users_du_resp) != 0) {
        // Récup des demandes en cours pour les users dont $_SESSION['userlogin'] est responsable :
        $sql1 = "SELECT p_num, p_login, p_date_deb, p_demi_jour_deb, p_date_fin, p_demi_jour_fin, p_nb_jours, p_commentaire, p_type, p_date_demande, p_date_traitement FROM conges_periode ";
        $sql1 = $sql1 . " WHERE p_etat =\"demande\" ";
        if ($_SESSION['config']['responsable_virtuel']) {
            $sql1 = $sql1 . " AND p_login != 'conges' ";
        } else {
            $sql1 = $sql1 . " AND p_login IN ({$list_users_du_resp}) ";
        }
        $sql1 = $sql1 . " ORDER BY p_num";
        $ReqLog1 = SQL::query($sql1);
        $count1 = $ReqLog1->num_rows;
        if ($count1 != 0) {
            // AFFICHAGE TABLEAU DES DEMANDES EN COURS
            echo "<h3>" . _('resp_traite_demandes_titre_tableau_1') . "</h3>\n";
            echo "<table cellpadding=\"2\" class=\"tablo\">\n";
            echo '<thead>';
            echo '<tr>';
            echo '<th>' . _('divers_nom_maj_1') . "<br>" . _('divers_prenom_maj_1') . '</th>';
            echo '<th>' . _('divers_quotite_maj_1') . '</th>';
            echo '<th>' . _('divers_debut_maj_1') . '</th>';
            echo '<th>' . _('divers_fin_maj_1') . '</th>';
            echo '<th>' . _('divers_comment_maj_1') . '</th>';
            echo '<th>' . _('resp_traite_demandes_nb_jours') . '</th>';
            foreach ($tab_type_conges as $id_conges => $libelle) {
                echo '<th>' . _('divers_solde_maj_1') . "<br>{$libelle}</th>";
            }
            if ($_SESSION['config']['gestion_conges_exceptionnels']) {
                foreach ($tab_type_conges_exceptionnels as $id_conges => $libelle) {
                    echo '<th>' . _('divers_solde_maj_1') . "<br>{$libelle}</th>";
                }
            }
            echo '<th>' . _('divers_type_maj_1') . '</th>';
            echo '<th>' . _('divers_accepter_maj_1') . '</th>';
            echo '<th>' . _('divers_refuser_maj_1') . '</th>';
            echo '<th>' . _('resp_traite_demandes_attente') . '</th>';
            echo '<th>' . _('resp_traite_demandes_motif_refus') . '</th>';
            if ($_SESSION['config']['affiche_date_traitement']) {
                echo '<th>' . _('divers_date_traitement') . '</th>';
            }
            echo '</tr>';
            echo '</thead>';
            echo '<tbody>';
            $i = true;
            $tab_bt_radio = array();
            while ($resultat1 = $ReqLog1->fetch_array()) {
                /** sur la ligne ,   **/
                /** le 1er bouton radio est <input type="radio" name="tab_bt_radio[valeur de p_num]" value="[valeur de p_login]--[valeur p_nb_jours]--$type--OK"> */
                /**  et le 2ieme est <input type="radio" name="tab_bt_radio[valeur de p_num]" value="[valeur de p_login]--[valeur p_nb_jours]--$type--not_OK"> */
                /**  et le 3ieme est <input type="radio" name="tab_bt_radio[valeur de p_num]" value="[valeur de p_login]--[valeur p_nb_jours]--$type--RIEN"> */
                $sql_p_date_deb = $resultat1["p_date_deb"];
                $sql_p_date_fin = $resultat1["p_date_fin"];
                $sql_p_date_deb_fr = eng_date_to_fr($resultat1["p_date_deb"]);
                $sql_p_date_fin_fr = eng_date_to_fr($resultat1["p_date_fin"]);
                $sql_p_demi_jour_deb = $resultat1["p_demi_jour_deb"];
                $sql_p_demi_jour_fin = $resultat1["p_demi_jour_fin"];
                $sql_p_commentaire = $resultat1["p_commentaire"];
                $sql_p_num = $resultat1["p_num"];
                $sql_p_login = $resultat1["p_login"];
                $sql_p_nb_jours = affiche_decimal($resultat1["p_nb_jours"]);
                $sql_p_type = $resultat1["p_type"];
                $sql_p_date_demande = $resultat1["p_date_demande"];
                $sql_p_date_traitement = $resultat1["p_date_traitement"];
                if ($sql_p_demi_jour_deb == "am") {
                    $demi_j_deb = "mat";
                } else {
                    $demi_j_deb = "aprm";
                }
                if ($sql_p_demi_jour_fin == "am") {
                    $demi_j_fin = "mat";
                } else {
                    $demi_j_fin = "aprm";
                }
                // on construit la chaine qui servira de valeur à passer dans les boutons-radio
                $chaine_bouton_radio = "{$sql_p_login}--{$sql_p_nb_jours}--{$sql_p_type}--{$sql_p_date_deb}--{$sql_p_demi_jour_deb}--{$sql_p_date_fin}--{$sql_p_demi_jour_fin}";
                // si le user fait l'objet d'une double validation on a pas le meme resultat sur le bouton !
                if ($tab_all_users_du_resp[$sql_p_login]['double_valid'] == "Y") {
                    // si on est a la fois resp et grand resp
                    if (count($tab_all_users_du_grand_resp) != 0 && array_key_exists($sql_p_login, $tab_all_users_du_grand_resp)) {
                        $boutonradio1 = "<input type=\"radio\" name=\"tab_bt_radio[{$sql_p_num}]\" value=\"{$chaine_bouton_radio}--OK\">";
                    } else {
                        //on est QUe resp
                        $boutonradio1 = "<input type=\"radio\" name=\"tab_bt_radio[{$sql_p_num}]\" value=\"{$chaine_bouton_radio}--VALID\">";
                    }
                } else {
                    $boutonradio1 = "<input type=\"radio\" name=\"tab_bt_radio[{$sql_p_num}]\" value=\"{$chaine_bouton_radio}--OK\">";
                }
                $boutonradio2 = "<input type=\"radio\" name=\"tab_bt_radio[{$sql_p_num}]\" value=\"{$chaine_bouton_radio}--not_OK\">";
                $boutonradio3 = "<input type=\"radio\" name=\"tab_bt_radio[{$sql_p_num}]\" value=\"{$chaine_bouton_radio}--RIEN\" checked>";
                $text_refus = "<input type=\"text\" name=\"tab_text_refus[{$sql_p_num}]\" size=\"20\" max=\"100\">";
                echo '<tr class="' . ($i ? 'i' : 'p') . '">';
                echo "<td><b>" . $tab_all_users_du_resp[$sql_p_login]['nom'] . "</b><br>" . $tab_all_users_du_resp[$sql_p_login]['prenom'] . "</td><td>" . $tab_all_users_du_resp[$sql_p_login]['quotite'] . "%</td>";
                echo "<td>{$sql_p_date_deb_fr} _ {$demi_j_deb}</td><td>{$sql_p_date_fin_fr} _ {$demi_j_fin}</td><td>{$sql_p_commentaire}</td><td><b>{$sql_p_nb_jours}</b></td>";
                $tab_conges = $tab_all_users_du_resp[$sql_p_login]['conges'];
                foreach ($tab_type_conges as $id_conges => $libelle) {
                    echo '<td>' . $tab_conges[$libelle]['solde'] . '</td>';
                }
                if ($_SESSION['config']['gestion_conges_exceptionnels']) {
                    foreach ($tab_type_conges_exceptionnels as $id_conges => $libelle) {
                        echo '<td>' . $tab_conges[$libelle]['solde'] . '</td>';
                    }
                }
                echo '<td>' . $tab_type_all_abs[$sql_p_type]['libelle'] . '</td>';
                echo "<td>{$boutonradio1}</td><td>{$boutonradio2}</td><td>{$boutonradio3}</td><td>{$text_refus}</td>\n";
                if ($_SESSION['config']['affiche_date_traitement']) {
                    echo "<td class=\"histo-left\">" . _('divers_demande') . " : {$sql_p_date_demande}<br>" . _('divers_traitement') . " : {$sql_p_date_traitement}</td>\n";
                }
                echo '</tr>';
                $i = !$i;
            }
            // while
            echo '</tbody>';
            echo '</table>';
        }
        //if($count1!=0)
    }
    //if( count($tab_all_users_du_resp)!=0 )
    /*********************************/
    /* TABLEAU DES DEMANDES DES USERS DONT ON EST LE GRAND RESP */
    /*********************************/
    if ($_SESSION['config']['double_validation_conges']) {
        // si tableau des users du grand resp n'est pas vide
        if (count($tab_all_users_du_grand_resp) != 0) {
            // Récup des demandes en cours pour les users dont $_SESSION['userlogin'] est GRAND responsable :
            $sql2 = "SELECT p_num, p_login, p_date_deb, p_demi_jour_deb, p_date_fin, p_demi_jour_fin, p_nb_jours, p_commentaire, p_type, p_date_demande, p_date_traitement FROM conges_periode ";
            $sql2 = $sql2 . " WHERE p_etat =\"valid\" ";
            $sql2 = $sql2 . " AND p_login IN ({$list_users_du_grand_resp}) ";
            $sql2 = $sql2 . " ORDER BY p_num";
            $ReqLog2 = SQL::query($sql2);
            $count2 = $ReqLog2->num_rows;
            if ($count2 != 0) {
                // AFFICHAGE TABLEAU DES DEMANDES EN COURS POUR DEUXIEME VALIDATION
                echo "<h3>" . _('resp_traite_demandes_titre_tableau_2') . "</h3>\n";
                echo "<table cellpadding=\"2\" class=\"tablo\">\n";
                echo '<thead>';
                echo '<tr>';
                echo "<th><b>" . _('divers_nom_maj_1') . "</b><br>" . _('divers_prenom_maj_1') . '</th>';
                echo '<th>' . _('divers_quotite_maj_1') . '</th>';
                echo '<th>' . _('divers_debut_maj_1') . '</th>';
                echo '<th>' . _('divers_fin_maj_1') . '</th>';
                echo '<th>' . _('divers_comment_maj_1') . '</th>';
                echo '<th>' . _('resp_traite_demandes_nb_jours') . '</th>';
                foreach ($tab_type_conges as $id_conges => $libelle) {
                    echo '<th>' . _('divers_solde_maj_1') . "<br>{$libelle}</th>";
                }
                echo '<th>' . _('divers_type_maj_1') . '</th>';
                echo '<th>' . _('divers_accepter_maj_1') . '</th>';
                echo '<th>' . _('divers_refuser_maj_1') . '</th>';
                echo '<th>' . _('resp_traite_demandes_attente') . '</th>';
                echo '<th>' . _('resp_traite_demandes_motif_refus') . '</th>';
                if ($_SESSION['config']['affiche_date_traitement']) {
                    echo '<th>' . _('divers_date_traitement') . '</th>';
                }
                echo '</tr>';
                echo '</thead>';
                echo '<tbody>';
                $tab_bt_radio = array();
                $i = true;
                while ($resultat2 = $ReqLog2->fetch_array()) {
                    /** sur la ligne ,   **/
                    /** le 1er bouton radio est <input type="radio" name="tab_bt_radio[valeur de p_num]" value="[valeur de p_login]--[valeur p_nb_jours]--$type--OK"> */
                    /**  et le 2ieme est <input type="radio" name="tab_bt_radio[valeur de p_num]" value="[valeur de p_login]--[valeur p_nb_jours]--$type--not_OK"> */
                    /**  et le 3ieme est <input type="radio" name="tab_bt_radio[valeur de p_num]" value="[valeur de p_login]--[valeur p_nb_jours]--$type--RIEN"> */
                    $sql_p_date_deb = $resultat2["p_date_deb"];
                    $sql_p_date_fin = $resultat2["p_date_fin"];
                    $sql_p_date_deb_fr = eng_date_to_fr($resultat2["p_date_deb"]);
                    $sql_p_date_fin_fr = eng_date_to_fr($resultat2["p_date_fin"]);
                    $sql_p_demi_jour_deb = $resultat2["p_demi_jour_deb"];
                    $sql_p_demi_jour_fin = $resultat2["p_demi_jour_fin"];
                    $sql_p_commentaire = $resultat2["p_commentaire"];
                    $sql_p_num = $resultat2["p_num"];
                    $sql_p_login = $resultat2["p_login"];
                    $sql_p_nb_jours = affiche_decimal($resultat2["p_nb_jours"]);
                    $sql_p_type = $resultat2["p_type"];
                    $sql_p_date_demande = $resultat2["p_date_demande"];
                    $sql_p_date_traitement = $resultat2["p_date_traitement"];
                    if ($sql_p_demi_jour_deb == "am") {
                        $demi_j_deb = "mat";
                    } else {
                        $demi_j_deb = "aprm";
                    }
                    if ($sql_p_demi_jour_fin == "am") {
                        $demi_j_fin = "mat";
                    } else {
                        $demi_j_fin = "aprm";
                    }
                    // on construit la chaine qui servira de valeur à passer dans les boutons-radio
                    $chaine_bouton_radio = "{$sql_p_login}--{$sql_p_nb_jours}--{$sql_p_type}--{$sql_p_date_deb}--{$sql_p_demi_jour_deb}--{$sql_p_date_fin}--{$sql_p_demi_jour_fin}";
                    $boutonradio1 = "<input type=\"radio\" name=\"tab_bt_radio[{$sql_p_num}]\" value=\"{$chaine_bouton_radio}--OK\">";
                    $boutonradio2 = "<input type=\"radio\" name=\"tab_bt_radio[{$sql_p_num}]\" value=\"{$chaine_bouton_radio}--not_OK\">";
                    $boutonradio3 = "<input type=\"radio\" name=\"tab_bt_radio[{$sql_p_num}]\" value=\"{$chaine_bouton_radio}--RIEN\" checked>";
                    $text_refus = "<input type=\"text\" name=\"tab_text_refus[{$sql_p_num}]\" size=\"20\" max=\"100\">";
                    echo '<tr class="' . ($i ? 'i' : 'p') . '">';
                    echo "<td><b>" . $tab_all_users_du_grand_resp[$sql_p_login]['nom'] . "</b><br>" . $tab_all_users_du_grand_resp[$sql_p_login]['prenom'] . "</td><td>" . $tab_all_users_du_grand_resp[$sql_p_login]['quotite'] . "%</td>";
                    echo "<td>{$sql_p_date_deb_fr} _ {$demi_j_deb}</td><td>{$sql_p_date_fin_fr} _ {$demi_j_fin}</td><td>{$sql_p_commentaire}</td><td><b>{$sql_p_nb_jours}</b></td>";
                    $tab_conges = $tab_all_users_du_grand_resp[$sql_p_login]['conges'];
                    foreach ($tab_type_conges as $id_conges => $libelle) {
                        echo '<td>' . $tab_conges[$libelle]['solde'] . '</td>';
                    }
                    echo '<td>' . $tab_type_all_abs[$sql_p_type]['libelle'] . '</td>';
                    echo "<td>{$boutonradio1}</td><td>{$boutonradio2}</td><td>{$boutonradio3}</td><td>{$text_refus}</td>\n";
                    if ($_SESSION['config']['affiche_date_traitement']) {
                        echo "<td class=\"histo-left\">" . _('divers_demande') . " : {$sql_p_date_demande}<br>" . _('divers_traitement') . " : {$sql_p_date_traitement}</td>\n";
                    }
                    echo '</tr>';
                    $i = !$i;
                }
                //while
                echo '</tbody>';
                echo '</table>';
            }
            //if($count2!=0)
        }
        //if( count($tab_all_users_du_grand_resp)!=0 )
    }
    //if($_SESSION['config']['double_validation_conges'])
    echo "<br>\n";
    if ($count1 == 0 && $count2 == 0) {
        echo "<b>" . _('resp_traite_demandes_aucune_demande') . "</b><br><br><br>\n";
    } else {
        echo "<input type=\"submit\" value=\"" . _('form_submit') . "\">\n";
    }
    echo " </form> \n";
}
Beispiel #16
0
 public static function affiche_all_demandes_en_cours($tab_type_conges)
 {
     $PHP_SELF = $_SERVER['PHP_SELF'];
     $session = session_id();
     $count1 = 0;
     $count2 = 0;
     $return = '';
     $tab_type_all_abs = recup_tableau_tout_types_abs();
     // recup du tableau des types de conges (seulement les conges exceptionnels)
     $tab_type_conges_exceptionnels = array();
     if ($_SESSION['config']['gestion_conges_exceptionnels']) {
         $tab_type_conges_exceptionnels = recup_tableau_types_conges_exceptionnels();
     }
     /*********************************/
     // Récupération des informations
     /*********************************/
     // Récup dans un tableau de tableau des informations de tous les users dont $_SESSION['userlogin'] est responsable
     $tab_all_users_du_resp = recup_infos_all_users_du_resp($_SESSION['userlogin']);
     // si tableau des users du resp n'est pas vide
     if (count($tab_all_users_du_resp) != 0) {
         // constitution de la liste (séparé par des virgules) des logins ...
         $list_users_du_resp = "";
         foreach ($tab_all_users_du_resp as $current_login => $tab_current_user) {
             if ($list_users_du_resp == "") {
                 $list_users_du_resp = "'{$current_login}'";
             } else {
                 $list_users_du_resp = $list_users_du_resp . ", '{$current_login}'";
             }
         }
     }
     // Récup dans un tableau de tableau des informations de tous les users dont $_SESSION['userlogin'] est GRAND responsable
     if ($_SESSION['config']['double_validation_conges']) {
         $tab_all_users_du_grand_resp = recup_infos_all_users_du_grand_resp($_SESSION['userlogin']);
         // si tableau des users du grand resp n'est pas vide
         if (count($tab_all_users_du_grand_resp) != 0) {
             // constitution de la liste (séparé par des virgules) des logins ...
             $list_users_du_grand_resp = "";
             foreach ($tab_all_users_du_grand_resp as $current_login => $tab_current_user) {
                 if ($list_users_du_grand_resp == "") {
                     $list_users_du_grand_resp = "'{$current_login}'";
                 } else {
                     $list_users_du_grand_resp = $list_users_du_grand_resp . ", '{$current_login}'";
                 }
             }
         }
     }
     /*********************************/
     $return .= '<form action="' . $PHP_SELF . '?session=' . $session . '&onglet=traitement_demandes" method="POST">';
     /*********************************/
     /* TABLEAU DES DEMANDES DES USERS DONT ON EST LE RESP */
     /*********************************/
     // si tableau des users du resp n'est pas vide
     if (count($tab_all_users_du_resp) != 0) {
         // Récup des demandes en cours pour les users dont $_SESSION['userlogin'] est responsable :
         $sql1 = "SELECT p_num, p_login, p_date_deb, p_demi_jour_deb, p_date_fin, p_demi_jour_fin, p_nb_jours, p_commentaire, p_type, p_date_demande, p_date_traitement FROM conges_periode ";
         $sql1 = $sql1 . " WHERE p_etat =\"demande\" ";
         $sql1 = $sql1 . " AND p_login IN ({$list_users_du_resp})  ";
         $sql1 = $sql1 . " ORDER BY p_num";
         $ReqLog1 = \includes\SQL::query($sql1);
         $count1 = $ReqLog1->num_rows;
         if ($count1 != 0) {
             // AFFICHAGE TABLEAU DES DEMANDES EN COURS
             $return .= '<h3>' . _('resp_traite_demandes_titre_tableau_1') . '</h3>';
             $return .= '<table cellpadding="2" class="table table-hover table-responsive table-condensed table-striped">';
             $return .= '<thead>';
             $return .= '<tr>';
             $return .= '<th>' . _('divers_nom_maj_1') . '<br>' . _('divers_prenom_maj_1') . '</th>';
             $return .= '<th>' . _('divers_quotite_maj_1') . '</th>';
             $return .= '<th>' . _('divers_type_maj_1') . '</th>';
             $return .= '<th>' . _('divers_debut_maj_1') . '</th>';
             $return .= '<th>' . _('divers_fin_maj_1') . '</th>';
             $return .= '<th>' . _('divers_comment_maj_1') . '</th>';
             $return .= '<th>' . _('resp_traite_demandes_nb_jours') . '</th>';
             // foreach($tab_type_conges as $id_conges => $libelle)
             // {
             // 	echo "<th>". _('divers_solde_maj_1') ."<br>$libelle</th>" ;
             // }
             // if ($_SESSION['config']['gestion_conges_exceptionnels'])
             // foreach($tab_type_conges_exceptionnels as $id_conges => $libelle)
             // {
             // 	echo "<th>". _('divers_solde_maj_1') ."<br>$libelle</th>" ;
             // }
             $return .= '<th>' . _('divers_solde') . '</th>';
             $return .= '<th>' . _('divers_accepter_maj_1') . '</th>';
             $return .= '<th>' . _('divers_refuser_maj_1') . '</th>';
             $return .= '<th>' . _('resp_traite_demandes_attente') . '</th>';
             $return .= '<th>' . _('resp_traite_demandes_motif_refus') . '</th>';
             if ($_SESSION['config']['affiche_date_traitement']) {
                 $return .= '<th>' . _('divers_date_traitement') . '</th>';
             }
             $return .= '</tr>';
             $return .= '</thead>';
             $return .= '<tbody>';
             $i = true;
             $tab_bt_radio = array();
             while ($resultat1 = $ReqLog1->fetch_array()) {
                 /** sur la ligne ,   **/
                 /** le 1er bouton radio est <input type="radio" name="tab_bt_radio[valeur de p_num]" value="[valeur de p_login]--[valeur p_nb_jours]--$type--OK"> */
                 /**  et le 2ieme est <input type="radio" name="tab_bt_radio[valeur de p_num]" value="[valeur de p_login]--[valeur p_nb_jours]--$type--not_OK"> */
                 /**  et le 3ieme est <input type="radio" name="tab_bt_radio[valeur de p_num]" value="[valeur de p_login]--[valeur p_nb_jours]--$type--RIEN"> */
                 $sql_p_date_deb = $resultat1["p_date_deb"];
                 $sql_p_date_deb_fr = eng_date_to_fr($resultat1["p_date_deb"]);
                 $sql_p_demi_jour_deb = $resultat1["p_demi_jour_deb"];
                 if ($sql_p_demi_jour_deb == "am") {
                     $demi_j_deb = "matin";
                 } else {
                     $demi_j_deb = "après-midi";
                 }
                 $sql_p_date_fin = $resultat1["p_date_fin"];
                 $sql_p_date_fin_fr = eng_date_to_fr($resultat1["p_date_fin"]);
                 $sql_p_demi_jour_fin = $resultat1["p_demi_jour_fin"];
                 if ($sql_p_demi_jour_fin == "am") {
                     $demi_j_fin = "matin";
                 } else {
                     $demi_j_fin = "après-midi";
                 }
                 $sql_p_commentaire = $resultat1["p_commentaire"];
                 $sql_p_num = $resultat1["p_num"];
                 $sql_p_login = $resultat1["p_login"];
                 $sql_p_nb_jours = affiche_decimal($resultat1["p_nb_jours"]);
                 $sql_p_type = $resultat1["p_type"];
                 $sql_p_date_demande = $resultat1["p_date_demande"];
                 $sql_p_date_traitement = $resultat1["p_date_traitement"];
                 // on construit la chaine qui servira de valeur à passer dans les boutons-radio
                 $chaine_bouton_radio = "{$sql_p_login}--{$sql_p_nb_jours}--{$sql_p_type}--{$sql_p_date_deb}--{$sql_p_demi_jour_deb}--{$sql_p_date_fin}--{$sql_p_demi_jour_fin}";
                 // si le user fait l'objet d'une double validation on a pas le meme resultat sur le bouton !
                 if ($tab_all_users_du_resp[$sql_p_login]['double_valid'] == "Y") {
                     // si on est a la fois resp et grand resp
                     if (count($tab_all_users_du_grand_resp) != 0 && array_key_exists($sql_p_login, $tab_all_users_du_grand_resp)) {
                         $boutonradio1 = "<input type=\"radio\" name=\"tab_bt_radio[{$sql_p_num}]\" value=\"{$chaine_bouton_radio}--OK\">";
                     } else {
                         //on est QUe resp
                         $boutonradio1 = "<input type=\"radio\" name=\"tab_bt_radio[{$sql_p_num}]\" value=\"{$chaine_bouton_radio}--VALID\">";
                     }
                 } else {
                     $boutonradio1 = "<input type=\"radio\" name=\"tab_bt_radio[{$sql_p_num}]\" value=\"{$chaine_bouton_radio}--OK\">";
                 }
                 $boutonradio2 = "<input type=\"radio\" name=\"tab_bt_radio[{$sql_p_num}]\" value=\"{$chaine_bouton_radio}--not_OK\">";
                 $boutonradio3 = "<input type=\"radio\" name=\"tab_bt_radio[{$sql_p_num}]\" value=\"{$chaine_bouton_radio}--RIEN\" checked>";
                 $text_refus = "<input class=\"form-control\" type=\"text\" name=\"tab_text_refus[{$sql_p_num}]\" size=\"20\" max=\"100\">";
                 $return .= '<tr class="' . ($i ? 'i' : 'p') . '">';
                 $return .= '<td><b>' . $tab_all_users_du_resp[$sql_p_login]['nom'] . '</b><br>' . $tab_all_users_du_resp[$sql_p_login]['prenom'] . '</td><td>' . $tab_all_users_du_resp[$sql_p_login]['quotite'] . '%</td>';
                 $return .= '<td>' . $tab_type_all_abs[$sql_p_type]['libelle'] . '</td>';
                 $return .= '<td>' . $sql_p_date_deb_fr . '<span class="demi">' . $demi_j_deb . '</span></td><td>' . $sql_p_date_fin_fr . '<span class="demi">' . $demi_j_fin . '</span></td><td>' . $sql_p_commentaire . '</td><td><b>' . $sql_p_nb_jours . '</b></td>';
                 $tab_conges = $tab_all_users_du_resp[$sql_p_login]['conges'];
                 $return .= '<td>' . $tab_conges[$tab_type_all_abs[$sql_p_type]['libelle']]['solde'] . '</td>';
                 // foreach($tab_type_conges as $id_conges => $libelle)
                 // {
                 // 	echo "<td>".$tab_conges[$libelle]['solde']."</td>";
                 // }
                 // if ($_SESSION['config']['gestion_conges_exceptionnels'])
                 // foreach($tab_type_conges_exceptionnels as $id_conges => $libelle)
                 // {
                 // 	echo "<td>".$tab_conges[$libelle]['solde']."</td>";
                 // }
                 // echo "<td>".$tab_type_all_abs[$sql_p_type]['libelle']."</td>\n";
                 $return .= '<td>' . $boutonradio1 . '</td><td>' . $boutonradio2 . '</td><td>' . $boutonradio3 . '</td><td>' . $text_refus . '</td>';
                 if ($_SESSION['config']['affiche_date_traitement']) {
                     if ($sql_p_date_demande == NULL) {
                         $return .= '<td class="histo-left">' . _('divers_demande') . ' : ' . $sql_p_date_demande . '<br>' . _('divers_traitement') . ' : ' . $sql_p_date_traitement . '</td>';
                     } else {
                         $return .= '<td class="histo-left">' . _('divers_demande') . ' : ' . $sql_p_date_demande . '<br>' . _('divers_traitement') . ' : pas traité</td>';
                     }
                 }
                 $return .= '</tr>';
                 $i = !$i;
             }
             // while
             $return .= '</tbody>';
             $return .= '</table>';
         }
         //if($count1!=0)
     }
     //if( count($tab_all_users_du_resp)!=0 )
     /*********************************/
     /* TABLEAU DES DEMANDES DES USERS DONT ON EST LE GRAND RESP */
     /*********************************/
     if ($_SESSION['config']['double_validation_conges']) {
         // si tableau des users du grand resp n'est pas vide
         if (count($tab_all_users_du_grand_resp) != 0) {
             // Récup des demandes en cours pour les users dont $_SESSION['userlogin'] est GRAND responsable :
             $sql2 = "SELECT p_num, p_login, p_date_deb, p_demi_jour_deb, p_date_fin, p_demi_jour_fin, p_nb_jours, p_commentaire, p_type, p_date_demande, p_date_traitement FROM conges_periode ";
             $sql2 = $sql2 . " WHERE p_etat =\"valid\" ";
             $sql2 = $sql2 . " AND p_login IN ({$list_users_du_grand_resp}) ";
             $sql2 = $sql2 . " ORDER BY p_num";
             $ReqLog2 = \includes\SQL::query($sql2);
             $count2 = $ReqLog2->num_rows;
             if ($count2 != 0) {
                 // AFFICHAGE TABLEAU DES DEMANDES EN COURS POUR DEUXIEME VALIDATION
                 $return .= '<h3>' . _('resp_traite_demandes_titre_tableau_2') . '</h3>';
                 $return .= '<table class="table table-hover table-responsive table-condensed table-striped">';
                 $return .= '<thead>';
                 $return .= '<tr>';
                 $return .= '<th><b>' . _('divers_nom_maj_1') . '</b><br>' . _('divers_prenom_maj_1') . '</th>';
                 $return .= '<th>' . _('divers_quotite_maj_1') . '</th>';
                 $return .= '<th>' . _('divers_debut_maj_1') . '</th>';
                 $return .= '<th>' . _('divers_fin_maj_1') . '</th>';
                 $return .= '<th>' . _('divers_comment_maj_1') . '</th>';
                 $return .= '<th>' . _('resp_traite_demandes_nb_jours') . '</th>';
                 foreach ($tab_type_conges as $id_conges => $libelle) {
                     $return .= '<th>' . _('divers_solde_maj_1') . '<br>' . $libelle . '</th>';
                 }
                 $return .= '<th>' . _('divers_type_maj_1') . '</th>';
                 $return .= '<th>' . _('divers_accepter_maj_1') . '</th>';
                 $return .= '<th>' . _('divers_refuser_maj_1') . '</th>';
                 $return .= '<th>' . _('resp_traite_demandes_attente') . '</th>';
                 $return .= '<th>' . _('resp_traite_demandes_motif_refus') . '</th>';
                 if ($_SESSION['config']['affiche_date_traitement']) {
                     $return .= '<th>' . _('divers_date_traitement') . '</th>';
                 }
                 $return .= '</tr>';
                 $return .= '</thead>';
                 $return .= '<tbody>';
                 $i = true;
                 $tab_bt_radio = array();
                 while ($resultat2 = $ReqLog2->fetch_array()) {
                     /** sur la ligne ,   **/
                     /** le 1er bouton radio est <input type="radio" name="tab_bt_radio[valeur de p_num]" value="[valeur de p_login]--[valeur p_nb_jours]--$type--OK"> */
                     /**  et le 2ieme est <input type="radio" name="tab_bt_radio[valeur de p_num]" value="[valeur de p_login]--[valeur p_nb_jours]--$type--not_OK"> */
                     /**  et le 3ieme est <input type="radio" name="tab_bt_radio[valeur de p_num]" value="[valeur de p_login]--[valeur p_nb_jours]--$type--RIEN"> */
                     $sql_p_date_deb = $resultat2["p_date_deb"];
                     $sql_p_date_deb_fr = eng_date_to_fr($resultat2["p_date_deb"]);
                     $sql_p_demi_jour_deb = $resultat2["p_demi_jour_deb"];
                     if ($sql_p_demi_jour_deb == "am") {
                         $demi_j_deb = "matin";
                     } else {
                         $demi_j_deb = "après-midi";
                     }
                     $sql_p_date_fin = $resultat2["p_date_fin"];
                     $sql_p_date_fin_fr = eng_date_to_fr($resultat2["p_date_fin"]);
                     $sql_p_demi_jour_fin = $resultat2["p_demi_jour_fin"];
                     if ($sql_p_demi_jour_fin == "am") {
                         $demi_j_fin = "matin";
                     } else {
                         $demi_j_fin = "après-midi";
                     }
                     $sql_p_commentaire = $resultat2["p_commentaire"];
                     $sql_p_num = $resultat2["p_num"];
                     $sql_p_login = $resultat2["p_login"];
                     $sql_p_nb_jours = affiche_decimal($resultat2["p_nb_jours"]);
                     $sql_p_type = $resultat2["p_type"];
                     $sql_p_date_demande = $resultat2["p_date_demande"];
                     $sql_p_date_traitement = $resultat2["p_date_traitement"];
                     // on construit la chaine qui servira de valeur à passer dans les boutons-radio
                     $chaine_bouton_radio = "{$sql_p_login}--{$sql_p_nb_jours}--{$sql_p_type}--{$sql_p_date_deb}--{$sql_p_demi_jour_deb}--{$sql_p_date_fin}--{$sql_p_demi_jour_fin}";
                     $boutonradio1 = "<input type=\"radio\" name=\"tab_bt_radio[{$sql_p_num}]\" value=\"{$chaine_bouton_radio}--OK\">";
                     $boutonradio2 = "<input type=\"radio\" name=\"tab_bt_radio[{$sql_p_num}]\" value=\"{$chaine_bouton_radio}--not_OK\">";
                     $boutonradio3 = "<input type=\"radio\" name=\"tab_bt_radio[{$sql_p_num}]\" value=\"{$chaine_bouton_radio}--RIEN\" checked>";
                     $text_refus = "<input class=\"form-control\" type=\"text\" name=\"tab_text_refus[{$sql_p_num}]\" size=\"20\" max=\"100\">";
                     $return .= '<tr class="' . ($i ? 'i' : 'p') . '">';
                     $return .= '<td><strong>' . $tab_all_users_du_grand_resp[$sql_p_login]['nom'] . '</strong><br>' . $tab_all_users_du_grand_resp[$sql_p_login]['prenom'] . '</td><td>' . $tab_all_users_du_grand_resp[$sql_p_login]['quotite'] . '%</td>';
                     $return .= '<td>' . $sql_p_date_deb_fr . '<span class="demi">' . $demi_j_deb . '<span></td><td>' . $sql_p_date_fin_fr . '<span class="demi">' . $demi_j_fin . '</span></td><td>' . $sql_p_commentaire . '</td><td><b>' . $sql_p_nb_jours . '</b></td>';
                     $tab_conges = $tab_all_users_du_grand_resp[$sql_p_login]['conges'];
                     foreach ($tab_type_conges as $id_conges => $libelle) {
                         $return .= '<td>' . $tab_conges[$libelle]['solde'] . '</td>';
                     }
                     $return .= '<td>' . $tab_type_all_abs[$sql_p_type]['libelle'] . '</td>';
                     $return .= '<td>' . $boutonradio1 . '</td><td>' . $boutonradio2 . '</td><td>' . $boutonradio3 . '</td><td>' . $text_refus . '</td>';
                     if ($_SESSION['config']['affiche_date_traitement']) {
                         $return .= '<td class="histo-left">' . _('divers_demande') . ' : ' . $sql_p_date_demande . '<br>' . _('divers_traitement') . ' : ' . $sql_p_date_traitement . '</td>';
                     }
                     $return .= '</tr>';
                     $i = !$i;
                 }
                 //while
                 $return .= '</tbody>';
                 $return .= '</table>';
             }
             //if($count2!=0)
         }
         //if( count($tab_all_users_du_grand_resp)!=0 )
     }
     //if($_SESSION['config']['double_validation_conges'])
     $return .= '<br>';
     if ($count1 == 0 && $count2 == 0) {
         $return .= '<strong>' . _('resp_traite_demandes_aucune_demande') . '</strong>';
     } else {
         $return .= '<hr/>';
         $return .= '<input class="btn btn-success" type="submit" value="' . _('form_submit') . '">';
     }
     $return .= '</form>';
     return $return;
 }
function confirm_saisie($tab_checkbox_j_chome, $DEBUG = FALSE)
{
    $PHP_SELF = $_SERVER['PHP_SELF'];
    $session = session_id();
    header_popup();
    echo "<h1>" . _('admin_jours_chomes_titre') . "</h1>\n";
    echo "<form action=\"{$PHP_SELF}?session={$session}\" method=\"POST\">\n";
    echo "<table>\n";
    echo "<tr>\n";
    echo "<td align=\"center\">\n";
    foreach ($tab_checkbox_j_chome as $key => $value) {
        $date_affiche = eng_date_to_fr($key);
        echo "{$date_affiche}<br>\n";
        echo "<input type=\"hidden\" name=\"tab_checkbox_j_chome[{$key}]\" value=\"{$value}\">\n";
    }
    echo "<input type=\"hidden\" name=\"choix_action\" value=\"commit\">\n";
    echo "<input type=\"submit\" value=\"" . _('admin_jours_chomes_confirm') . "\">\n";
    echo "</td>\n";
    echo "</tr>\n";
    echo "<tr>\n";
    echo "<td align=\"center\">\n";
    echo "\t<input type=\"button\" value=\"" . _('form_cancel') . "\" onClick=\"javascript:window.close();\">\n";
    echo "</td>\n";
    echo "</tr>\n";
    echo "</table>\n";
    echo "</form>\n";
    bottom();
}
function confirmer($p_num, $onglet, $DEBUG = FALSE)
{
    $PHP_SELF = $_SERVER['PHP_SELF'];
    $session = session_id();
    // Récupération des informations
    $sql1 = 'SELECT p_login, p_date_deb, p_demi_jour_deb, p_date_fin, p_demi_jour_fin, p_nb_jours, p_commentaire, p_type, p_num FROM conges_periode WHERE p_num = \'' . SQL::quote($p_num) . '\'';
    //printf("sql1 = %s<br>\n", $sql1);
    $ReqLog1 = SQL::query($sql1);
    // AFFICHAGE TABLEAU
    echo "<form action=\"{$PHP_SELF}\" method=\"POST\">\n";
    echo "<table class=\"table table-responsive table-condensed\">\n";
    echo "<thead>\n";
    echo "<tr>\n";
    echo "<th>" . _('divers_debut_maj_1') . "</th>\n";
    echo "<th>" . _('divers_fin_maj_1') . "</th>\n";
    echo "<th>" . _('divers_nb_jours_maj_1') . "</th>\n";
    echo "<th>" . _('divers_comment_maj_1') . "</th>\n";
    echo "<th>" . _('divers_type_maj_1') . "</th>\n";
    echo "</tr>\n";
    echo "</thead>\n";
    echo "<tbody>\n";
    echo "<tr>\n";
    while ($resultat1 = $ReqLog1->fetch_array()) {
        $sql_date_deb = eng_date_to_fr($resultat1["p_date_deb"]);
        $sql_demi_jour_deb = $resultat1["p_demi_jour_deb"];
        if ($sql_demi_jour_deb == "am") {
            $demi_j_deb = _('divers_am_short');
        } else {
            $demi_j_deb = _('divers_pm_short');
        }
        $sql_date_fin = eng_date_to_fr($resultat1["p_date_fin"]);
        $sql_demi_jour_fin = $resultat1["p_demi_jour_fin"];
        if ($sql_demi_jour_fin == "am") {
            $demi_j_fin = _('divers_am_short');
        } else {
            $demi_j_fin = _('divers_pm_short');
        }
        $sql_nb_jours = affiche_decimal($resultat1["p_nb_jours"]);
        //$sql_type=$resultat1["p_type"];
        $sql_type = get_libelle_abs($resultat1["p_type"], $DEBUG);
        $sql_comment = $resultat1["p_commentaire"];
        if ($DEBUG) {
            echo "{$sql_date_deb} _ {$demi_j_deb} : {$sql_date_fin} _ {$demi_j_fin} : {$sql_nb_jours} : {$sql_comment} : {$sql_type}<br>\n";
        }
        echo "<td>{$sql_date_deb} _ {$demi_j_deb}</td>\n";
        echo "<td>{$sql_date_fin} _ {$demi_j_fin}</td>\n";
        echo "<td>{$sql_nb_jours}</td>\n";
        echo "<td>{$sql_comment}</td>\n";
        echo "<td>{$sql_type}</td>\n";
    }
    echo "</tr>\n";
    echo "</tbody>\n";
    echo "</table>\n";
    echo "<hr/>\n";
    echo "<input type=\"hidden\" name=\"p_num_to_delete\" value=\"{$p_num}\">\n";
    echo "<input type=\"hidden\" name=\"session\" value=\"{$session}\">\n";
    echo "<input type=\"hidden\" name=\"onglet\" value=\"{$onglet}\">\n";
    echo "<input class=\"btn btn-danger\" type=\"submit\" value=\"" . _('form_supprim') . "\">\n";
    echo "<a class=\"btn\" href=\"{$PHP_SELF}?session={$session}&onglet=demandes_en_cours\">" . _('form_cancel') . "</a>\n";
    echo "</form>\n";
}