Ajout fonction de gestion des departements

This commit is contained in:
Rodolphe Quiedeville
2004-02-17 09:43:59 +00:00
parent 0c0d47c124
commit f8a9688a15

View File

@@ -32,6 +32,40 @@ class Form {
return 1;
}
/*
*
*
*/
Function select_departement($selected='', $addnsp=0)
{
print '<select name="departement_id">';
$sql = "SELECT rowid, code_departement as code , nom, active FROM llx_c_departements";
$sql .= " WHERE active = 1 ORDER BY code ASC";
if ($this->db->query($sql))
{
$num = $this->db->num_rows();
$i = 0;
if ($num)
{
while ($i < $num)
{
$obj = $this->db->fetch_object( $i);
if ($selected == $obj->rowid)
{
print '<option value="'.$obj->rowid.'" SELECTED>['.$obj->code.'] '.$obj->nom.'</option>';
}
else
{
print '<option value="'.$obj->rowid.'">['.$obj->code.'] '.$obj->nom.'</option>';
}
$i++;
}
}
}
print '</select>';
}
/*
*
*