Modif dans select_forme_juridique, la valeur non sélectionné doit être
positionnée sur 0 et non -1 qui n'existe pas dans la base.
This commit is contained in:
parent
ccf46fd47a
commit
12d5d00924
@ -166,50 +166,50 @@ class Form {
|
|||||||
*/
|
*/
|
||||||
Function select_forme_juridique($selected='')
|
Function select_forme_juridique($selected='')
|
||||||
{
|
{
|
||||||
print '<select name="forme_juridique_code">';
|
print '<select name="forme_juridique_code">';
|
||||||
|
|
||||||
// On recherche les formes juridiques actives des pays actifs
|
// On recherche les formes juridiques actives des pays actifs
|
||||||
$sql = "SELECT f.rowid, f.code as code , f.libelle as nom, f.active, p.libelle as libelle_pays, p.code as code_pays FROM llx_c_forme_juridique as f, llx_c_pays as p";
|
$sql = "SELECT f.rowid, f.code as code , f.libelle as nom, f.active, p.libelle as libelle_pays, p.code as code_pays FROM llx_c_forme_juridique as f, llx_c_pays as p";
|
||||||
$sql .= " WHERE f.fk_pays=p.rowid";
|
$sql .= " WHERE f.fk_pays=p.rowid";
|
||||||
$sql .= " AND f.active = 1 AND p.active = 1 ORDER BY code_pays, code ASC";
|
$sql .= " AND f.active = 1 AND p.active = 1 ORDER BY code_pays, code ASC";
|
||||||
|
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
$num = $this->db->num_rows();
|
$num = $this->db->num_rows();
|
||||||
$i = 0;
|
$i = 0;
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
$pays='';
|
$pays='';
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object( $i);
|
$obj = $this->db->fetch_object( $i);
|
||||||
if ($obj->code == 0) {
|
if ($obj->code == 0) {
|
||||||
print '<option value="0"> </option>';
|
print '<option value="0"> </option>';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($pays == '' || $pays != $obj->libelle_pays) {
|
if ($pays == '' || $pays != $obj->libelle_pays) {
|
||||||
// Affiche la rupture
|
// Affiche la rupture
|
||||||
print '<option value="-1">----- '.$obj->libelle_pays." -----</option>\n";
|
print '<option value="0">----- '.$obj->libelle_pays." -----</option>\n";
|
||||||
$pays=$obj->libelle_pays;
|
$pays=$obj->libelle_pays;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($selected > 0 && $selected == $obj->code)
|
if ($selected > 0 && $selected == $obj->code)
|
||||||
{
|
{
|
||||||
print '<option value="'.$obj->code.'" selected>['.$obj->code.'] '.$obj->nom.'</option>';
|
print '<option value="'.$obj->code.'" selected>['.$obj->code.'] '.$obj->nom.'</option>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<option value="'.$obj->code.'">['.$obj->code.'] '.$obj->nom.'</option>';
|
print '<option value="'.$obj->code.'">['.$obj->code.'] '.$obj->nom.'</option>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print "Erreur : $sql : ".$this->db->error();
|
print "Erreur : $sql : ".$this->db->error();
|
||||||
}
|
}
|
||||||
print '</select>';
|
print '</select>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user