X-Git-Url: http://git.cyclocoop.org/?p=ptitvelo%2Fweb%2Fwww.git;a=blobdiff_plain;f=www%2Fprive%2Fformulaires%2Fselecteur%2Fgenerique_fonctions.php;h=7a3e79ca72eee23a5d51827e431a58716600e85c;hp=1b3d5326a3ffb8ec96bb05fa2a8ae437984e577b;hb=e847eea4a82a7396dd0abf860f9b30d654f38629;hpb=52cf8ed924d5dcd0c28dde4b6c3196be6ec2d4f7 diff --git a/www/prive/formulaires/selecteur/generique_fonctions.php b/www/prive/formulaires/selecteur/generique_fonctions.php index 1b3d532..7a3e79c 100644 --- a/www/prive/formulaires/selecteur/generique_fonctions.php +++ b/www/prive/formulaires/selecteur/generique_fonctions.php @@ -87,10 +87,10 @@ function picker_selected($selected, $type=''){ $id_objet = intval($captures[2]); // Si on cherche un type et que c'est le bon, on renvoit un tableau que d'identifiants - if (is_string($type) and $type == $objet and $id_objet){ + if (is_string($type) AND $type == $objet AND ($id_objet OR in_array($objet, array('racine', 'rubrique')))){ $select[] = $id_objet; } - elseif(!$type){ + elseif(!$type AND ($id_objet OR in_array($objet, array('racine', 'rubrique')))){ $select[] = array('objet' => $objet, 'id_objet' => $id_objet); } } @@ -169,7 +169,8 @@ function test_enfants_rubrique($id_rubrique,$types=array()){ while (count($fratrie) AND is_array($types) AND count($types)){ $type = array_shift($types); $h = sql_allfetsel("DISTINCT id_rubrique",table_objet_sql($type),sql_in('id_rubrique',$fratrie)); - $has = array_merge($has,array_map('reset',$h)); + $h = array_map('reset',$h); + $has = array_merge($has,$h); $fratrie = array_diff($fratrie,$h); } if (count($has)) @@ -181,4 +182,4 @@ function test_enfants_rubrique($id_rubrique,$types=array()){ return $has_child[$id_rubrique]?' ':''; } -?> \ No newline at end of file +?>