From b82cbf1385c424cee705fd08f1a97e5b0fd73b7a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Nov 2013 15:35:10 +0100 Subject: [PATCH] Fix: current balance was visible when it should not Conflicts: htdocs/compta/bank/account.php --- htdocs/compta/bank/account.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 372ec9b6f8b..86e26612e2e 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -486,7 +486,7 @@ if ($id > 0 || ! empty($ref)) $var=true; $num = $db->num_rows($result); - $i = 0; $total = 0; $sep = 0; + $i = 0; $total = 0; $sep = -1; while ($i < $num) { @@ -499,13 +499,14 @@ if ($id > 0 || ! empty($ref)) // Is it a transaction in future ? $dos=dol_print_date($db->jdate($objp->do),'%Y%m%d'); //print "dos=".$dos." nows=".$nows; - if ($dos > $nows && !$sep) // Yes, we show a subtotal + if ($dos < $nows) $sep=0; // 0 means there was at least one line before current date + if ($dos > $nows && ! $sep) // We have found a line in future and we already found on line before current date { $sep = 1 ; print ''; print $langs->trans("CurrentBalance"); print ''; - print ''.price($total - $objp->amount).''; + print ''.price($total - $objp->amount).''; print " "; print ''; } @@ -747,10 +748,10 @@ if ($id > 0 || ! empty($ref)) if ($page == 0 && ! $mode_search) { print ''; - if ($sep) print ' '; + if ($sep > 0) print ' '; // If we had at least one line in future else print $langs->trans("CurrentBalance"); print ''; - print ''.price($total).''; + print ''.price($total).''; print ' '; print ''; }