diff --git a/gamuform_fonctions.php b/gamuform_fonctions.php index 70c2688..165cb38 100644 --- a/gamuform_fonctions.php +++ b/gamuform_fonctions.php @@ -29,6 +29,7 @@ function gamufiltre($objet, $champ, $ligne) { $valeur = $ligne[$champ] ?? ''; if (gamuform_objet_autoriser($objet)) { $T = gamuform_recup_tableau_objet($objet); + if (!empty($T)) { foreach ($T as $s) { if ( @@ -38,8 +39,15 @@ function gamufiltre($objet, $champ, $ligne) { and !empty($s['gamutable']['fonction']) ) { $filtre = $s['gamutable']['fonction']; - if (strpos($filtre, '_array_')) { - return $filtre($ligne) ?? ''; + if (strpos($filtre, '_array_') !== false) { + $f = substr($filtre, 7); + if (function_exists($f)) { + return $f($ligne) ?? ''; + } else if(function_exists($filtre)) { + return $filtre($ligne) ?? ''; + } else { + return ''; + } } else { return $filtre($valeur) ?? ''; }