Bonjour à tous,

J'ai au boulot une appli web développée par un ancien salarié que j'essaie de maintenir ou adapter.
Sur une page de ventes dont voici le code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<?php
$conn = mysql_connect(...);
$base2='commun_agences';
mysql_query("SET NAMES 'utf8'"); 
session_start();  
$base1=$_SESSION['base'];
$agence=$_SESSION['agence'];
//echo $agence;
 
$order_by = (isset($_GET['order'])&& in_array($_GET['order'], $tri_possibles)) ? $_GET['order']:'date_vente';
 
?>
 
 
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                <link rel="stylesheet" type="text/css" href="/modeles/general.css"/>
        <title>Suivi Portefeuille</title>
    </head>
    <body>
     <div id="header">
            <?php
    require "../modeles/header.php";   
?>
        </div>
        <div id="menu">
             <?php
          require "../modeles/menu.php";
        ?>
        </div>
        <p>La liste des ventes peut s'afficher sous le menu, en bas de la page.</p>
        <div id="contenu" >
 
             <h2 style="text-align: center">Suivi Portefeuille (Ventes en cours facturation non complète)</h2>
           <br>
            <form name="suivi_ventes" method="post" action="save_suivi_ventes.php">   
 
 
        <?php 
//Tris sur colonnes
 
$tri_possibles = array('date_vente','vente_produit','clientnom','ville','userprenom','date_prev_pose','statut_vente', 'mois_fact');
$order_by = (isset($_GET['order'])&& in_array($_GET['order'], $tri_possibles)) ? $_GET['order']:'date_vente';
 
//sens du tri
 
$order_dir = isset($_GET['inverse']) ? 'DESC' : 'ASC';
 
//requetes
$sql="select * from ventes_cours_view order by {$order_by} {$order_dir}";
$sql_mmsm="select * from ventes_cours_view where libelle_agence='$agence' order by {$order_by} {$order_dir}";
 
if(isset($_GET['venteid'])){
    $vente=$_GET['venteid'];
 
    $sql_vente_unique="select * from ventes_cours_view where venteid='$vente' ";
    $result = mysql_db_query($base1,$sql_vente_unique) or exit(mysql_error());  }
 
 
elseif($base1=='MMSM' ){ 
    $result = mysql_db_query($base1,$sql_mmsm) or exit(mysql_error()); 
     }
    else {
 
$result = mysql_db_query($base1,$sql) or exit(mysql_error());  }
 
// fonction qui affiche les liens
 
function sort_link($text, $order=false)
{
    global $order_by, $order_dir;
 
    if(!$order)
        $order = $text;
 
    $link = '<a href="?order=' . $order;
    if($order_by==$order && $order_dir=='ASC')
        $link .= '&inverse=true';
    $link .= '"';
    if($order_by==$order && $order_dir=='ASC')
        $link .= ' class="order_asc"';
    elseif($order_by==$order && $order_dir=='DESC')
        $link .= ' class="order_desc"';
    $link .= '>' . $text . '</a>';
 
    return $link;
}
 
   ?>
 <a href="export_portefeuille.php?exporter=export">Exporter la liste</a>
<input type="submit" name="enregistrer" value="Enregistrer">
    <table style="font-size: medium">
         <tr style="height: 40px">
               <th style="text-align: center; width:60px"><?php echo sort_link('Date Vente', 'date_vente') ?> </th>
                 <th style="text-align: center; width:120px"><?php echo sort_link('Vendeur', 'userprenom') ?> </th> 
             <th style="text-align: center; width: 150px"><?php echo sort_link('Client', 'clientnom') ?> </th>
              <th style="text-align: center; width:auto"><?php echo sort_link('Ville', 'ville') ?> </th>
 
              <th style="text-align: center; width:100px"><?php echo sort_link('Produit', 'vente_produit') ?> </th>
             <th style="text-align: center; width:100px"><?php echo sort_link('Statut', 'statut_vente') ?> </th>
              <th style="text-align: center; width:50px">Date statut</th>
              <th style="text-align: center; width:50px">Statut à enreg.</th>
             <th style="text-align: center; width:50px">Nb acpte </th>
       <th style="text-align: center; width:70px"><?php echo sort_link('Métré', 'date_metre') ?> </th>
             <th style="text-align: center; width:40px"><?php echo sort_link('Prev. Pose', 'date_prev_pose') ?> </th>
             <th style="text-align: center; width:50px">Temps de pose</th>
             <th style="text-align: center;width:70px"><?php echo sort_link('Mois Fact.', 'mois_fact') ?> </th>
 
          </tr>
 
 
        <?php      
    while($row_liste = mysql_fetch_assoc($result)) {  
 
        $venteid=$row_liste['venteid'];
        $result_acompte=mysql_db_query($base1, "select libelle_acompte from acomptes where venteid_acompte='$venteid'") or exit (mysql_error());
 
 
        $nb_acompte=mysql_num_rows( $result_acompte);
 
         ?>
 
        <tr>
               <td><?php echo date('d/m/Y',strtotime($row_liste['date_vente']))?> </td>
              <td><?php echo $row_liste['userprenom'].' '.$row_liste['usernom']?></td>
               <td><?php echo $row_liste['clientnom']; ?> </td>   
             <td><?php echo $row_liste['ville']?></td>
              <td style="text-align: center;"><?php echo $row_liste['vente_produit']; ?> </td> 
 
            <td><select name="statut_vente[<?php echo $row_liste['venteid']?>]" 
                id="statut_vente[<?php echo $row_liste['venteid']?>]" onchange="document.getElementById('modif[<?php echo $row_liste['venteid']?>]').checked=true;"><option value="">Sélectionner le statut</option> 
 
 
     <?php
 
$result_statut = mysql_db_query($base2,"select etat_vente_libelle from etat_vente order by etat_vente_ordre");
 
while 
($row_statut = mysql_fetch_assoc($result_statut))
{
 
    if ($row_statut['etat_vente_libelle']==$row_liste['statut_vente']) { ?>
                 <OPTION VALUE="<?php echo $row_liste['statut_vente'];?>"selected="selected">
                      <?php echo $row_liste['statut_vente']; ?> </OPTION>
 
                 <?php    } 
 
 
    else { ?>
    <OPTION VALUE="<?php echo $row_statut['etat_vente_libelle'];?>">
       <?php echo $row_statut['etat_vente_libelle']; ?>
    </OPTION>
<?php 
    } }
 ?>    
        </select> </td>
            <td style="width: 50px"><input type="date" style="width: 120px; font-weight: bold; font-size: small" name="date_statut[<?php echo $row_liste['venteid']?>]" value="<?php echo $row_liste['date_statut']?>"></td>
             <td style="br"><input type="checkbox" style="width: 20px; height: 20px" name="idligne_statut[<?php echo $row_liste['venteid']?>]" id="modif[<?php echo $row_liste['venteid']?>]" 
                 value="<?php echo $row_liste['venteid']?>"></td>
             <td><?php echo $nb_acompte; ?>  <a href="../ventes/ajouter_acompte_direct.php?venteid=<?php echo $venteid ?>" target=blank title="Ajouter un acompte"><IMG src="../images/ajouter.png"></a></td> 
 
              <td><input type="date" style="width: 120px; font-weight: bold; font-size: small" name="metre[<?php echo $row_liste['venteid']?>]" value="<?php echo $row_liste['date_metre']?>"> </td>   
 
             <td><select name="date_prev_pose[<?php echo $row_liste['venteid']?>]" style="width: 80px;"><option value="">Chois Sem. pose</option> 
 
 
     <?php
 
 
$result_semaine = mysql_db_query($base2,"select * from semaines order by idsemaine");
?>
 
 
<?php 
while 
($row_sem = mysql_fetch_assoc($result_semaine))
{
 
    if ($row_sem['idsemaine']==$row_liste['date_prev_pose']) { ?>
                 <OPTION VALUE="<?php echo $row_liste['date_prev_pose'];?>"selected="selected">
                      <?php if ($row_liste['date_prev_pose']=='0') {echo 'Sans Pose'; } else {echo Sem.' '.$row_liste['date_prev_pose'];} ?> </OPTION>
 
                 <?php    } 
 
    else { ?>
 
    <OPTION VALUE="<?php echo $row_sem['numsemaine'];?>">
       <?php if ($row_sem['idsemeine']=='0') {echo 'Sans Pose'; } else {echo Sem.' '.$row_sem['idsemaine'];} ?>
    </OPTION>
<?php 
    } }
 ?>    
        </select> </td>
             <td><input type="text" style="width: 120px; font-size: small" name="temps_pose[<?php echo $row_liste['venteid']?>]" value="<?php echo $row_liste['duree_pose'] ?>"></td>
            <td style="width: 70px;"><input type="month" style="width: 120px; font-weight: bold; font-size: small" name="mois_fact[<?php echo $row_liste['venteid']?>]" value="<?php echo $row_liste['mois_fact'] ?>">
 
 
 <input type="hidden" name="idligne[<?php echo $row_liste['venteid']?>]" value="<?php echo $row_liste['venteid']?>"></td>
 
             <td  style="width:60px"><a href="../ventes/recap_vente.php?venteid=<?php echo $row_liste['venteid'];?>" target="_blank">Voir récap.</a></td>
 
 
            </tr>
 
   <?php   
   } 
 
   ?>  
    </table>
 
    </form>      
      </div>
 
 
    </body>
</html>
certains champs peuvent être modifiés et validés via un bouton "enregister" dont voici le code également :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
$conn = mysql_connect(....);
 
mysql_query("SET NAMES 'utf8'"); 
session_start();  
$base1=$_SESSION['base'];
$base2='commun_agences';
$agence=$_SESSION['agence'];
 
 
?>
 
<!DOCTYPE html>
<html lang="fr">
    <head>
        <meta charset="utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <link rel="stylesheet" type="text/css" href="/modeles/general.css"/>
        <title>Suivi des ventes en cours</title>
    </head>
    <body>
          <div id="header">
<?php
    require "../modeles/header.php";
?>
        </div>
        <div id="menu">
        <?php
    require "../modeles/menu.php";
?>
        </div>
 
        <div id="contenu">
 
            <?php
 
if (isset($_POST['enregistrer'])) {
 
 
foreach($_POST['idligne'] as $id)
 
{ 
$id=$_POST['idligne'][$id];
$statut_vente=addslashes($_POST['statut_vente'][$id]);
 
if (empty ($_POST['metre'][$id])){$metre='0000-00-00';} else {$metre=$_POST['metre'][$id];}
if (empty ($_POST['date_statut'][$id])){$date_statut='0000-00-00';} else {$date_statut=$_POST['date_statut'][$id];}
$prev_pose=$_POST['date_prev_pose'][$id];
$temps_pose=addslashes($_POST['temps_pose'][$id]);
$mois_fact=$_POST['mois_fact'][$id];
 
 
$update_ventes="update ventes set statut_vente='$statut_vente', date_metre='$metre', date_prev_pose='$prev_pose', duree_pose='$temps_pose', mois_fact='$mois_fact', date_statut='$date_statut' where venteid='$id'";
mysql_db_query($base1,$update_ventes) or exit(mysql_error());
}
 
foreach($_POST['idligne_statut'] as $id_vente)
 
{ 
$id_vente=$_POST['idligne'][$id_vente];
$statut_vente=addslashes($_POST['statut_vente'][$id_vente]);
if (empty ($_POST['date_statut'][$id_vente])){$date_statut='0000-00-00';} else {$date_statut=$_POST['date_statut'][$id_vente];}
 
$insert_statut="insert into suivi_vente (suivi_vente_etat, suivi_vente_date, suivi_idvente) values ('$statut_vente', '$date_statut','$id_vente')";
 
 
mysql_db_query($base1,$insert_statut) or exit(mysql_error());
 
}
 
  ?>
 
    <div id='message'>Les informations ont bien été enregistrées.</div>
   <a href="suivi_ventes.php">Retour</a>
           <br> 
 
        <?php
 
}
  ?>
        </div>
 
 
    </body>
</html>
Tout fonctionne parfaitement sauf qu'il n'enregistre que les 142 premières lignes de l'écran.
Je m'explique :
Si je tri par ordre alphabétique mes clients et que je modifie un client ALBERT, l'enregistrement se fait bien mais si je modifie un client ZINA (on suppose que ce client arrive après la ligne 142), le bouton enregistrer ne fait rien ou du moins mon information n'est pas sauvegardée.
Si je trie mes clients en ordre inverse, je pourrais modifier ZINA mais plus ALBERT..

Bref, je ne trouve nulle part de limite de 142 lignes et n'étant pas développeur, je suis perdu.

Si quelqu'un trouvait un souci quelque part dans le code ou avait une piste sur d'où pourrait venir cette "limite", je suis preneur.

Merci d'avance à ceux qui prendront un peu de temps pour lire tout ca !