Fix: Do not show a total of amount if currencies differs.

This commit is contained in:
Laurent Destailleur 2009-06-08 19:11:19 +00:00
parent e3e4148669
commit cd1c9e7ffa

View File

@ -19,10 +19,10 @@
*/ */
/** /**
\file htdocs/includes/boxes/box_comptes.php * \file htdocs/includes/boxes/box_comptes.php
\ingroup banque * \ingroup banque
\brief Module de génération de l'affichage de la box comptes * \brief Module de generation de l'affichage de la box comptes
\version $Id$ * \version $Id$
*/ */
include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php"); include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php");
@ -34,7 +34,7 @@ class box_comptes extends ModeleBoxes {
var $boxcode="currentaccounts"; var $boxcode="currentaccounts";
var $boximg="object_bill"; var $boximg="object_bill";
var $boxlabel; var $boxlabel;
var $depends = array("banque"); // Box active si module banque actif var $depends = array("banque"); // Box active if module banque active
var $db; var $db;
var $param; var $param;
@ -44,7 +44,7 @@ class box_comptes extends ModeleBoxes {
/** /**
* \brief Constructeur de la classe * \brief Constructor for class
*/ */
function box_comptes() function box_comptes()
{ {
@ -55,8 +55,8 @@ class box_comptes extends ModeleBoxes {
} }
/** /**
* \brief Charge les données en mémoire pour affichage ultérieur * \brief Load data into info_box_contents array to show array later.
* \param $max Nombre maximum d'enregistrements à charger * \param $max Maximum number of records to load
*/ */
function loadBox($max=5) function loadBox($max=5)
{ {
@ -89,6 +89,7 @@ class box_comptes extends ModeleBoxes {
$i = 0; $i = 0;
$solde_total = 0; $solde_total = 0;
$listofcurrencies=array();
$account_static = new Account($db); $account_static = new Account($db);
while ($i < $num) while ($i < $num)
{ {
@ -115,17 +116,21 @@ class box_comptes extends ModeleBoxes {
'text' => price($solde).' '.$langs->trans("Currency".$objp->currency_code) 'text' => price($solde).' '.$langs->trans("Currency".$objp->currency_code)
); );
$listofcurrencies[$objp->currency_code]=1;
$i++; $i++;
} }
// Total // Total
if (sizeof($listofcurrencies) < 1)
{
$this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'align="right" colspan="3" class="liste_total"', $this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'align="right" colspan="3" class="liste_total"',
'text' => $langs->trans('Total') 'text' => $langs->trans('Total')
); );
$totalamount=price($solde_total).' '.$langs->trans("Currency".$conf->monnaie);
$this->info_box_contents[$i][1] = array('td' => 'align="right" class="liste_total"', $this->info_box_contents[$i][1] = array('td' => 'align="right" class="liste_total"',
'text' => price($solde_total).' '.$langs->trans("Currency".$conf->monnaie) 'text' => $totalamount
); );
}
} }
else { else {
dol_print_error($db); dol_print_error($db);