[SPIP] ~v3.0.12-->3.0.13
[ptitvelo/web/www.git] / www / prive / formulaires / selecteur / generique_fonctions.php
index 1b3d532..a39cf78 100644 (file)
@@ -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 $objet=="rubrique")){
                                        $select[] = $id_objet;
                                }
-                               elseif(!$type){
+                               elseif(!$type AND ($id_objet OR $objet=="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
+?>