<?php
/****************************************************************************************
 * SMI (Services Maintenance Interventions) est une gestion libre de maintenance et de SAV
 *
 * Version 1.0.0
 *
 * Copyright (C) 2006-2014  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/fic_age.inc.php");
include_once("../inc/fic_cli.inc.php");
include_once("../inc/fic_dloc.inc.php");
include_once("../inc/fic_droits.inc.php");
include_once("../inc/fic_loc.inc.php");
include_once("../inc/fic_st.inc.php");
include_once("../inc/fic_tec.inc.php");
include_once("../inc/func.inc.php");
include_once("../inc/func_date.inc.php");
include_once("../inc/func_time.inc.php");
include_once("../inc/func_geo.inc.php");
include_once("../inc/func_txt.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"]);
$_SESSION["typ_filtres"] = "pdtloc";

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

$ta = $_GET['ta']; // Source de l'appel m:depuis le menu, l:depuis une location
$td = $_GET['td']; // Récupération type demande
$tc = intval($_GET['tc']); // Récupération type client
$cc = $_GET['cc']; // Récupération code Client
$cl = $_GET['cl']; // Récupération code Location
$ca = $_GET['ca']; // Récupération code agence
if ($ta == "l") {
    if (isset($_GET['fi']) && (trim($_GET['fi']) <> ""))
        $fi = intval($_GET['fi']);
    else
        $fi = 1; // Dépôt principal seulement ? (0=non, 1=oui -> défaut)
} else {
    $fi = "";
    if (isset($_GET['fi']) && (trim($_GET['fi']) <> ""))
        $fi = intval($_GET['fi']);
}
if (isset($_GET["dd"]))
    $dd = @$_GET["dd"];
else
    $dd = "";
if (isset($_GET["hd"]))
    $hd = @$_GET["hd"];
else
    $hd = "00:".$pla_stepmin;
if (isset($_GET["df"]))
    $df = @$_GET["df"];
else
    $df = "";
if (isset($_GET["hf"]))
    $hf = @$_GET["hf"];
else
    $hf = "00:".$pla_stepmin;
$pbm_pdt = FALSE;

if (($ta <> "l") AND ($ta <> "m"))
    $pbm_pdt = TRUE;

if ($ta == "l") {
    if (($fi <> 0) AND ($fi <> 1))
        $pbm_pdt = TRUE;
} else {
    if (($fi < -1) OR ($fi > 4))
        $pbm_pdt = TRUE;
}

if (($tc < 0) OR ($tc > 4))
    $pbm_coloc = TRUE;

if ($pbm_pdt == FALSE) {
    if ($ta == "l") {
        $tab_fi = $tab_fi_pdtloc_loc;

        if ($ca <> "") {
            // Contrôle qu'une agence n'essaye pas de "hacker" un contrat
            if (((@$_SESSION["niv_log"] == 4) OR (@$_SESSION["niv_log"] == 3)) AND ($ca <> @$_SESSION["code_age"]))
                $pbm_coloc = TRUE;
        } else
            $ca = @$_SESSION["code_age"];

        if ($cl <> "") {
            $row = lit_enr_coloc($cl);
            if (is_array($row)) {
                $row = encode_str($row);
                extract($row);
                if ($coloc_dateclos == "0000-00-00") {
                    $coloc_datedebf = datetolocal($coloc_datedeb);
                    $coloc_datefinf = datetolocal($coloc_datefin);

                    // Contrôle qu'un client n'essaye pas de "hacker" un contrat
                    if ((@$_SESSION["niv_log"] == 1) AND ($coloc_codecli <> @$_SESSION["code_log"]))
                        $pbm_pdt = TRUE;
                    // Contrôle qu'une agence n'essaye pas de "hacker" un contrat
                    if (((@$_SESSION["niv_log"] == 4) OR (@$_SESSION["niv_log"] == 3)) AND ($coloc_codeage <> @$_SESSION["code_age"]))
                        $pbm_pdt = TRUE;
                } else
                    $pbm_pdt = TRUE;
            } else
                $pbm_pdt = TRUE;
        } else
            $pbm_pdt = TRUE;

        if ($cc <> "") {
            // Contrôle qu'un client n'essaye pas de "hacker" un contrat
            if ((@$_SESSION["niv_log"] == 1) AND ($cc <> @$_SESSION["code_log"]))
                $pbm_pdt = TRUE;

            switch ($tc) {
                case 0 :
                    $row = lit_enr_cli($cc, TRUE);
                    if (is_array($row)) {
                        $row = encode_str($row);
                        extract($row);
                        // Contrôle qu'une agence n'essaye pas de "hacker" un contrat
                        switch (@$_SESSION["niv_log"]) {
                            case 3 :
                            case 4 :
                                if (client_age_ok($cli_code, @$_SESSION["code_age"], TRUE) == FALSE)
                                    $pbm_pdt = TRUE;
                                break;
                            default :
                                break;
                        }
                    } else
                        $pbm_pdt = TRUE;
                    break;
                case 1 :
                    $row = lit_enr_age($cc, TRUE);
                    if (is_array($row)) {
                        $row = encode_str($row);
                        extract($row);
                    } else
                        $pbm_pdt = TRUE;
                    break;
                case 2 :
                case 4 :
                    $row = lit_enr_tec($cc, TRUE);
                    if (is_array($row)) {
                        $row = encode_str($row);
                        extract($row);
                    } else
                        $pbm_pdt = TRUE;
                    break;
                case 3 :
                    $row = lit_enr_st($cc, TRUE);
                    if (is_array($row)) {
                        $row = encode_str($row);
                        extract($row);
                    } else
                        $pbm_pdt = TRUE;
                    break;
                default :
                    $pbm_pdt = TRUE;
                    break;
            }
        }
    } else {
        $tab_fi = $tab_fi_pdtloc_menu;
        $ca = @$_SESSION["code_age"];
    }
}
?>
<!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 _("Liste Produits à Louer"); ?></title>

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

    <?PHP if ($ta == "l") { ?>
        <script language="javascript">
            <!--
            var tab1_champ = ["nom:dd ; format:date ; masque:<?PHP echo $_SESSION['date_fmtfull']; ?> ; req:Y ; txt:<?PHP echo _("Date début"); ?> ; vmn:<?PHP echo $coloc_datedebf; ?> ; vmx:<?PHP echo $coloc_datefinf; ?> ; stok:frmok ; stbad:frmbad",
                "nom:hd ; format:heurehhmm ;  req:Y ; txt:<?PHP echo _("Heure début"); ?> ; stok:frmok ; stbad:frmbad",
                "nom:df ; format:date ; masque:<?PHP echo $_SESSION['date_fmtfull']; ?> ; req:Y ; txt:<?PHP echo _("Date fin"); ?> ; vmn:<?PHP echo $coloc_datedebf; ?> ; vmx:<?PHP echo $coloc_datefinf; ?> ; stok:frmok ; stbad:frmbad",
                "nom:hf ; format:heurehhmm ; req:Y ; txt:<?PHP echo _("Heure fin"); ?> ;  stok:frmok ; stbad:frmbad"];

            //-->
        </script>
    <?PHP } ?>

    <script type="text/javascript">
        <!--
        <?PHP
        if ($ta == "l") {
            // cre_html_pdtlbl('detbarloc', 'edit', $_SESSION["pdtlbl"], $_SESSION["pdtlpl"], $_SESSION["pdtlcl"], 'window.opener.');
        ?>

        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"); ?>"
            });

            $("#dd").datepicker({
                onSelect: function (datesel) {
                    $("#dd").blur();
                    chk_datedif(datesel, this.id, '<?PHP echo $_SESSION['date_fmtshort']; ?>', true, '', '', 'df',false);
                }
            });

            $("#df").datepicker({
                onSelect: function (datesel) {
                    $("#df").blur();
                    chk_datedif(datesel, this.id, '<?PHP echo $_SESSION['date_fmtshort']; ?>', true, 'dd', '', '',false);
                }
            });
        }
        <?PHP } ?>
        function init_all() {
            init_Body();
            init_autohref_classe('falselnkimg','');
            init_fen_lst_filtre('fisel',<?PHP echo(count($tab_fi) - 1); ?>);
            init_autohref('reset','click','<?PHP echo "pdtloc_lst.php?td=" . $td . "&ta=" . $ta . "&cc=" . $cc . "&ca=" . $ca . "&cl=" . $cl . "&dd=" . $dd . "&df=" . $df . "&fi=1"; ?>',false);
            <?PHP if ($ta == "l")
            {
                echo "init_autoraz('razsearch','search','click');";
                echo 'init_datepicker();';
                echo "$('#hd').timepicker({";
                    echo "dynamic: false,";
                    echo "timeFormat: 'HH:mm',";
                    echo "stepMinute : ".$pla_stepmin.",";
                    echo "timeOnlyTitle: '".str_escape(_("Choisissez l'heure"))."',";
                    echo "timeText: '".str_escape(_("Heure"))."',";
                    echo "hourText: '".str_escape(_("Heures"))."',";
                    echo "minuteText: '".str_escape(_("Minutes"))."',";
                    echo "currentText: '".str_escape(_("Maintenant"))."',";
                    echo "closeText: '".str_escape(_("Valider"))."',";
                    echo "change: function(timesel) {";
                        echo "chk_heuredatedif('dd','".$_SESSION['date_fmtshort']."','hd',true,'','','df-hf');";
                    echo "}";
                echo "});";
                echo "$('#hf').timepicker({";
                    echo "dynamic: false,";
                    echo "timeFormat: 'HH:mm',";
                    echo "stepMinute : ".$pla_stepmin.",";
                    echo "timeOnlyTitle: '".str_escape(_("Choisissez l'heure"))."',";
                    echo "timeText: '".str_escape(_("Heure"))."',";
                    echo "hourText: '".str_escape(_("Heures"))."',";
                    echo "minuteText: '".str_escape(_("Minutes"))."',";
                    echo "currentText: '".str_escape(_("Maintenant"))."',";
                    echo "closeText: '".str_escape(_("Valider"))."',";
                    // scrollbar: true,
                    echo "change: function(timesel) {";
                        echo "chk_heuredatedif('df','".$_SESSION['date_fmtshort']."','hf',true,'dd-hd','','');";
                    echo "}";
                echo "});";
                // echo 'tbpbarloc();';
                echo "init_autoraz('razdd','dd','click');";
                echo "init_autoraz('razhd','hd','click');";
                echo "init_autoraz('razdf','df','click');";
                echo "init_autoraz('razhf','hf','click');";
                echo "add_func_click('quit', 'sclose', '');";
                echo "init_valid_form('enr','formr','".$_SESSION['date_fmtshort']."',tab1_champ,'','');";
            }
            ?>
            Focus_first();
        }

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

</head>

<body>
<?php
if ($ta == "m")
    include_once("../inc/entete.inc.php");
echo '<p align="center"><span class="titrepage">' . _("LISTE DES PRODUITS A LOUER") . '</span></p>';
if ($pbm_pdt == FALSE) {
    if ($ta == "l") {
        echo '<div align="center">';
        echo '<span class="titre_gras">' . _("Choisissez un article pour la location") . ' ' . $cl . '</span><br />';
        echo '<span class="titre_gras">';
        if ($fi == 0)
            echo _("Sur tous les dépôts");
        else
            echo _("Sur le dépôt de l'agence") . ' ' . $ca;
        echo '</span><br />';
        echo '<span class="titre_gras">' . _("Disponible entre le") . ' ' . $dd . ' ' . _("et le") . ' ' . $df . '</span><br />';
        echo '<span class="annot_petit_it">' . _("Hors article(s) déjà saisi(s) dans cette location") . '</span>';
        echo '</div>';
        echo '<p align="center">';
        echo '<input type="button" class="bton_std" name="quit" id ="quit" value="' . _("Revenir à la saisie en cours") . '">';
        echo '</p>';
    } else {
        if (@$_SESSION["niv_log"] >= 4) {
            $fic_imp = "pdtloc_lsti.php";
            $url_add = "pdtloc_maj.php?td=add&code=";
        } else {
            $fic_imp = "";
            $url_add = "";
        }
    }

    $iddloc = id_dloc_page($ca, TRUE);

    $db = open_database(DBUSER, DBPASS, DBNAME, DBHOST);

    if ($ta == "l") {
        $rech = cree_strrechlstrpdtcl();
        switch ($fi) {
            case 1 :
                if (!stristr($rech, "WHERE "))
                    $rech .= " WHERE pdtloc_iddloc=" . $iddloc;
                else
                    $rech .= " AND pdtloc_iddloc=" . $iddloc;
                break;
            default :
                break;
        }
        $rech .= crestr_triord($pdtcloc_titre_col, "pdtloc_code", FALSE, $limit);
    } else {
        $rech = cree_strrechlstrpdtl();
        switch ($fi) {
            case 1 :
                if (!stristr($rech, "WHERE "))
                    $rech .= " WHERE pdtloc_louable='1'";
                else
                    $rech .= " AND pdtloc_louable='1'";
                break;
            case 2 :
                if (!stristr($rech, "WHERE "))
                    $rech .= " WHERE pdtloc_louable='0'";
                else
                    $rech .= " AND pdtloc_louable='0'";
                break;
            case 3 :
                if (!stristr($rech, "WHERE "))
                    $rech .= " WHERE pdtloc_loue='1'";
                else
                    $rech .= " AND pdtloc_loue='1'";
                break;
            case 4 :
                if (!stristr($rech, "WHERE "))
                    $rech .= " WHERE pdtloc_loue='0'";
                else
                    $rech .= " AND pdtloc_loue='0'";
                break;
            default :
                break;
        }
        $rech .= crestr_triord($pdtloc_titre_col, "pdtloc_code", FALSE, $limit);
    }
    $rows = $db->get_results($rech, ARRAY_A);
    $db->disconnect();

    if ($rows) {
        $afflst = TRUE;
        if ($ta == "l") {
            $gdd = getTimeStamp($dd . " " . $hd . ":00");
            $gdf = getTimeStamp($df . " " . $hf . ":00");
            if ($gdd == $gdf)
                $afflst = FALSE;
        }

        $numrows = count($rows);
        if ($ta == "l")
            include_once("formrl.inc.php");
        else
            include_once("formr.inc.php");

        if ($afflst == TRUE) {
            if ($ta == "l")
                $rech = modstr_triord($rech, $pdtcloc_titre_col, "pdtloc_code", TRUE, $limit);
            else
                $rech = modstr_triord($rech, $pdtloc_titre_col, "pdtloc_code", TRUE, $limit);

            $db = open_database(DBUSER, DBPASS, DBNAME, DBHOST);

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

            // *** Pagination de début
            pagine_lst($numrows, $limit);

            // *** Affichage de la table
            echo "<table class=\"Mtable\" border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";

            // création entête

            if ($ta == "l")
                titlst($pdtcloc_titre_col);
            else
                titlst($pdtloc_titre_col);
            echo "<th>" . _("Cliquer") . "</th>\n";

            $i = 0;
            $pdtlouables = FALSE;

            foreach ($rows as $row) {
                $row = encode_str($row);
                // On vérifie que le produit n'est pas déjà utilisé dans le contrat
                $rech2 = "SELECT COUNT(*) FROM `" . TBPDTL . "` WHERE `pdtl_codepdtloc` = '" . $row["pdtloc_code"] . "' AND `pdtl_codecoloc` = '" . $cl . "'";
                $nbres2 = $db->get_var($rech2);
                if ($nbres2 == 0) {
                    $affok = TRUE;
                    if ($ta == 'l') {
                        if (pdtloc_dispo($row["pdtloc_code"], $dd, $hd . ':00', $df, $hf . ':00', FALSE) == FALSE)
                            $affok = FALSE;
                    }

                    if ($affok == TRUE) {
                        $pdtlouables = TRUE;

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

                        echo "<td>";
                        echo $row["pdtloc_code"];
                        if ($ta == "l") {
                            if ($fi == 0) {
                                if ($row["pdtloc_iddloc"] == $iddloc)
                                    echo ' <img src="../img/dp.png" border="0" align="absmiddle" title="' . _("Dépôt principal agence") . '">';
                                else {
                                    echo "<div align=\"right\" class=\"annot_upetit\">";
                                    echo $row["dloc_nom"];
                                    if ($row["dloc_codeage"] <> "")
                                        echo ' (' . _("agence") . ' ' . $row["dloc_codeage"] . ')';
                                    echo "</div>";
                                }
                            }
                        } else {
                            if ($row["pdtloc_iddloc"] == $iddloc)
                                echo ' <img src="../img/dp.png" border="0" align="absmiddle" title="' . _("Dans votre dépôt de location") . '">';
                            else {
                                echo "<div align=\"right\" class=\"annot_upetit\">";
                                echo $row["dloc_nom"];
                                if ($row["dloc_codeage"] <> "")
                                    echo ' (' . _("agence") . ' ' . $row["dloc_codeage"] . ')';
                                echo "</div>";
                            }
                        }
                        echo "</td>\n";
                        echo "<td>";
                        echo $row["pdtloc_fam"];

                        // détail famille
                        echo "<br />";
                        echo "<span class=\"annot_petit_it\">";
                        $txt = "(" . formatetxt($row["fam_desc"]) . ")";
                        echo $txt;
                        echo "</span>";

                        echo "</td>\n";
                        echo "<td>";
                        echo $row["pdtloc_des"];
                        echo "</td>\n";
                        echo "<td>";
                        echo $row["pdtloc_ns"];
                        echo "</td>\n";
                        if ($ta <> "l") {
                            echo "<td>";
                            echo "<div align=\"center\">";
                            echo $non_oui[$row["pdtloc_louable"]];
                            echo "</div>";
                            echo "</td>\n";
                            echo "<td>";
                            echo "<div align=\"center\">";
                            echo $non_oui[$row["pdtloc_loue"]];
                            if ((@$_SESSION["niv_log"] == 5) OR (@$_SESSION["niv_log"] == 9) OR (((@$_SESSION["niv_log"] == 4) OR (@$_SESSION["niv_log"] == 3))AND ($row["pdtloc_iddloc"] == $iddloc))) {
                                if ($row["pdtloc_loue"] == TRUE) {
                                    echo "<div class=\"annot_upetit\">";
                                    $rech2 = "SELECT " . TBPDTL . ".pdtl_codecoloc, " . TBCOLOC . ".coloc_codecli FROM `" . TBPDTL . "`, `" . TBCOLOC . "`";
                                    $rech2 .= " WHERE " . TBPDTL . ".pdtl_codepdtloc = '" . $row["pdtloc_code"] . "'";
                                    $rech2 .= " AND " . TBPDTL . ".pdtl_datedep <> '0000-00-00'";
                                    $rech2 .= " AND " . TBPDTL . ".pdtl_dateret = '0000-00-00'";
                                    $rech2 .= " AND " . TBPDTL . ".pdtl_codecoloc = " . TBCOLOC . ".coloc_code";
                                    $row2 = $db->get_row($rech2, ARRAY_A);
                                    if ($row2) {
                                        $row2 = encode_str($row2);
                                        echo $row2["coloc_codecli"] . " (" . $row2["pdtl_codecoloc"] . ")";
                                    }
                                    echo "</div>";
                                }
                            }
                            echo "</div>";
                            echo "</td>\n";
                        }

                        // CREATION lien dynamique sur icône (édition, suppression, etc...)
                        if ($ta == "l") {
                            $lst_coloc = TRUE;

                            echo "<td align=\"center\">";
                            cre_falselnk_img('', 'pdtl_add_'.$row["pdtloc_id"], 'span', 'center', _("Ajout"), 'lnk', 'pdtl_maj.php?td=add&cl=' . $cl . '&ca=' . $row["pdtloc_code"] . '&dd=' . $dd . '&hd=' . $hd . '&df=' . $df . '&hf=' . $hf, '../img/coloc.png');
                            echo "</td>\n";
                        } else {
                            echo "<td>";
                            echo "<div align=\"center\">";
                            $voir = FALSE;
                            if (@$_SESSION["niv_log"] == 4) {
                                if ($iddloc == -1)
                                    $voir = TRUE;
                                else
                                    if ($iddloc <> $row["pdtloc_iddloc"])
                                        $voir = TRUE;
                            }
                            if (@$_SESSION["niv_log"] == 3)
                                $voir = TRUE;

                            if ($voir == FALSE) {
                                $lst_maj = TRUE;
                                cre_falselnk_img('', 'pdtloc_edit_'.$row["pdtloc_id"], 'span', 'center', _("Edition"), 'lnk', 'pdtloc_maj.php?td=edit&code=' . $row["pdtloc_code"], '../img/edit.png');
                                $lst_del = TRUE;
                                cre_falselnk_img('', 'pdtloc_del_'.$row["pdtloc_id"], 'span', 'center', _("Suppression"), 'lnk', 'pdtloc_maj.php?td=del&code=' . $row["pdtloc_code"], '../img/del.png');
                            } else {
                                $lst_voir = TRUE;
                                cre_falselnk_img('', 'pdtloc_view_'.$row["pdtloc_id"], 'span', 'center', _("Visualisation"), 'lnk', 'pdtloc_maj.php?td=view&code=' . $row["pdtloc_code"], '../img/eye.png');
                            }
                            echo "</div>";
                            echo "</td>\n";
                        }

                        echo "</tr>\n";

                        $i++;
                    }
                }
            }
            echo "</table>\n";
            // *** Fin affichage de la table

            $db->disconnect();

            if ($ta == "l") {
                if ($pdtlouables == FALSE) {
                    echo '<span class="annot_petit_it">' . _("Aucun produit à louer sur ces critères") . '</span>';
                }
            }

            // *** Pagination de pied
            pagine_lst($numrows, $limit);

            $taille_piedla = "";
            include_once("piedla.inc.php");
        } else
            echo '<span class="annot_petit_gras">' . _("Merci de choisir une période de location") . '</span>';
    } else {
        retpp();
        if ($ta == "l") {
            if (!isset($_GET['search'])) {
                echo "<br />";
                $lnk_autre = str_replace("fi=1", "fi=0", $_SERVER['REQUEST_URI']);
                echo "<a href=\"" . $lnk_autre . "\">";
                echo _("Voir sur tous les dépôts");
                echo "</a>";
            }
        }
    }
} else
    pop_ret_auto(_("Problème de paramètres"), 'warn', "index.php");

if ($ta == "m")
    include_once("pied.php");
?>
</body>
</html>