<?php
/****************************************************************************************
 * SMI (Services Maintenance Interventions) est une gestion libre de maintenance et de SAV
 *
 * Version 1.0.2
 *
 * Copyright (C) 2006-2015  Sylvain FATOME
 * This program is free software; you can redistribute it and/or modify it under the terms
 * of the GNU General Public License as published by the Free Software Foundation;
 * either version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program
 * (in the directory docs);
 * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 *
 * Contact : galawa@free.fr
 *
 * Web : http://smi.no-ip.org
 ****************************************************************************************/


// vérification des tentatives de hack
$pos = strpos($_SERVER['PHP_SELF'], "inc.php");
if ($pos === FALSE)
    $ok_inc = TRUE;
else
    $ok_inc = FALSE;
if ($ok_inc == FALSE) header("Location: ../index.php");

include_once("../inc/func.inc.php");
include_once("../inc/func_time.inc.php");
include_once("../inc/func_date.inc.php");
include_once("../inc/func_geo.inc.php");
include_once("../inc/func_txt.inc.php");
include_once("../inc/fic_droits.inc.php");
include_once("../inc/fic_ot.inc.php");
include_once("../inc/fic_tec.inc.php");
include_once("../inc/lst.inc.php");
include_once("../classes/ezSQL/shared/ez_sql_core.php");
include_once("../classes/ezSQL/mysqli/ez_sql_mysqli.php");
include_once("../inc/func_sql.inc.php");
Archivelog(@$_SESSION["code_log"]);

$enr_ok = FALSE;
$pbm_oth = FALSE;
$pbm_enr_oth = FALSE;
$action_to_do = '';$tecr = '';
$td = 'add'; // Le mode par défaut est en ajout
$tdh = 'add'; // Mode $td pour l'historique affiché (si $id <>0)

// Variables Formulaire
fix_magic_quotes();
$_GET = clean_str($_GET);
$_POST = clean_str($_POST);

if (isset($_GET['co']))
    $codeot = @$_GET['co'];
else
    $codeot = @$_POST['co'];

if (isset($_GET['td'])) {
    $td = @$_GET['td'];
    if (($td <> "edit") AND ($td <> "del"))
        $pbm_oth = TRUE;
    else
        $tdh = $td;
}
$id = 0;
if (isset($_GET['id']))
    $id = intval(@$_GET['id']);
else
    $id = intval(@$_POST['id']);

// Récupération des paramètres de SMI
$db = open_database(DBUSER, DBPASS, DBNAME, DBHOST);
$rech = "SELECT * FROM `" . TBPPRM . "`";
$row = $db->get_row($rech, ARRAY_A);
if ($row)
    extract($row);
$db->disconnect();

$url_lst = 'oth_maj.php?co=' . $codeot . '&cc=' . $cc . '&si=' . $si . '&ca=' . $ca . '&tr=' . $tecr;
if ($codeot <> "") {
    $row = lit_enr_ot($codeot);
    if (is_array($row)) {
        $row = encode_str($row);
        extract($row);
    } else
        $pbm_oth = TRUE;

    // Si pas d'enregistrement de détail horaire, on ne peut que ajouter
    if ((nb_oth($codeot) == 0) AND ((@$_SESSION["niv_log"] == 10) OR (@$_SESSION["niv_log"] == 11)  OR (@$_SESSION["niv_log"] == 9)))
        $td = "add";

    // Si intervention close ou si client/donneurs d'ordres, on ne peut que voir
    if (datetolocal($ot_datefin) <> "")
        $td = "view";

    // vérification tentative de hack d'un sous-traitant
    if (((@$_SESSION["niv_log"] == 10) OR (@$_SESSION["niv_log"] == 11)) AND ($ot_codest <> @$_SESSION["code_st"]))
        $pbm_oth = TRUE;
} else
    $pbm_oth = TRUE;

if ($pbm_oth == FALSE) {
    if ($id > 0) {
        $row = lit_enr_oth($id);
        if (is_array($row)) {
            extract($row);
            $oth_heurea = substr($oth_heurea, 0, 5);
            $oth_heured = substr($oth_heured, 0, 5);
            $datef = datetolocal($oth_date);
        }
    }
}

if ($pbm_oth == FALSE) {
    switch ($_POST["nbutton"]) {
        case "enr" :
            $action_to_do = 'add';
            break;
        case "val" :
            $action_to_do = 'valid';
            break;
        case "del" :
            $action_to_do = 'del';
            break;
        default :
            break;
    }

    if ($action_to_do <> '') {
        switch ($action_to_do) {
            case "add" :
            case "valid" :
                $datef = @$_POST["date"];
                if ($datef <> "")
                    $date = datetomysql($datef);
                else
                    $date = "";
                $codetec = @$_POST["codetec"];
                $codelieu = @$_POST["codelieu"];
                $heurea = @$_POST["heurea"];
                $heurea_full = $heurea . ":00";
                $heured = @$_POST["heured"];
                $heured_full = $heured . ":00";
                $offert = 0;
                if (strtolower(@$_POST["offert"]) == "on")
                    $offert = 1;

                if (($date <> "") AND ($codelieu <> "") AND ($codetec <> "") AND ($heurea <> "") AND ($heured <> "")) {
                    if (heure_sec($heured_full) >= heure_sec($heurea_full)) {
                        $codeuser = @$_SESSION["code_log"];

                        $db = open_database(DBUSER, DBPASS, DBNAME, DBHOST);
                        if ($action_to_do == 'add') {
                            $rech = "INSERT INTO `" . TBOTH . "`";
                            $rech .= " (oth_datecrea,oth_codecrea,oth_datemod,oth_codemod,oth_codeot,oth_date,oth_codetec,oth_codelieu,oth_heurea,oth_heured,oth_offert) VALUES";
                            $rech .= " ('$datea','$codeuser','$datea','$codeuser','$codeot','$date','$codetec','$codelieu','$heurea_full','$heured_full','$offert')";
                        } else {
                            if ($id <> 0) {
                                $rech = "UPDATE `" . TBOTH;
                                $rech .= "` SET `oth_datemod`='" . $datea . "',`oth_codemod`='" . $codeuser . "', `oth_date`='" . $date . "', `oth_codetec`='" . $codetec . "', `oth_codelieu`='" . $codelieu . "', `oth_heurea`='" . $heurea_full . "', `oth_heured`='" . $heured_full . "', `oth_offert`='" . $offert . "'  WHERE `oth_id` = '" . $id . "'";
                            }
                        }
                        $db->query($rech);
                        $db->disconnect();
                        $enr_ok = TRUE;
                        $td = "add";
                    } else {
                        $pbm_enr_oth = TRUE;
                        $msg = "Problème sur les heures choisies.";
                    }
                }
                break;
            case "del":
                if ($id <> 0) {
                    $db = open_database(DBUSER, DBPASS, DBNAME, DBHOST);
                    $rech = "DELETE FROM `" . TBOTH . "` WHERE `oth_id` = '$id'";
                    $db->query($rech);
                    $db->disconnect();
                }
                $enr_ok = TRUE;
                $td = "add";
                break;
        }
    }
}

if ($pbm_oth == FALSE) {
    // Récupération du total travaillé & Techniciens traitants
    $nbtotalsec = 0;
    $nbtotalsecoff = 0;
    $str_tec_traitants = "";

    $nbtotalsec = tps_travaille_ot($codeot, TRUE);
    $nbtotalsecoff = tps_offert_ot($codeot, TRUE);
    $str_tec_traitants = str_tec_traitants_ot($codeot, TRUE);
}

switch ($tdh) {
    case "add" :
        $titre = _("Ajout");
        break;
    case "edit" :
        $titre = _("Edition");
        break;
    case "view" :
        $titre = _("Visualisation");
        break;
    case "del" :
        $titre = _("Suppression");
        break;
    default :
        $pbm_oth = TRUE;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>SMI - <?PHP echo _("ESPACE PRIVE"); ?> : <?PHP echo _("Détail Horaire Ordre de Travail"); ?></title>

    <?PHP include_once("../inc/header.inc.php"); ?>

    <script language="javascript">
        <!--
        var tab1_champ = ["nom:date ; format:date ; masque:<?PHP echo $_SESSION['date_fmtfull']; ?> ; req:Y ; txt:<?PHP echo _("Date"); ?> ; stok:frmok ; stbad:frmbad",
            "nom:codetec ; format:liste ; req:Y ; txt:<?PHP echo _("Technicien"); ?> ; vmn:1 ; stok:frmok ; stbad:frmbad",
            "nom:codelieu ; format:liste ; req:Y ; txt:<?PHP echo _("Lieu"); ?> ; vmn:1 ; stok:frmok ; stbad:frmbad",
            "nom:heurea ; format:liste ; req:Y ; txt:<?PHP echo _("Heure de début"); ?> ; vmn:1 ; stok:frmok ; stbad:frmbad",
            "nom:heured ; format:liste ; req:Y ; txt:<?PHP echo _("Heure de fin"); ?> ; vmn:1 ; stok:frmok ; stbad:frmbad"];
        //-->
    </script>

    <script type="text/javascript">
        <!--
        function init_datepicker() {
            $.datepicker.setDefaults({
                closeText: "<?PHP echo _("Fermer"); ?>",
                prevText: "<?PHP echo _("Précédent"); ?>",
                nextText: "<?PHP echo _("Suivant"); ?>",
                currentText: "<?PHP echo _("Aujourd'hui"); ?>",
                monthNames: ["<?PHP echo implode('","',$lng_tmoisf); ?>"],
                monthNamesShort: ["<?PHP echo implode('","',$lng_tmoism); ?>"],
                dayNames: ["<?PHP echo implode('","',$lng_tjourf); ?>"],
                dayNamesShort: ["<?PHP echo implode('","',$lng_tjourm); ?>"],
                dayNamesMin: ["<?PHP echo implode('","',$lng_tjours); ?>"],
                weekHeader: "<?PHP echo _("Sem."); ?>",
                dateFormat: "<?PHP echo $_SESSION['date_fmtshort']; ?>",
                firstDay: 1,
                isRTL: !1,
                changeMonth: true,
                changeYear: true,
                showMonthAfterYear: !1,
                yearSuffix: "",
                showButtonPanel: true,
                showOn: "both",
                buttonImageOnly: true,
                buttonImage: "../img/calendar.png",
                buttonText: "<?PHP echo _("Calendrier"); ?>"
            });
            $("#date").datepicker({
                onSelect: function (datesel) {
                    $("#date").blur();
                    <?PHP
                    if ($regul == FALSE)
                        echo "chk_datedif(datesel,this.id,'".$_SESSION['date_fmtshort']."',true,'dateddef','','',true);";
                    ?>
                }
            });
        }

        function init_all() {
            init_Body();
            init_autohref_classe('falselnkimg','');
            init_datepicker();
            init_maj_tps('<?PHP echo heure_to_hhmm(sec_heure($nbtotalsec,3,TRUE)); ?>', '<?PHP echo heure_to_hhmm(sec_heure($nbtotalsecoff,3,TRUE)); ?>', '<?PHP echo $str_tec_traitants; ?>');
            <?PHP
            if ($enr_ok == TRUE)
                echo "clear_form_elements('oth_maj');";

            switch ($tdh)
            {
                case "add" :
                case "edit" :
                    echo "init_autoraz('razdate','date','click');";
                    echo "init_chk_heuredif('heurea','change',true,'','','heured');";
                    echo "init_chk_heuredif('heured','change',true,'heurea','','');";
                    echo "init_autoraz('razheurea','heurea','click');";
                    echo "init_autoraz('razheured','heured','click');";
                    echo "init_valid_oth('enr','oth_maj',tab1_champ,'','');";
                    echo "init_valid_oth('val','oth_maj',tab1_champ,'','');";
                    break;
                case "view" :
                    echo "readonly_all();";
                    break;
                case "del" :
                    echo "init_valid_oth('del','oth_maj',tab1_champ,'','');";
                    echo "readonly_all();";
                    break;
            }
            ?>
            init_autohref('annul', 'click', '<?PHP echo $url_lst; ?>',false);
            add_func_click('quit', 'sclose', '');
            Focus_first();
        }

        $(document).ready(function () {
            init_all();
        });
        //-->
    </script>

</head>

<body>
<?PHP
if (($pbm_oth == FALSE) AND ($pbm_enr_oth == FALSE)) {
    ?>
    <p align="center"><span class="titrepage"><?PHP echo _("DETAIL HORAIRE"); ?></span></p>
    <p align="center"><span class="titre_gras"><?PHP echo _("Pour l'ordre"); ?> : <?php echo $codeot; ?> </span></p>
    <div align="right">
        <input name="quit" type="button" class="bton_std" id="quit" value="<?PHP echo _("Quitter"); ?>">
    </div>

    <?PHP
    $db = open_database(DBUSER, DBPASS, DBNAME, DBHOST);
    $rech = "SELECT * FROM `" . TBOTH . "` WHERE `oth_codeot`= '" . $codeot . "' ORDER BY oth_date, oth_heurea";

    $rows = $db->get_results($rech, ARRAY_A);

    if ($rows) {

        echo "<table class=\"MtableD\" border=\"0\" width=\"890\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\">\n";

        // création de l'entête de la table "détail intervention"
        echo "<th>";
        echo _("Date");
        echo "</th>\n";
        echo "<th>";
        echo _("Technicien");
        echo "</th>\n";
        echo "<th>";
        echo _("Lieu");
        echo "</th>\n";
        echo "<th>";
        echo _("Heure début");
        echo "</th>\n";
        echo "<th>";
        echo _("Heure fin");
        echo "</th>\n";
        echo "<th>";
        echo _("Temps passé");
        echo "</th>\n";
        echo "<th>";
        echo _("Offert ?");
        echo "</th>\n";
        echo "<th>";
        echo _("Cliquer");
        echo "</th>\n";

        $j = 0;

        foreach ($rows as $row) {
            $row = encode_str($row);
            // création de l'entête de ligne (TR)
            creetrlstdet($j);

            echo "<td align=\"center\">\n";
            echo datetolocal($row["oth_date"]);
            echo "<td>\n";
            echo $row["oth_codetec"];
            // Récupération et affichage détail technicien
            $rech2 = "SELECT * FROM `" . TBTEC . "` WHERE `tec_code`= '" . $row["oth_codetec"] . "'";
            $row2 = $db->get_row($rech2, ARRAY_A);
            if ($row2) {
                $row2 = encode_str($row2);
                extract($row2);
                echo "<br />";
                echo "<span class=\"annot_petit_it\">";
                echo $tec_nom . " " . $tec_prenom;
                echo "</span>";
            } else
                echo "&nbsp;";
            echo "</td>\n";
            echo "</td>\n";
            echo "<td align=\"center\">\n";
            // Récupération et affichage libellé lieu
            $rech2 = "SELECT * FROM `" . TBLIEU . "` WHERE `lieu_code`= '" . $row["oth_codelieu"] . "'";
            $row2 = $db->get_row($rech2, ARRAY_A);
            if ($row2) {
                $row2 = encode_str($row2);
                extract($row2);
                echo $lieu_desc;
            } else
                echo "&nbsp;";
            echo "</td>\n";
            echo "<td align=\"center\">\n";
            echo substr($row["oth_heurea"], 0, 5);
            echo "</td>\n";
            echo "<td align=\"center\">\n";
            echo substr($row["oth_heured"], 0, 5);
            echo "</td>\n";
            echo "<td align=\"center\">\n";
            echo heure_to_hhmm(sec_heure(diff_time_sec($row["oth_heurea"], $row["oth_heured"])));
            echo "</td>\n";
            echo "<td align=\"center\">\n";
            echo $non_oui2[$row["oth_offert"]];
            echo "</td>\n";
            echo "<td align=\"center\">\n";
            if ($td <> "view") {
                $lst_maj = TRUE;
                cre_falselnk_img('', 'oth_edit_'.$row["oth_id"], 'span', 'center', _("Edition"), 'lnk', 'oth_maj.php?td=edit&co=' . $codeot . '&id=' . $row["oth_id"], '../img/edit.png');
                $lst_del = TRUE;
                cre_falselnk_img('', 'oth_del_'.$row["oth_id"], 'span', 'center', _("Suppression"), 'lnk', 'oth_maj.php?td=del&co=' . $codeot . '&id=' . $row["oth_id"], '../img/edit.png');
            } else
                echo "-";
            echo "</td>\n";

            echo "</tr>\n";

            $j++;
        }

        /* Totaux */

        // Total Général

        // création de l'entête de ligne (TR)
        creetrlstdet($j);

        echo "<td>";
        echo "&nbsp;";
        echo "</td>\n";
        echo "<td>";
        echo "&nbsp;";
        echo "</td>\n";
        echo "<td>";
        echo "&nbsp;";
        echo "</td>\n";
        echo "<td>";
        echo "&nbsp;";
        echo "</td>\n";
        echo "<td align=\"right\">";
        echo "<span class=\"annot_std_gras\">";
        echo _("Temps total ") . " : ";
        echo "</span>";
        echo "</td>\n";
        echo "<td align=\"center\">";
        echo "<span class=\"annot_std_gras\">";
        echo heure_to_hhmm(sec_heure($nbtotalsec, 3, TRUE));
        echo "</span>";
        echo "</td>\n";
        echo "<td>";
        echo "&nbsp;";
        echo "</td>\n";
        echo "<td>";
        echo "&nbsp;";
        echo "</td>\n";

        // Temps offert

        // création de l'entête de ligne (TR)
        $j++;
        creetrlstdet($j);

        echo "<td>";
        echo "&nbsp;";
        echo "</td>\n";
        echo "<td>";
        echo "&nbsp;";
        echo "</td>\n";
        echo "<td>";
        echo "&nbsp;";
        echo "</td>\n";
        echo "<td>";
        echo "&nbsp;";
        echo "</td>\n";
        echo "<td align=\"right\">";
        echo "<span class=\"annot_std_gras\">";
        echo _("Temps offert") . " : ";
        echo "</span>";
        echo "</td>\n";
        echo "<td align=\"center\">";
        if ($nbtotalsecoff <> 0) {
            echo "<span class=\"annot_std_gras\">";
            echo heure_to_hhmm(sec_heure($nbtotalsecoff, 3, TRUE));
            echo "</span>";
        } else
            echo "-";
        echo "</td>\n";
        echo "<td>";
        echo "&nbsp;";
        echo "</td>\n";
        echo "<td>";
        echo "&nbsp;";
        echo "</td>\n";

        // Temps retenu

        // création de l'entête de ligne (TR)
        $j++;
        creetrlstdet($j);

        echo "<td>";
        echo "&nbsp;";
        echo "</td>\n";
        echo "<td>";
        echo "&nbsp;";
        echo "</td>\n";
        echo "<td>";
        echo "&nbsp;";
        echo "</td>\n";
        echo "<td>";
        echo "&nbsp;";
        echo "</td>\n";
        echo "<td align=\"right\">";
        echo "<span class=\"annot_std_gras\">";
        echo _("Temps retenu") . " : ";
        echo "</span>";
        echo "</td>\n";
        echo "<td align=\"center\">";
        echo "<span class=\"annot_std_gras\">";
        echo heure_to_hhmm(sec_heure($nbtotalsec - $nbtotalsecoff, 3, TRUE));
        echo "</span>";
        echo "</td>\n";
        echo "<td>";
        echo "&nbsp;";
        echo "</td>\n";
        echo "<td>";
        echo "&nbsp;";
        echo "</td>\n";

        echo "</table>\n";
        // Fin affichage table détail horaire

        $pas_horaire = FALSE;
    } else {
        $pas_horaire = TRUE;
        ?>
        <p class="annot_petit_it"><?PHP echo _("Aucun détail horaire enregistré"); ?></p>
    <?PHP
    }
    $db->disconnect();

    $taille_piedla = "";
    include_once("piedla.inc.php");

    if ($td <> "view") {
        ?>
        <br />
        <form name="oth_maj" id="oth_maj" class="bord_pointilles" method="post" action="oth_maj.php">
            <p align="center" class="annot_std_gras"><?PHP echo $titre; ?></p>

            <p align="center" class="annot_petit_it"><?PHP echo _("Tous les champs sont obligatoires"); ?></p>
            <input name="td" type="hidden" id="td" value="<?PHP echo $td; ?>">
            <input name="co" type="hidden" id="co" value="<?PHP echo $codeot; ?>">
            <input name="id" type="hidden" id="id" value="<?PHP echo $id; ?>">
            <input name="nbutton" type="hidden" id="nbutton" value="">
            <table width="580" border="0" align="center">
                <tr>
                    <td width="30%" class="rubfrm" id="f_date" align="right"><?PHP echo _("Date"); ?></td>
                    <td align="left">
                        <input name="date" type="text" id="date" value="<?PHP echo $datef; ?>" size="10" maxlength="10"
                               readonly>
                        <a href="javascript:"><img src="../img/raz.png" id="razdate" border="0" align="absmiddle"></a>
                    </td>
                </tr>
                <tr>
                    <td width="30%" class="rubfrm" id="f_tec" align="right"><?PHP echo _("Technicien"); ?></td>
                    <td align="left">
                        <?PHP
                        $rows = give_tab_rows_tec_st($ot_codest);

                        if (count($rows) > 0)
                            cre_select_tab('codetec', 'codetec', $rows, 'tec_code', 'tec_nom', 'tec_prenom-tec_codest', $oth_codetec, '', _("-- Faites votre choix --"));
                        else {
                            $tab_nosel = [];
                            $tab_nosel[""] = _(">-- Pas de technicien actif chez ce sous-traitant --");
                            cre_select('codetec', 'codetec', $tab_nosel, '');
                        }
                        ?>
                    </td>
                </tr>
                <tr>
                    <td width="30%" class="rubfrm" id="f_lieu" align="right"><?PHP echo _("Lieu"); ?></td>
                    <td align="left">
                        <?PHP
                        // création de la liste des Types Lieux
                        $db = open_database(DBUSER, DBPASS, DBNAME, DBHOST);
                        $rech = "SELECT * FROM `" . TBLIEU . "` ORDER BY lieu_desc";
                        $rows = $db->get_results($rech, ARRAY_A);
                        $db->disconnect();
                        cre_select_tab('codelieu', 'codelieu', $rows, 'lieu_code', 'lieu_desc', '', $oth_codelieu, '', _("-- Faites votre choix --"));
                        ?>
                    </td>
                </tr>
                <tr>
                    <td width="30%" class="rubfrm" id="f_horaires" align="right"><?PHP echo _("Horaires"); ?></td>
                    <td align="left">
                        <?PHP
                        // $tab_heures = give_tab_heures(0, 86400, ($pla_stepmin * 60));
                        $tab_heures = give_tab_heures(($pprm_firsthour * 3600), ($pprm_lasthour * 3600), ($pla_stepmin * 60));

                        echo ' ' . _("Début") . ' ';
                        cre_select('heurea', 'heurea', $tab_heures, substr($oth_heurea, 0, 5));

                        if ($tdh <> "view")
                            echo '<a href="javascript:;"><img src="../img/raz.png" id="razheurea" border="0" align="absmiddle"></a>';

                        echo ' / Fin ';

                        cre_select('heured', 'heured', $tab_heures, substr($oth_heured, 0, 5));

                        echo '<a href="javascript:;"><img src="../img/raz.png" id="razheured" border="0" align="absmiddle"></a>';
                        ?>
                    </td>
                </tr>
                <tr>
                    <td width="30%" class="rubfrm" id="f_offert" align="right">
                        Offert
                    </td>
                    <td align="left">
                        <?PHP
                        echo '<input type="checkbox" name="offert" style="background : #FFFFFF;"';
                        if ($oth_offert == 1)
                            echo ' checked';
                        echo '>';
                        ?>
                    </td>
                </tr>
            </table>
            <?PHP
            echo '<p align="center">';
            echo '<input name="annul" type="button" class="bton_std" id="annul" value="' . _("Annuler") . '">';
            switch ($tdh) {
                case "add" :
                    echo '<input name="enr" type="button" class="bton_std" id="enr" value="' . _("Ajouter") . '">';
                    break;
                case "edit" :
                    echo '<input name="val" type="button" class="bton_std" id="val" value="' . _("Valider") . '">';
                    break;
                case "del" :
                    echo '<input name="del" type="button" class="bton_std" id="del" value="' . _("Supprimer") . '">';
                    break;
                default :
                    break;
            }
            echo '</p>';
            ?>
        </form>
    <?PHP
    }
} else {
    if ($pbm_oth == TRUE)
        close_fen_auto('', '');

    if ($pbm_enr_oth == TRUE)
        pop_ret_auto($msg, 'warn', 'oth_maj.php?co=' . $codeot . '&td=' . $td . '&id=' . $id);
}
?>
</body>
</html>
