Fix: Correction pb fecth_object
This commit is contained in:
parent
af9e19a0bc
commit
b278f1adff
@ -106,7 +106,7 @@ if ($account > 0)
|
|||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$var=True;
|
$var=True;
|
||||||
$num = $db->num_rows();
|
$num = $db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$options = "<option value=\"0\" SELECTED></option>";
|
$options = "<option value=\"0\" SELECTED></option>";
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
@ -114,14 +114,14 @@ if ($account > 0)
|
|||||||
$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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."bank as b";
|
$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."bank as b";
|
||||||
$sql .= " WHERE b.fk_account=".$acct->id;
|
$sql .= " WHERE b.fk_account=".$acct->id;
|
||||||
$sql_rech="";
|
$sql_rech="";
|
||||||
if ($_POST["req_desc"])
|
if ($_POST["req_desc"])
|
||||||
@ -137,11 +137,12 @@ if ($account > 0)
|
|||||||
if ($_POST["req_credit"]) $sql_rech.=" AND amount = ".$_POST["req_credit"];
|
if ($_POST["req_credit"]) $sql_rech.=" AND amount = ".$_POST["req_credit"];
|
||||||
|
|
||||||
$sql .= $sql_rech;
|
$sql .= $sql_rech;
|
||||||
if ( $db->query($sql) )
|
$result=$db->query($sql);
|
||||||
|
if ($result)
|
||||||
{
|
{
|
||||||
$nbline = $db->result (0, 0);
|
$obj = $db->fetch_object($result);
|
||||||
|
$nbline = $obj->nb;
|
||||||
$total_lines = $nbline;
|
$total_lines = $nbline;
|
||||||
$db->free();
|
|
||||||
|
|
||||||
if ($nbline > $viewline )
|
if ($nbline > $viewline )
|
||||||
{
|
{
|
||||||
@ -151,6 +152,11 @@ if ($account > 0)
|
|||||||
{
|
{
|
||||||
$limit = $viewline;
|
$limit = $viewline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$db->free($result);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dolibarr_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($page > 0 && $mode_search == 0)
|
if ($page > 0 && $mode_search == 0)
|
||||||
@ -256,7 +262,7 @@ if ($account > 0)
|
|||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
_print_lines($db, $sql, $acct);
|
_print_lines($db, $result, $sql, $acct);
|
||||||
$db->free($result);
|
$db->free($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,99 +323,98 @@ llxFooter("<em>Dernière modification $Date$ révision $Revision$</e
|
|||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function _print_lines($db,$sql,$acct)
|
function _print_lines($db,$result,$sql,$acct)
|
||||||
{
|
{
|
||||||
global $bc, $nbline, $viewline, $user, $page;
|
global $bc, $nbline, $viewline, $user, $page;
|
||||||
$var=True;
|
$var=True;
|
||||||
$num = $db->num_rows();
|
$num = $db->num_rows($result);
|
||||||
$i = 0; $total = 0;
|
$i = 0; $total = 0; $sep = 0;
|
||||||
$sep = 0;
|
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object();
|
$objp = $db->fetch_object($result);
|
||||||
$total = $total + $objp->amount;
|
$total = $total + $objp->amount;
|
||||||
$time = time();
|
$time = time();
|
||||||
if ($i >= ($nbline - $viewline))
|
if ($i >= ($nbline - $viewline))
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
if ($objp->do > $time && !$sep)
|
if ($objp->do > $time && !$sep)
|
||||||
{
|
{
|
||||||
$sep = 1 ;
|
$sep = 1 ;
|
||||||
print "<tr><td align=\"right\" colspan=\"6\"> </td>";
|
print "<tr><td align=\"right\" colspan=\"6\"> </td>";
|
||||||
print "<td align=\"right\"><b>".price($total - $objp->amount)."</b></td>";
|
print "<td align=\"right\"><b>".price($total - $objp->amount)."</b></td>";
|
||||||
print "<td> </td>";
|
print "<td> </td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print "<td>".dolibarr_print_date($objp->do,"%d/%m/%y")."</td>\n";
|
print "<td>".dolibarr_print_date($objp->do,"%d/%m/%y")."</td>\n";
|
||||||
print "<td>".dolibarr_print_date($objp->dv,"%d/%m/%y")."</td>\n";
|
print "<td>".dolibarr_print_date($objp->dv,"%d/%m/%y")."</td>\n";
|
||||||
print "<td>".$objp->fk_type." ".($objp->num_chq?$objp->num_chq:"")."</td>\n";
|
print "<td>".$objp->fk_type." ".($objp->num_chq?$objp->num_chq:"")."</td>\n";
|
||||||
print "<td><a href=\"ligne.php?rowid=$objp->rowid&account=$acct->id\">$objp->label</a>";
|
print "<td><a href=\"ligne.php?rowid=$objp->rowid&account=$acct->id\">$objp->label</a>";
|
||||||
/*
|
/*
|
||||||
* Ajout les liens
|
* Ajout les liens
|
||||||
*/
|
*/
|
||||||
$urls_line = $acct->get_url($objp->rowid);
|
$urls_line = $acct->get_url($objp->rowid);
|
||||||
$numurl = sizeof($urls_line);
|
$numurl = sizeof($urls_line);
|
||||||
$k = 0;
|
$k = 0;
|
||||||
while ($k < $numurl)
|
while ($k < $numurl)
|
||||||
{
|
{
|
||||||
print ' <a href="'.$urls_line[$k][0].$urls_line[$k][1].'">'.$urls_line[$k][2].'</a>';
|
print ' <a href="'.$urls_line[$k][0].$urls_line[$k][1].'">'.$urls_line[$k][2].'</a>';
|
||||||
$k++;
|
$k++;
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
if ($objp->amount < 0)
|
if ($objp->amount < 0)
|
||||||
{
|
{
|
||||||
print "<td align=\"right\">".price($objp->amount * -1)."</td><td> </td>\n";
|
print "<td align=\"right\">".price($objp->amount * -1)."</td><td> </td>\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<td> </td><td align=\"right\">".price($objp->amount)."</td>\n";
|
print "<td> </td><td align=\"right\">".price($objp->amount)."</td>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action !='search')
|
if ($action !='search')
|
||||||
{
|
{
|
||||||
if ($total > 0)
|
if ($total > 0)
|
||||||
{
|
{
|
||||||
print '<td align="right">'.price($total)."</td>\n";
|
print '<td align="right">'.price($total)."</td>\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<td align=\"right\"><b>".price($total)."</b></td>\n";
|
print "<td align=\"right\"><b>".price($total)."</b></td>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td align="right">-</td>';
|
print '<td align="right">-</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($objp->rappro)
|
if ($objp->rappro)
|
||||||
{
|
{
|
||||||
print "<td align=\"center\"><a href=\"releve.php?num=$objp->num_releve&account=$acct->id\">$objp->num_releve</a></td>";
|
print "<td align=\"center\"><a href=\"releve.php?num=$objp->num_releve&account=$acct->id\">$objp->num_releve</a></td>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($user->rights->banque->modifier)
|
if ($user->rights->banque->modifier)
|
||||||
{
|
{
|
||||||
print "<td align=\"center\"><a href=\"account.php?action=del&rowid=$objp->rowid&account=$acct->id&page=$page\">";
|
print "<td align=\"center\"><a href=\"account.php?action=del&rowid=$objp->rowid&account=$acct->id&page=$page\">";
|
||||||
print img_delete();
|
print img_delete();
|
||||||
print "</a></td>";
|
print "</a></td>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<td align=\"center\"> </td>";
|
print "<td align=\"center\"> </td>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user