From fb4f74d48f9e9be103a417c045a3fc147a0b5f13 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 19 Jun 2026 12:32:43 -0400 Subject: [PATCH] Update mobile registration links and enhance access logic This commit modifies the mobile registration links to point to the correct routes, ensuring proper navigation for users. Additionally, it refines the logic for displaying mobile access based on user permissions, introducing a new function to check for legacy promoteur menu access. These changes improve the user experience and maintain consistency in the mobile module's functionality. --- compte.php | 1 + inc_tableau_promoteur.php | 2 +- php/inc_fx_compte.php | 5 +++-- php/inc_fx_inscriptions_mobile.php | 20 ++++++++++++++++++++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/compte.php b/compte.php index f4b289d..d13dbb1 100644 --- a/compte.php +++ b/compte.php @@ -709,6 +709,7 @@ require_once("inc_header.php"); $blnBoutonRetour = false; $footer_script = true; $blnHideCompteTitle = true; + fxInscrMobileInitTextes($strLangue); include("inc_tableau_inscriptions_mobile.php"); break; case 'compte_inc_tableau_mail_entraineurs': diff --git a/inc_tableau_promoteur.php b/inc_tableau_promoteur.php index e489c64..46e0cb7 100644 --- a/inc_tableau_promoteur.php +++ b/inc_tableau_promoteur.php @@ -263,7 +263,7 @@ if ($intEveId != 0) { diff --git a/php/inc_fx_compte.php b/php/inc_fx_compte.php index 7f75937..b7e299e 100644 --- a/php/inc_fx_compte.php +++ b/php/inc_fx_compte.php @@ -1493,12 +1493,13 @@ function fxShowMenuCompte($arrCompteClient, $strLangue) } - // Inscriptions mobile v2 (independant du legacy promoteur) + // Inscriptions mobile v2 — lien /mobile seulement si pas de menu promoteur legacy if (!function_exists('fxInscrMobileGetPromoteurEveIds')) { require_once dirname(__FILE__) . '/inc_fx_inscriptions_mobile.php'; } $arrMobileEveIds = fxInscrMobileGetPromoteurEveIds($arrCompteClient['com_id']); - if (count($arrMobileEveIds) > 0) { + $blnShowMobileDirect = (count($arrMobileEveIds) > 0 && !fxInscrMobileUserHasPromoteurMenu($arrCompteClient['com_id'])); + if ($blnShowMobileDirect) { $strMobileUrl = $vDomaine . '/mobile'; if (count($arrMobileEveIds) === 1) { $strMobileUrl .= '?promoteur_eve_id=' . urlencode(base64_encode($arrMobileEveIds[0])); diff --git a/php/inc_fx_inscriptions_mobile.php b/php/inc_fx_inscriptions_mobile.php index a78537a..b026ba2 100644 --- a/php/inc_fx_inscriptions_mobile.php +++ b/php/inc_fx_inscriptions_mobile.php @@ -2,12 +2,32 @@ /** * Liste inscriptions mobile — recherche, filtres, cartes, fiche. + * + * Deux entrees distinctes (meme module, navigation differente) : + * - Promoteur : /compte/inc_tableau_inscriptions_mobile → retour inc_tableau_promoteur + * - Acces v2 seul : /mobile → retour /mobile ou Mon compte + * + * Droits : v2 uniquement (fxInscrMobileCanAccess). i18n : toujours info_prg compte.php. */ function fxInscrMobileIsEntry() { return defined('MS1_INSCR_MOBILE_ENTRY') && MS1_INSCR_MOBILE_ENTRY; } +/** Utilisateur avec menu promoteur legacy (section Info promoteur). */ +function fxInscrMobileUserHasPromoteurMenu($intComId) { + global $objDatabase; + + $row = $objDatabase->fxGetRow( + 'SELECT com_eve_promoteur, com_rapports FROM inscriptions_comptes WHERE com_id = ' . intval($intComId) + ); + if ($row === null) { + return false; + } + + return trim((string)$row['com_eve_promoteur']) !== '' || trim((string)$row['com_rapports']) !== ''; +} + /** Permissions v2 requises pour la fiche inscriptions mobile (web). */ function fxInscrMobilePermKeysView() { return array('registrations.view', 'inscriptions_mobile.view');