Correction bug 14244 Probleme d'affichage lorsque le compte ne
contient aucune lignes a rapprocher
This commit is contained in:
parent
811810619c
commit
feddb25985
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -54,15 +54,15 @@ if ($_POST["action"] == 'rappro')
|
||||
$sql.= " fk_user_rappro=".$user->id;
|
||||
$sql.= " WHERE rowid=".$_POST["rowid"];
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($cat1 && $_POST["action"])
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ) VALUES ($rowid, $cat1)";
|
||||
$result = $db->query($sql);
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
if ($resql)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
@ -93,25 +93,25 @@ if ($_POST["action"] == 'rappro')
|
||||
*/
|
||||
if ($_GET["action"] == 'del') {
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank WHERE rowid=".$_GET["rowid"];
|
||||
$result = $db->query($sql);
|
||||
if (! $result) {
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql) {
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."bank_categ ORDER BY label";
|
||||
$result = $db->query($sql);
|
||||
$resql = $db->query($sql);
|
||||
$options="";
|
||||
if ($result) {
|
||||
if ($resql) {
|
||||
$var=True;
|
||||
$num = $db->num_rows($result);
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
if ($options == "") { $options = "<option value=\"0\" selected> </option>"; }
|
||||
$obj = $db->fetch_object($result);
|
||||
$obj = $db->fetch_object($resql);
|
||||
$options .= "<option value=\"$obj->rowid\">$obj->label</option>\n"; $i++;
|
||||
}
|
||||
$db->free($result);
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
|
||||
@ -126,161 +126,157 @@ $sql .= " FROM ".MAIN_DB_PREFIX."bank as b WHERE rappro=0 AND fk_account=".$_GET
|
||||
$sql .= " ORDER BY dateo";
|
||||
$sql .= " ASC LIMIT ".$conf->liste_limit;
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$var=True;
|
||||
$num = $db->num_rows($result);
|
||||
$var=True;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
if ($num == 0)
|
||||
print_titre('Rapprochement compte bancaire : <a href="account.php?account='.$_GET["account"].'">'.$acct->label.'</a>');
|
||||
print '<br>';
|
||||
|
||||
if ($msg) {
|
||||
print "$msg<br><br>";
|
||||
}
|
||||
|
||||
// Affiche nom des derniers relevés
|
||||
$nbmax=5;
|
||||
$liste="";
|
||||
|
||||
$sql = "SELECT distinct num_releve FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql.= " WHERE fk_account=".$_GET["account"];
|
||||
$sql.= " ORDER BY num_releve DESC";
|
||||
$sql.= " LIMIT ".($nbmax+1);
|
||||
print $langs->trans("LastAccountStatements").' : ';
|
||||
$resqlr=$db->query($sql);
|
||||
if ($resqlr)
|
||||
{
|
||||
header("Location: /compta/bank/account.php?account=".$_GET["account"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
$numr=$db->num_rows($resqlr);
|
||||
$i=0;
|
||||
while (($i < $numr) && ($i < $nbmax))
|
||||
{
|
||||
$objr = $db->fetch_object($resqlr);
|
||||
$last_releve = $objr->num_releve;
|
||||
$i++;
|
||||
$liste='<a href="releve.php?account='.$_GET["account"].'&num='.$objr->num_releve.'">'.$objr->num_releve.'</a> '.$liste;
|
||||
}
|
||||
if ($num >= $nbmax) $liste="... ".$liste;
|
||||
print "$liste";
|
||||
if ($num > 0) print '<br><br>';
|
||||
else print $langs->trans("None").'<br><br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
print_titre('Rapprochement compte bancaire : <a href="account.php?account='.$_GET["account"].'">'.$acct->label.'</a>');
|
||||
print '<br>';
|
||||
|
||||
if ($msg) {
|
||||
print "$msg<br><br>";
|
||||
}
|
||||
|
||||
// Affiche nom des derniers relevés
|
||||
$nbmax=5;
|
||||
$liste="";
|
||||
|
||||
$sql = "SELECT distinct num_releve FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql.= " WHERE fk_account=".$_GET["account"];
|
||||
$sql.= " ORDER BY num_releve DESC";
|
||||
$sql.= " LIMIT ".($nbmax+1);
|
||||
print $langs->trans("LastAccountStatements").' : ';
|
||||
$resultr=$db->query($sql);
|
||||
if ($resultr)
|
||||
{
|
||||
$numr=$db->num_rows($resultr);
|
||||
$i=0;
|
||||
while (($i < $numr) && ($i < $nbmax))
|
||||
{
|
||||
$objr = $db->fetch_object($resultr);
|
||||
$last_releve = $objr->num_releve;
|
||||
$i++;
|
||||
$liste='<a href="releve.php?account='.$_GET["account"].'&num='.$objr->num_releve.'">'.$objr->num_releve.'</a> '.$liste;
|
||||
}
|
||||
if ($num >= $nbmax) $liste="... ".$liste;
|
||||
print "$liste";
|
||||
if ($num > 0) print '<br><br>';
|
||||
else print $langs->trans("None").'<br><br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print '<td>'.$langs->trans("Date").'</td>';
|
||||
print '<td>'.$langs->trans("DateValue").'</td>';
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Debit").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Credit").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Action").'</td>';
|
||||
print '<td align="center" width="100" colspan="2">'.$langs->trans("AccountStatement").' (Ex: YYYYMM)</td>';
|
||||
print "</tr>\n";
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print "<tr class=\"liste_titre\">\n";
|
||||
print '<td>'.$langs->trans("Date").'</td>';
|
||||
print '<td>'.$langs->trans("DateValue").'</td>';
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Debit").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Credit").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Action").'</td>';
|
||||
print '<td align="center" width="100" colspan="2">'.$langs->trans("AccountStatement").' (Ex: YYYYMM)</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<form method="post" action="rappro.php?account='.$_GET["account"].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"rappro\">";
|
||||
print "<input type=\"hidden\" name=\"account\" value=\"".$_GET["account"]."\">";
|
||||
print "<input type=\"hidden\" name=\"rowid\" value=\"".$objp->rowid."\">";
|
||||
|
||||
print '<td nowrap>'.dolibarr_print_date($objp->do).'</td>';
|
||||
print '<td nowrap>'.dolibarr_print_date($objp->dv).'</td>';
|
||||
print '<td nowrap>'.$objp->type.($objp->num_chq?' '.$objp->num_chq:'').'</td>';
|
||||
print '<td>'.$objp->label.'</td>';
|
||||
|
||||
if ($objp->amount < 0)
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<form method="post" action="rappro.php?account='.$_GET["account"].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"rappro\">";
|
||||
print "<input type=\"hidden\" name=\"account\" value=\"".$_GET["account"]."\">";
|
||||
print "<input type=\"hidden\" name=\"rowid\" value=\"".$objp->rowid."\">";
|
||||
|
||||
print '<td nowrap>'.dolibarr_print_date($objp->do).'</td>';
|
||||
print '<td nowrap>'.dolibarr_print_date($objp->dv).'</td>';
|
||||
print '<td nowrap>'.$objp->type.($objp->num_chq?' '.$objp->num_chq:'').'</td>';
|
||||
print '<td>'.$objp->label.'</td>';
|
||||
|
||||
if ($objp->amount < 0)
|
||||
{
|
||||
print "<td align=\"right\" nowrap>".price($objp->amount * -1)."</td><td> </td>\n";
|
||||
print "<td align=\"right\" nowrap>".price($objp->amount * -1)."</td><td> </td>\n";
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
print "<td> </td><td align=\"right\" nowrap>".price($objp->amount)."</td>\n";
|
||||
print "<td> </td><td align=\"right\" nowrap>".price($objp->amount)."</td>\n";
|
||||
}
|
||||
|
||||
if ($objp->rappro)
|
||||
|
||||
if ($objp->rappro)
|
||||
{
|
||||
// Si ligne déjà rapprochée, on affiche relevé.
|
||||
print "<td align=\"center\"><a href=\"releve.php?num=$objp->num_releve&account=$acct->id\">$objp->num_releve</a></td>";
|
||||
// Si ligne déjà rapprochée, on affiche relevé.
|
||||
print "<td align=\"center\"><a href=\"releve.php?num=$objp->num_releve&account=$acct->id\">$objp->num_releve</a></td>";
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
// Si pas encore rapproché
|
||||
if ($user->rights->banque->modifier)
|
||||
// Si pas encore rapproché
|
||||
if ($user->rights->banque->modifier)
|
||||
{
|
||||
print '<td align="center" width="30">';
|
||||
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&account='.$acct->id.'">';
|
||||
print img_edit();
|
||||
print '</a> ';
|
||||
|
||||
if ($objp->do <= mktime() ) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/rappro.php?action=del&rowid='.$objp->rowid.'&account='.$acct->id.'">';
|
||||
print img_delete();
|
||||
print "</a>";
|
||||
}
|
||||
else {
|
||||
print " "; // On n'empeche la suppression car le raprochement ne pourra se faire qu'après la date passée et que l'écriture apparaissent bien sur le compte.
|
||||
}
|
||||
print "</td>";
|
||||
print '<td align="center" width="30">';
|
||||
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&account='.$acct->id.'">';
|
||||
print img_edit();
|
||||
print '</a> ';
|
||||
|
||||
if ($objp->do <= mktime() ) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/rappro.php?action=del&rowid='.$objp->rowid.'&account='.$acct->id.'">';
|
||||
print img_delete();
|
||||
print "</a>";
|
||||
}
|
||||
else {
|
||||
print " "; // On n'empeche la suppression car le raprochement ne pourra se faire qu'après la date passée et que l'écriture apparaissent bien sur le compte.
|
||||
}
|
||||
print "</td>";
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
print "<td align=\"center\"> </td>";
|
||||
print "<td align=\"center\"> </td>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Affiche bouton "Rapprocher"
|
||||
if ($objp->do <= mktime() ) {
|
||||
print "<td align=\"center\">";
|
||||
print "<input class=\"flat\" name=\"num_releve\" type=\"text\" value=\"\" size=\"8\">";
|
||||
if ($options) {
|
||||
print "<br><select name=\"cat1\">$options";
|
||||
print "</select>";
|
||||
}
|
||||
print "</td>";
|
||||
print "<td align=\"center\"><input class=\"button\" type=\"submit\" value=\"".$langs->trans("Rapprocher")."\">";
|
||||
print "</td>";
|
||||
}
|
||||
else {
|
||||
print "<td align=\"left\" colspan=\"2\">";
|
||||
print "Ecriture future. Ne peut pas encore être rapprochée.";
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
print "</tr>";
|
||||
|
||||
print "</form>";
|
||||
$i++;
|
||||
|
||||
|
||||
// Affiche bouton "Rapprocher"
|
||||
if ($objp->do <= mktime() ) {
|
||||
print "<td align=\"center\">";
|
||||
print "<input class=\"flat\" name=\"num_releve\" type=\"text\" value=\"\" size=\"8\">";
|
||||
if ($options)
|
||||
{
|
||||
print "<br><select name=\"cat1\">$options";
|
||||
print "</select>";
|
||||
}
|
||||
print "</td>";
|
||||
print "<td align=\"center\"><input class=\"button\" type=\"submit\" value=\"".$langs->trans("Rapprocher")."\">";
|
||||
print "</td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td align=\"left\" colspan=\"2\">";
|
||||
print "Ecriture future. Ne peut pas encore être rapprochée.";
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
print "</form>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free($result);
|
||||
|
||||
if ($num != 0) {
|
||||
print "</table>";
|
||||
$db->free($resql);
|
||||
|
||||
if ($num != 0)
|
||||
{
|
||||
print "</table>\n";
|
||||
}
|
||||
|
||||
} else {
|
||||
dolibarr_print_error($db);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user