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 .= '
- Source : champ inscriptions_comptes.com_eve_promoteur —
- kit migration_legacy (tous les droits).
- Migration globale
-
Ce compte n'a aucun événement promoteur legacy.
- -
- com_eve_promoteur :
- = htmlspecialchars($arrStatus['legacy_csv'], ENT_QUOTES, 'UTF-8') ?>
-
migration_legacy absent — exécuter
- sql/MSIN-eve-acces-v2-phase4-role-grants-all.sql.
- | Événement | -v2 migration | -
|---|---|
| - = htmlspecialchars($arrEvent['eve_nom_fr'], ENT_QUOTES, 'UTF-8') ?> - (#= intval($arrEvent['eve_id']) ?>) - | -- - OK - - À migrer - - | -
Gérer les kits - · - Migration legacy
- -| Compte | -Courriel | -Groupe | -Dernière connexion | -Migré le | -Statut | -- | Aucun compte avec promoteur legacy. | '; - } else { - foreach ($arrReport as $arrRow) { - $strCompteUrl = 'index.php?t=' . urlencode(base64_encode('2')) - . '&a=mod&id=' . intval($arrRow['com_id']) - . '#eve-acces-migration'; - $strGroupe = $arrRow['com_groupe'] !== '' ? $arrRow['com_groupe'] : '—'; - $strLastVisit = fxEveAccesAdminFormatReportDatetime($arrRow['com_lastvisit']); - $strMigratedAt = fxEveAccesAdminFormatReportDatetime($arrRow['migrated_at']); - $intPendingEv = intval($arrRow['pending_count']); - ?> -
|---|---|---|---|---|---|---|
| = htmlspecialchars(trim($arrRow['com_prenom'] . ' ' . $arrRow['com_nom']), ENT_QUOTES, 'UTF-8') ?> | -= htmlspecialchars($arrRow['com_courriel'], ENT_QUOTES, 'UTF-8') ?> | -= htmlspecialchars($strGroupe, ENT_QUOTES, 'UTF-8') ?> | -= htmlspecialchars($strLastVisit, ENT_QUOTES, 'UTF-8') ?> | -= htmlspecialchars($strMigratedAt, ENT_QUOTES, 'UTF-8') ?> | -- 0) { ?> - = $intPendingEv ?> / = intval($arrRow['event_count']) ?> à migrer - - OK - - | -- - Fiche - - | -
- = count($arrReport) ?> compte(s) —
- dernière connexion = champ com_lastvisit (mis à jour à chaque login sur le site).
- |
- ||||||