diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index b3c9a903028..755c1f8421f 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Jean-François Ferry * @@ -237,6 +237,12 @@ if ($user->rights->banque->supprimer) $arrayofmassactions['delete']=$langs->tran if ($massaction == 'presend') $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); +$newcardbutton=''; +if ($user->rights->banque->configurer) +{ + $newcardbutton.=''.$langs->trans("NewFinancialAccount").''; +} + // Lines of title fields print '
'; @@ -248,7 +254,7 @@ print ''; print ''; print ''; -print_barre_liste($title,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_bank.png',0,'','',$limit, 1); +print_barre_liste($title,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_bank.png',0,$newcardbutton,'',$limit, 1); if ($sall) @@ -415,10 +421,12 @@ print ''; -$total = array(); $found = 0; $i=0; +$total = array(); $found = 0; $i=0; $lastcurrencycode=''; $var=true; foreach ($accounts as $key=>$type) { + if ($i >= $limit) break; + $found++; $acc = new Account($db); @@ -427,6 +435,15 @@ foreach ($accounts as $key=>$type) $var = !$var; $solde = $acc->solde(1); + if (! empty($lastcurrencycode) && $lastcurrencycode != $acc->currency_code) + { + $lastcurrencycode='various'; // We found several different currencies + } + if ($lastcurrencycode != 'various') + { + $lastcurrencycode=$acc->currency_code; + } + print ''; // Ref @@ -486,7 +503,6 @@ foreach ($accounts as $key=>$type) if (! $i) $totalarray['nbfield']++; } - // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -565,7 +581,7 @@ foreach ($accounts as $key=>$type) if (! $found) print ''.$langs->trans("None").''; // Show total line -if (isset($totalarray['totalbalancefield'])) +if (isset($totalarray['totalbalancefield']) && $lastcurrencycode != 'various') // If there is several currency, $lastcurrencycode is set to 'various' before { print ''; $i=0; @@ -577,7 +593,7 @@ if (isset($totalarray['totalbalancefield'])) if ($num < $limit) print ''.$langs->trans("Total").''; else print ''.$langs->trans("Totalforthispage").''; } - elseif ($totalarray['totalbalancefield'] == $i) print ''.price($totalarray['totalbalance'], 0, $langs, 0, 0, -1, $key).''; + elseif ($totalarray['totalbalancefield'] == $i) print ''.price($totalarray['totalbalance'], 0, $langs, 0, 0, -1, $lastcurrencycode).''; else print ''; } print ''; @@ -589,18 +605,6 @@ print ""; print "
"; -/* - * Buttons actions - */ - -print '
'."\n"; -if ($user->rights->banque->configurer) -{ - print ''.$langs->trans("NewFinancialAccount").''; -} -print '
'; - - llxFooter(); $db->close();