on est plus souple sur le nom de la fonction,
- si notre fonction commence par _array_maSuperFonction, on teste en premier si la fonction maSuperFonction() exist sinon on teste si _array_maSuperFonction() existe sinon return vide comme cela, on ne casse plus la compat
This commit is contained in:
parent
8c895ece29
commit
6a5b838289
1 changed files with 10 additions and 2 deletions
|
@ -29,6 +29,7 @@ function gamufiltre($objet, $champ, $ligne) {
|
||||||
$valeur = $ligne[$champ] ?? '';
|
$valeur = $ligne[$champ] ?? '';
|
||||||
if (gamuform_objet_autoriser($objet)) {
|
if (gamuform_objet_autoriser($objet)) {
|
||||||
$T = gamuform_recup_tableau_objet($objet);
|
$T = gamuform_recup_tableau_objet($objet);
|
||||||
|
|
||||||
if (!empty($T)) {
|
if (!empty($T)) {
|
||||||
foreach ($T as $s) {
|
foreach ($T as $s) {
|
||||||
if (
|
if (
|
||||||
|
@ -38,8 +39,15 @@ function gamufiltre($objet, $champ, $ligne) {
|
||||||
and !empty($s['gamutable']['fonction'])
|
and !empty($s['gamutable']['fonction'])
|
||||||
) {
|
) {
|
||||||
$filtre = $s['gamutable']['fonction'];
|
$filtre = $s['gamutable']['fonction'];
|
||||||
if (strpos($filtre, '_array_')) {
|
if (strpos($filtre, '_array_') !== false) {
|
||||||
|
$f = substr($filtre, 7);
|
||||||
|
if (function_exists($f)) {
|
||||||
|
return $f($ligne) ?? '';
|
||||||
|
} else if(function_exists($filtre)) {
|
||||||
return $filtre($ligne) ?? '';
|
return $filtre($ligne) ?? '';
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return $filtre($valeur) ?? '';
|
return $filtre($valeur) ?? '';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue