diff --git a/inc_tableau_eve_acces.php b/inc_tableau_eve_acces.php index 799fb13..0332864 100644 --- a/inc_tableau_eve_acces.php +++ b/inc_tableau_eve_acces.php @@ -19,10 +19,13 @@ if (isset($_GET['promoteur_eve_id'])) { $strLangue = ($strLangue === 'en') ? 'en' : 'fr'; $strBasePath = ($strLangue === 'en') ? '/account' : '/compte'; -$strRedirect = $vDomaine . $strBasePath; -if (!empty($_GET['promoteur_eve_id'])) { - $strRedirect .= '/inc_tableau_promoteur?promoteur_eve_id=' . urlencode($_GET['promoteur_eve_id']); +// MSIN-4399 — deny : hub + focus si dispo, sinon ancien tableau. +if (!function_exists('fxPromoteurHubOrLegacyBackUrl')) { + require_once __DIR__ . '/php/inc_fx_promoteur_hub.php'; } +$strRedirect = ($intEveId > 0) + ? fxPromoteurHubOrLegacyBackUrl($intEveId, $strLangue) + : ($vDomaine . $strBasePath); $intActor = intval($_SESSION['com_id'] ?? 0); if (!empty($_SESSION['usa_id'])) { diff --git a/inc_tableau_gestion_epreuves.php b/inc_tableau_gestion_epreuves.php index 78c4b7f..48d4220 100644 --- a/inc_tableau_gestion_epreuves.php +++ b/inc_tableau_gestion_epreuves.php @@ -32,10 +32,8 @@ if (isset($_GET['promoteur_eve_id'])) { if ($intEveId <= 0 || (empty($_SESSION['com_id']) && empty($_SESSION['usa_id'])) || (empty($_SESSION['usa_id']) && !fxEveAccesHasAnyPermission($_SESSION['com_id'] ?? 0, $intEveId, array('dossards.manage', 'epreuves.edit_qte')))) { - $strRedirect = $vDomaine . '/compte/inc_tableau_promoteur'; - if (!empty($_GET['promoteur_eve_id'])) { - $strRedirect .= '?promoteur_eve_id=' . urlencode($_GET['promoteur_eve_id']); - } + // MSIN-4399 — même retour que le bouton back (hub + focus si dispo). + $strRedirect = fxGetPromoteurBackUrl($intEveId > 0 ? $intEveId : 0, $strPage); header('Location: ' . $strRedirect); exit; } diff --git a/php/inc_fx_inscriptions_gestion.php b/php/inc_fx_inscriptions_gestion.php index 72cfecf..e2d1d75 100644 --- a/php/inc_fx_inscriptions_gestion.php +++ b/php/inc_fx_inscriptions_gestion.php @@ -608,21 +608,13 @@ function fxInscrGestionListBackLabel($strLangue) { * hub promoteur si dispo (avec focus sur l'événement), sinon ancien tableau promoteur. */ function fxInscrGestionListBackUrl($intEveId, $strLangue) { - global $vDomaine; - $strLangue = ($strLangue === 'en') ? 'en' : 'fr'; - $intComId = intval($_SESSION['com_id'] ?? 0); - if (!function_exists('fxPromoteurHubIsAvailable')) { + if (!function_exists('fxPromoteurHubOrLegacyBackUrl')) { require_once __DIR__ . '/inc_fx_promoteur_hub.php'; } - if ($intComId > 0 && fxPromoteurHubIsAvailable($intComId)) { - return fxPromoteurHubUrl($strLangue, $intEveId); - } - - return $vDomaine . ($strLangue === 'fr' ? '/compte/inc_tableau_promoteur' : '/account/inc_tableau_promoteur') - . '?promoteur_eve_id=' . rawurlencode(base64_encode((string)$intEveId)); + return fxPromoteurHubOrLegacyBackUrl($intEveId, $strLangue); } function fxInscrGestionShouldShowListBack($intComId) { diff --git a/php/inc_fx_promoteur.php b/php/inc_fx_promoteur.php index 42e2da6..700f458 100644 --- a/php/inc_fx_promoteur.php +++ b/php/inc_fx_promoteur.php @@ -3028,6 +3028,7 @@ function renderBatchConfig($epr_id, $eve_id, $strLangue = 'fr', $isTeamEpreuve = /** * URL de retour promoteur selon ?from= (whitelist). * $strDefault si from absent — ex. liste_attente : epreuves, gestion_epreuves : promoteur. + * MSIN-4399 — from=promoteur → hub V2 + focus événement si le hub est disponible. */ function fxGetPromoteurBackUrl($intEveId, $strPage = '/compte', $strDefault = 'promoteur') { global $vDomaine; @@ -3044,6 +3045,15 @@ function fxGetPromoteurBackUrl($intEveId, $strPage = '/compte', $strDefault = 'p $strFrom = $strDefault; } + if ($strFrom === 'promoteur') { + if (!function_exists('fxPromoteurHubOrLegacyBackUrl')) { + require_once __DIR__ . '/inc_fx_promoteur_hub.php'; + } + $strLangue = ($strPage === '/account') ? 'en' : 'fr'; + + return fxPromoteurHubOrLegacyBackUrl($intEveId, $strLangue); + } + $strEveParam = 'promoteur_eve_id=' . urlencode(base64_encode($intEveId)); return $vDomaine . $strPage . '/' . $arrAllowed[$strFrom] . '?' . $strEveParam; } diff --git a/php/inc_fx_promoteur_hub.php b/php/inc_fx_promoteur_hub.php index f8f6fe0..c751d0a 100644 --- a/php/inc_fx_promoteur_hub.php +++ b/php/inc_fx_promoteur_hub.php @@ -74,6 +74,28 @@ function fxPromoteurHubUrl($strLangue = 'fr', $intEveId = 0) return $strUrl; } +/** + * MSIN-4399 — Retour « tableau promoteur » depuis un menu V2 : + * hub + focus eve si dispo, sinon ancien inc_tableau_promoteur. + */ +function fxPromoteurHubOrLegacyBackUrl($intEveId, $strLangue = 'fr') +{ + global $vDomaine; + + $strLangue = ($strLangue === 'en') ? 'en' : 'fr'; + $intEveId = intval($intEveId); + $intComId = intval($_SESSION['com_id'] ?? 0); + + if ($intComId > 0 && fxPromoteurHubIsAvailable($intComId)) { + return fxPromoteurHubUrl($strLangue, $intEveId); + } + + $strPage = ($strLangue === 'en') ? '/account' : '/compte'; + + return $vDomaine . $strPage . '/inc_tableau_promoteur' + . '?promoteur_eve_id=' . urlencode(base64_encode((string)$intEveId)); +} + /** * MSIN-4399 — eve_id à ouvrir automatiquement sur le hub (?hub_eve= ou promoteur_eve_id). */