Fix: Renvoi chaine qd un chaine est attendue et tableau qd tableau attendu

This commit is contained in:
Laurent Destailleur 2007-12-06 09:50:51 +00:00
parent c1a2342e3a
commit 61baa919ed

View File

@ -3809,8 +3809,8 @@ function dol_genbarcode($code,$encoding,$generator=1,$readable='Y')
/** /**
\brief Retourne un tableau des mois ou le mois sélectionné \brief Retourne un tableau des mois ou le mois sélectionné
\param Mois sélectionné \param selected Mois à sélectionner ou -1
\return month \return string or array Month string or array if selected < 0
*/ */
function monthArrayOrSelected($selected=0) function monthArrayOrSelected($selected=0)
{ {
@ -3829,17 +3829,23 @@ function monthArrayOrSelected($selected=0)
11 => $langs->trans("November"), 11 => $langs->trans("November"),
12 => $langs->trans("December") 12 => $langs->trans("December")
); );
if ($selected)
if ($selected >=0)
{ {
$return='';
foreach ($month as $key => $val) foreach ($month as $key => $val)
{ {
if ($selected == $key) if ($selected == $key)
{ {
$month = $val; $return = $val;
} }
} }
return $return;
} }
else
{
return $month; return $month;
} }
}
?> ?>