Little refactor of FormBank::select_type_comptes_financiers
This commit is contained in:
parent
ff83dd9afe
commit
b41016da70
@ -49,32 +49,11 @@ class FormBank
|
|||||||
* @param string $htmlname Nom champ formulaire
|
* @param string $htmlname Nom champ formulaire
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function select_type_comptes_financiers($selected=1,$htmlname='type')
|
public function select_type_comptes_financiers($selected = Account::TYPE_CURRENT, $htmlname = 'type')
|
||||||
{
|
{
|
||||||
global $langs;
|
$account = new Account($this->db);
|
||||||
$langs->load("banks");
|
|
||||||
|
|
||||||
$type_available=array(0,1,2);
|
print Form::selectarray($htmlname, $account->type_lib, $selected);
|
||||||
|
|
||||||
print '<select id="select'.$htmlname.'" class="flat" name="'.$htmlname.'">';
|
|
||||||
$num = count($type_available);
|
|
||||||
$i = 0;
|
|
||||||
if ($num)
|
|
||||||
{
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
if ($selected == $type_available[$i])
|
|
||||||
{
|
|
||||||
print '<option value="'.$type_available[$i].'" selected>'.$langs->trans("BankType".$type_available[$i]).'</option>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<option value="'.$type_available[$i].'">'.$langs->trans("BankType".$type_available[$i]).'</option>';
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print '</select>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user