Refactor fxPromoteurHubGetEventLinks to enhance event access management by distinguishing between legacy and V2 permissions. Update documentation to clarify menu access based on user roles, ensuring a more intuitive experience for super admins and promoters. This aligns with MSIN-4401 requirements for improved event management functionality.
This commit is contained in:
@ -508,7 +508,10 @@ function fxPromoteurHubTexte($clef, $mem_echo = 0)
|
||||
* fidele a inc_tableau_promoteur.php.
|
||||
*/
|
||||
/**
|
||||
* MSIN-4401 — liens hub : legacy = menus complets ; V2 seul = pages cochées dans le kit.
|
||||
* MSIN-4401 — liens hub :
|
||||
* - Super admin / kit total (grants_all) → tout
|
||||
* - Accès V2 présent → menus selon les pages du kit (prioritaire sur legacy)
|
||||
* - Legacy seul (com_eve_promoteur, sans V2) → menus complets comme avant
|
||||
*/
|
||||
function fxPromoteurHubGetEventLinks($arrItem, $strLangue)
|
||||
{
|
||||
@ -532,11 +535,14 @@ function fxPromoteurHubGetEventLinks($arrItem, $strLangue)
|
||||
}
|
||||
|
||||
$blnSuper = !empty($_SESSION['usa_id']);
|
||||
$blnLegacy = $blnSuper || fxIsPromoteur($intComId, $intEveId);
|
||||
$blnGrantsAll = !$blnLegacy && fxEveAccesComEventHasGrantsAllKit($intComId, $intEveId);
|
||||
$blnHasV2 = fxEveAccesComHasV2ForEvent($intComId, $intEveId);
|
||||
$blnLegacyPromoteur = fxIsPromoteur($intComId, $intEveId);
|
||||
// Menus « tout ouvert » legacy seulement si PAS de kit V2 sur cet événement
|
||||
$blnLegacyMenus = $blnLegacyPromoteur && !$blnHasV2;
|
||||
$blnGrantsAll = $blnHasV2 && fxEveAccesComEventHasGrantsAllKit($intComId, $intEveId);
|
||||
|
||||
$fnCan = function ($arrKeys) use ($intComId, $intEveId, $blnSuper, $blnLegacy, $blnGrantsAll) {
|
||||
if ($blnSuper || $blnLegacy || $blnGrantsAll) {
|
||||
$fnCan = function ($arrKeys) use ($intComId, $intEveId, $blnSuper, $blnLegacyMenus, $blnGrantsAll) {
|
||||
if ($blnSuper || $blnLegacyMenus || $blnGrantsAll) {
|
||||
return true;
|
||||
}
|
||||
return fxEveAccesHasAnyPermission($intComId, $intEveId, $arrKeys);
|
||||
@ -581,7 +587,7 @@ function fxPromoteurHubGetEventLinks($arrItem, $strLangue)
|
||||
$arrRapports[] = array('label' => ($strLangue === 'fr' ? 'Paiements' : 'Payments'), 'url' => $strRapport . 'remboursements&e=' . $strE . '&lng=' . $strLangue, 'target' => '_blank');
|
||||
}
|
||||
|
||||
if (($blnLegacy || $blnGrantsAll || $fnCan(array('reports.custom'))) && function_exists('fxGetMenussuperadm')) {
|
||||
if (($blnLegacyMenus || $blnGrantsAll || $blnSuper || $fnCan(array('reports.custom'))) && function_exists('fxGetMenussuperadm')) {
|
||||
$tabRapports = fxGetMenussuperadm(0, 0, 1, $intEveId);
|
||||
if (is_array($tabRapports)) {
|
||||
for ($intCtr = 1; $intCtr <= count($tabRapports); $intCtr++) {
|
||||
@ -596,8 +602,8 @@ function fxPromoteurHubGetEventLinks($arrItem, $strLangue)
|
||||
|
||||
// ---- Gestion ----
|
||||
if (!$blnDon) {
|
||||
// Menus legacy (dossards / quantités classiques) : promoteur legacy seulement
|
||||
if ($blnLegacy) {
|
||||
// Menus legacy (dossards / quantités classiques) : promoteur legacy seul (sans kit V2)
|
||||
if ($blnLegacyMenus || $blnSuper || $blnGrantsAll) {
|
||||
$arrGestion[] = array('label' => fxPromoteurHubTexte('tableau_promoteur_menudossard', 0), 'url' => $strCompte . 'inc_tableau_dossards?promoteur_eve_id=' . $strE . '&lng=' . $strLangue, 'icon' => 'fa-id-card-o');
|
||||
|
||||
if (intval($arrItem['qte_modifiable'] ?? 0) == 1) {
|
||||
@ -611,7 +617,7 @@ function fxPromoteurHubGetEventLinks($arrItem, $strLangue)
|
||||
}
|
||||
}
|
||||
|
||||
if ($blnLegacy) {
|
||||
if ($blnLegacyMenus || $blnSuper || $blnGrantsAll) {
|
||||
$arrGestion[] = array('label' => fxPromoteurHubTexte('tableau_promoteur_menueinscription', 0), 'url' => $strCompte . 'inc_tableau_inscriptions?promoteur_eve_id=' . $strE . '&lng=' . $strLangue, 'icon' => 'fa-users');
|
||||
}
|
||||
|
||||
@ -640,7 +646,7 @@ function fxPromoteurHubGetEventLinks($arrItem, $strLangue)
|
||||
);
|
||||
}
|
||||
|
||||
if ($intTeId == 13 && $blnLegacy) {
|
||||
if ($intTeId == 13 && ($blnLegacyMenus || $blnSuper || $blnGrantsAll)) {
|
||||
$arrGestion[] = array('label' => fxPromoteurHubTexte('tableau_promoteur_envoie_email_questions', 0), 'url' => $strCompte . 'inc_tableau_mail_questions?promoteur_eve_id=' . $strE . '&lng=' . $strLangue, 'icon' => 'fa-paper-plane');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user