diff --git a/php/inc_fx_inscriptions_gestion.php b/php/inc_fx_inscriptions_gestion.php
index 4e0451c..7d89373 100644
--- a/php/inc_fx_inscriptions_gestion.php
+++ b/php/inc_fx_inscriptions_gestion.php
@@ -1113,6 +1113,25 @@ function fxInscrGestionRenderList($intEveId, $strLangue, $strBaseUrl, $arrReq) {
$intFilterCount = fxInscrGestionFilterActiveCount($arrReq);
// La page arrive vide : on n'affiche les resultats qu'apres une recherche (meme vide = tout afficher).
$blnSearchActive = !empty($arrReq['q']);
+ $blnFreshSearch = !empty($_GET['btn_recherche']) || !empty($_GET['apply_filters']);
+ $tabRows = null;
+
+ // Un seul resultat apres soumission : redirection JS (header() impossible ici, la page est deja entamee).
+ if ($blnSearchActive && $blnFreshSearch) {
+ $tabRows = fxInscrGestionFetchRows($intEveId, $arrReq);
+ if ($tabRows !== null && count($tabRows) === 1) {
+ $strFicheUrl = fxInscrGestionBuildUrl($strBaseUrl, $intEveId, $arrReq, array(
+ 'pec_id' => (int)$tabRows[1]['pec_id_original'],
+ 'pg' => 1,
+ ));
+ echo '
';
+ echo '';
+ echo '';
+ echo '
';
+ return;
+ }
+ }
+
$strBackUrl = fxInscrGestionIsEntry()
? $strBaseUrl
: ($vDomaine . ($strLangue === 'fr' ? '/compte/inc_tableau_promoteur' : '/account/inc_tableau_promoteur')
@@ -1232,7 +1251,9 @@ function fxInscrGestionRenderList($intEveId, $strLangue, $strBaseUrl, $arrReq) {
}
// Résultats (la recherche a été lancée — une recherche vide affiche toutes les inscriptions).
- $tabRows = fxInscrGestionFetchRows($intEveId, $arrReq);
+ if ($tabRows === null) {
+ $tabRows = fxInscrGestionFetchRows($intEveId, $arrReq);
+ }
$intNbItemsParPage = 50;
$intNbTotal = ($tabRows !== null) ? count($tabRows) : 0;
$intPage = 1;
@@ -1558,18 +1579,5 @@ function fxInscrGestionRun($intEveId, $strLangue) {
return;
}
- // Un seul resultat apres une recherche/filtre soumis : ouvrir la fiche directement.
- if ($arrReq['q'] && (!empty($_GET['btn_recherche']) || !empty($_GET['apply_filters']))) {
- $tabRows = fxInscrGestionFetchRows($intEveId, $arrReq);
- if ($tabRows !== null && count($tabRows) === 1) {
- $strUrl = fxInscrGestionBuildUrl($strBaseUrl, $intEveId, $arrReq, array(
- 'pec_id' => (int)$tabRows[1]['pec_id_original'],
- 'pg' => 1,
- ));
- header('Location: ' . $strUrl);
- exit;
- }
- }
-
fxInscrGestionRenderList($intEveId, $strLangue, $strBaseUrl, $arrReq);
}