diff --git a/php/inc_fonctions.php b/php/inc_fonctions.php index 60a636c..16ebed2 100644 --- a/php/inc_fonctions.php +++ b/php/inc_fonctions.php @@ -1574,6 +1574,10 @@ function fxIsPromoteur($intComId, $intEveId) { global $objDatabase; + if (!fxPromoteurLegacySiteEnabled()) { + return false; + } + $sql = "select * from inscriptions_comptes where FIND_IN_SET('" . intval($intEveId) . "',com_eve_promoteur) AND com_id = " . intval($intComId); $tab = $objDatabase->fxGetResults($sql); @@ -2041,6 +2045,31 @@ function fxGetVariable($strVarNom) return $strVarValeur; } +/** + * Interrupteur site : promoteur legacy (com_eve_promoteur / fxIsPromoteur) actif ? + * Defaut : oui (1). Super admin : bouton dans inc_droite (variables.promoteur_legacy_actif). + */ +function fxPromoteurLegacySiteEnabled() +{ + static $blnEnabled = null; + + if ($blnEnabled !== null) { + return $blnEnabled; + } + + global $objDatabase; + + if (!isset($objDatabase)) { + $blnEnabled = true; + return $blnEnabled; + } + + $strVal = fxGetVariable('promoteur_legacy_actif'); + $blnEnabled = ($strVal === null || $strVal === '' || intval($strVal) === 1); + + return $blnEnabled; +} + function fxGetMailHeader($blnTransaction = false, $strLangue = 'fr') { if ($blnTransaction) { diff --git a/php/inc_fx_compte.php b/php/inc_fx_compte.php index ecf9988..92d195c 100644 --- a/php/inc_fx_compte.php +++ b/php/inc_fx_compte.php @@ -1505,13 +1505,23 @@ function fxShowMenuCompte($arrCompteClient, $strLangue) $strRetour .= fxShowPromoteurHubMenuLink($arrCompteClient, $strLangue); // menu promoteur legacy + if (!function_exists('fxInscrGestionUserHasLegacyPromoteurMenu')) { + require_once dirname(__FILE__) . '/inc_fx_inscriptions_gestion.php'; + } - if (trim($arrCompteClient['com_eve_promoteur']) != '' || trim($arrCompteClient['com_rapports']) != '') { // si le compte client a des événements dont il est le promoteur - $arrEvePromoteur = explode(',', $arrCompteClient['com_eve_promoteur']); - $intNbEvePromoteur = fxcount($arrEvePromoteur); - $strNbEvenements = '(' . $intNbEvePromoteur . ' '; - $strNbEvenements .= ($intNbEvePromoteur > 1) ? afficheTexte('compte_evenement_pluriel', 0) : afficheTexte('compte_evenement_singulier', 0); - $strNbEvenements .= ')'; + $blnLegacyPromoteurMenu = fxInscrGestionUserHasLegacyPromoteurMenu($arrCompteClient['com_id']); + $blnHasRapports = trim($arrCompteClient['com_rapports']) != ''; + + if ($blnLegacyPromoteurMenu || $blnHasRapports) { + if ($blnLegacyPromoteurMenu) { + $arrEvePromoteur = explode(',', $arrCompteClient['com_eve_promoteur']); + $intNbEvePromoteur = fxcount($arrEvePromoteur); + $strNbEvenements = '(' . $intNbEvePromoteur . ' '; + $strNbEvenements .= ($intNbEvePromoteur > 1) ? afficheTexte('compte_evenement_pluriel', 0) : afficheTexte('compte_evenement_singulier', 0); + $strNbEvenements .= ')'; + } else { + $strNbEvenements = ''; + } $strRetour .= '