diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php
index 95ebdf05925..9e417989f58 100644
--- a/htdocs/compta/bank/account.php
+++ b/htdocs/compta/bank/account.php
@@ -23,17 +23,24 @@
*
*/
+/*! \file htdocs/compta/bank/account.php
+ \ingroup banque
+ \brief Page de détail des transactions bancaires
+ \version $Revision$
+*/
+
require("./pre.inc.php");
if (!$user->rights->banque->lire)
accessforbidden();
+
$account=isset($_GET["account"])?$_GET["account"]:$_POST["account"];
$vline=isset($_GET["vline"])?$_GET["vline"]:$_POST["vline"];
$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
$page=isset($_GET["page"])?$_GET["page"]:0;
-if ($action == 'add' && $account)
+if ($_POST["action"] == 'add' && $account)
{
if ($_POST["credit"] > 0)
@@ -56,25 +63,23 @@ if ($action == 'add' && $account)
$insertid = $acct->addline($dateop, $operation, $label, $amount, $num_chq, $cat1);
- //print "
Account: insertid=$insertid - " . $action . " : ".$_GET["account"] . " - " . $_POST["account"]." - ".$account."
\n";
-
- if ($insertid == '')
+ if ($insertid)
{
- print "Erreur: Probleme d'insertion : ".$db->error();
+ Header("Location: account.php?account=" . $account);
}
else
{
- Header("Location: account.php?account=" . $account);
+ dolibarr_print_error($db);
}
}
-if ($action == 'del' && $account && $user->rights->banque->modifier)
+if ($_GET["action"] == 'del' && $account && $user->rights->banque->modifier)
{
$acct=new Account($db,$account);
- $acct->deleteline($_GET[$rowid]);
+ $acct->deleteline($_GET["rowid"]);
}
+
/***********************************************************************************
- *
*
*
*/
@@ -206,8 +211,9 @@ if ($account > 0)
print '';
print "\n";
print "\n";
+
/*
- *
+ * Affiche tableau des transactions bancaires
*
*/
if ($user->rights->banque->modifier)
@@ -217,14 +223,12 @@ if ($account > 0)
print '';
print '';
}
+
print '';
print '| Date Ope | Valeur | '.$langs->trans("Type").' | '.$langs->trans("Description").' | ';
print 'Débit | Crédit | Solde | ';
print 'Relevé |
';
- // DEBUG
- // print "| $nbline | $viewline | total_lines $total_lines | limitsql $limitsql |
";
-
/* Another solution
* create temporary table solde type=heap select amount from llx_bank limit 100 ;
* select sum(amount) from solde ;
@@ -253,8 +257,6 @@ if ($account > 0)
}
}
-// $sql .= " AND b.dateo <= now()";
-
$sql .= " ORDER BY b.datev ASC";
$sql .= $db->plimit($limitsql, 0);
@@ -265,12 +267,12 @@ if ($account > 0)
}
/*
- * Opérations hors factures
+ * Formulaire de saisie d'une opération hors factures
*
*/
if ($user->rights->banque->modifier)
{
- print "| |
\n";
+ print "| |
\n";
print "";
print "| Saisie d'une transaction hors facture |
";
print '';
@@ -337,7 +339,7 @@ function _print_lines($db,$sql,$acct)
if ($objp->do > $time && !$sep)
{
$sep = 1 ;
- print "
| | ";
+ print "
| | ";
print "".price($total - $objp->amount)." | ";
print " | ";
print '
';
@@ -346,15 +348,7 @@ function _print_lines($db,$sql,$acct)
print "";
print "| ".strftime("%d %b %y",$objp->do)." | \n";
print "".strftime("%d/%m/%y",$objp->dv)." | \n";
- print "".$objp->fk_type." ".($objp->num_chq?$objp->num_chq:"")." | \n";
-
-// if ($objp->num_chq)
-// {
-// print "rowid&account=$acct->id\">$objp->label | ";
-// }
-// else
-// {
- //Xavier DUTOIT : Ajout d'un lien pour modifier la ligne
+ print "".$objp->fk_type." ".($objp->num_chq?$objp->num_chq:"")." | \n";
print "rowid&account=$acct->id\">$objp->label";
/*
* Ajout les liens
@@ -368,31 +362,30 @@ function _print_lines($db,$sql,$acct)
$k++;
}
print ' | ';
-// }
if ($objp->amount < 0)
{
- print "".price($objp->amount * -1)." | | \n";
+ print "".price($objp->amount * -1)." | | \n";
}
else
{
- print " | ".price($objp->amount)." | \n";
+ print " | ".price($objp->amount)." | \n";
}
if ($action !='search')
{
if ($total > 0)
{
- print ''.price($total)." | \n";
+ print ''.price($total)." | \n";
}
else
{
- print "".price($total)." | \n";
+ print "".price($total)." | \n";
}
}
else
{
- print '- | ';
+ print '- | ';
}
if ($objp->rappro)