Fix: La liste des lignes à rapprocher était incomplète

This commit is contained in:
Laurent Destailleur 2005-04-09 00:52:36 +00:00
parent 10e4ef7c85
commit f041159221

View File

@ -20,7 +20,8 @@
* $Source$ * $Source$
*/ */
/** \file htdocs/compta/bank/rappro.php /**
\file htdocs/compta/bank/rappro.php
\ingroup banque \ingroup banque
\brief Page de rapprochement bancaire \brief Page de rapprochement bancaire
\version $Revision$ \version $Revision$
@ -60,7 +61,7 @@ if ($_POST["action"] == 'rappro')
$result = $db->query($sql); $result = $db->query($sql);
} }
} else { } else {
print dolibarr_print_error($db,$sql); dolibarr_print_error($db);
} }
} }
else { else {
@ -75,7 +76,7 @@ if ($_GET["action"] == 'del') {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank WHERE rowid=".$_GET["rowid"]; $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank WHERE rowid=".$_GET["rowid"];
$result = $db->query($sql); $result = $db->query($sql);
if (!$result) { if (!$result) {
print dolibarr_print_error($db,$sql); dolibarr_print_error($db);
} }
} }
@ -84,14 +85,14 @@ $result = $db->query($sql);
$options=""; $options="";
if ($result) { if ($result) {
$var=True; $var=True;
$num = $db->num_rows(); $num = $db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) { while ($i < $num) {
if ($options == "") { $options = "<option value=\"0\" selected>&nbsp;</option>"; } if ($options == "") { $options = "<option value=\"0\" selected>&nbsp;</option>"; }
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$options .= "<option value=\"$obj->rowid\">$obj->label</option>\n"; $i++; $options .= "<option value=\"$obj->rowid\">$obj->label</option>\n"; $i++;
} }
$db->free(); $db->free($result);
} }
@ -110,7 +111,7 @@ $result = $db->query($sql);
if ($result) if ($result)
{ {
$var=True; $var=True;
$num = $db->num_rows(); $num = $db->num_rows($result);
if ($num == 0) { if ($num == 0) {
header("Location: /compta/bank/account.php?account=".$_GET["account"]); header("Location: /compta/bank/account.php?account=".$_GET["account"]);
@ -127,18 +128,19 @@ if ($result)
// Affiche nom des derniers relevés // Affiche nom des derniers relevés
$nbmax=5; $nbmax=5;
$liste="";
$sql = "SELECT distinct num_releve FROM ".MAIN_DB_PREFIX."bank"; $sql = "SELECT distinct num_releve FROM ".MAIN_DB_PREFIX."bank";
$sql.= " WHERE fk_account=".$_GET["account"]; $sql.= " WHERE fk_account=".$_GET["account"];
$sql.= " ORDER BY num_releve DESC"; $sql.= " ORDER BY num_releve DESC";
$sql.= " LIMIT ".($nbmax+1); $sql.= " LIMIT ".($nbmax+1);
print $langs->trans("LastAccountStatements").' : '; print $langs->trans("LastAccountStatements").' : ';
$resultr=$db->query($sql); $resultr=$db->query($sql);
$liste="";
if ($resultr) if ($resultr)
{ {
$num=$db->num_rows(); $numr=$db->num_rows($resultr);
$i=0; $i=0;
while (($i < $num) && ($i < $nbmax)) while (($i < $numr) && ($i < $nbmax))
{ {
$objr = $db->fetch_object($resultr); $objr = $db->fetch_object($resultr);
$last_releve = $objr->num_releve; $last_releve = $objr->num_releve;