Add traduction on type label

This commit is contained in:
aspangaro 2015-03-07 15:47:08 +01:00
parent 55db57d10c
commit 26b1f69025
2 changed files with 34 additions and 2 deletions

View File

@ -1420,6 +1420,39 @@ class ExpenseReport extends CommonObject
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
/**
* List of types
*
* @param int $active Active or not
* @return array
*/
function listOfTypes($active=1)
{
global $langs;
$ret=array();
$sql = "SELECT id, code, label";
$sql.= " FROM ".MAIN_DB_PREFIX."c_type_fees";
$sql.= " WHERE active = ".$active;
dol_syslog(get_class($this)."::listOfTypes", LOG_DEBUG);
$result = $this->db->query($sql);
if ( $result )
{
$num = $this->db->num_rows($result);
$i=0;
while ($i < $num)
{
$obj = $this->db->fetch_object($result);
$ret[$obj->code]=(($langs->trans($obj->code)!=$obj->code)?$langs->trans($obj->code):$obj->label);
$i++;
}
}
else
{
dol_print_error($this->db);
}
return $ret;
}
}

View File

@ -111,8 +111,7 @@ print '<tr class="liste_titre">';
print '<td colspan="4">'.$langs->trans("Statistics").'</td>';
print "</tr>\n";
//$listoftype=$tripandexpense_static->listOfTypes();
$listoftype=$label;
$listoftype=$tripandexpense_static->listOfTypes();
foreach ($listoftype as $code => $label)
{
$dataseries[]=array('label'=>$label,'data'=>(isset($somme[$code])?(int) $somme[$code]:0));