'error', 'message' => 'fatal', 'detail' => $strDetail)); }); require_once 'php/inc_fonctions.php'; require_once 'php/inc_fx_promoteur.php'; require_once 'php/inc_fx_inscriptions_gestion.php'; // Necessaire pour fxEveAccesResolveEveIdFromParId() appelee dans le case // 'par_statut_course' : ce fichier n'est sinon charge que paresseusement // (fxInscrGestionLoadEveAcces) APRES ce premier appel -> fatal undefined function. require_once 'php/inc_fx_eve_acces.php'; $intComId = intval($_SESSION['com_id'] ?? 0); $strAction = trim((string)($_REQUEST['a'] ?? '')); $strLangue = trim((string)($_REQUEST['lang'] ?? 'fr')); if ($strLangue === '' || !in_array($strLangue, array('fr', 'en'), true)) { $strLangue = 'fr'; } $vPage = 'compte.php'; $vtexte_page = obtenirTextepage($vPage, $strLangue, 2); fxInscrGestionInitTextes($strLangue); if ($intComId <= 0) { $GLOBALS['__inscr_gestion_done'] = true; // MSIN-4401 — code session : le client recharge pour afficher le login. echo json_encode(array('state' => 'error', 'code' => 'session', 'message' => 'session')); exit; } $tabRetour = array('state' => 'error'); try { switch ($strAction) { case 'par_statut_course': $intParId = intval($_REQUEST['par_id'] ?? 0); $strStatut = trim((string)($_REQUEST['par_statut_course'] ?? '')); $intEveId = fxEveAccesResolveEveIdFromParId($intParId); if ($intEveId <= 0 || !fxInscrGestionCanDo($intComId, $intEveId, 'inscriptions_gestion.statut_edit')) { $tabRetour = array('state' => 'error', 'message' => 'unauthorized'); break; } $tabRetour = fxSetParStatutCourse($intParId, $strStatut, $strLangue); break; case 'refund_form': // Charge le formulaire de remboursement mutualise pour la fiche de gestion (panneau repliable). $strNoPanier = trim((string)($_REQUEST['no_panier'] ?? '')); if ($strNoPanier === '') { $tabRetour = array('state' => 'error', 'message' => 'no_panier_manquant'); break; } // Meme source que le Super Admin : la commande vient de inscriptions_panier_acheteurs. $sqlCmd = "SELECT *, IF(a.com_id <> 0, (SELECT c.com_login FROM inscriptions_comptes c WHERE a.com_id = c.com_id), '') AS usager" . " FROM inscriptions_panier_acheteurs a, inscriptions_panier_statuts s" . " WHERE s.sta_id = a.sta_id AND a.no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "'"; $recCommandes = $objDatabase->fxGetRow($sqlCmd); if (!$recCommandes) { $tabRetour = array('state' => 'error', 'message' => 'commande_introuvable'); break; } // L'eve_id de contexte = evenement de la fiche (participant), pas seulement celui du checkout. require_once $_SERVER['DOCUMENT_ROOT'] . '/superadm/php/inc_fx_paypal.php'; $intEveContext = intval($_REQUEST['eve_id'] ?? 0); if ($intEveContext <= 0) { $intEveContext = intval($recCommandes['eve_id']); } if ($intEveContext <= 0 || !fxInscrGestionCanDo($intComId, $intEveContext, 'inscriptions_gestion.refund')) { $tabRetour = array('state' => 'error', 'message' => 'unauthorized'); break; } if (!fxRefundPanierLinkedToEvent($recCommandes['no_panier'], $intEveContext, intval($recCommandes['eve_id']))) { $tabRetour = array('state' => 'error', 'message' => 'panier_evenement_incompatible'); break; } $strRefundToken = fxRefundEnsureToken(); $arrRefundCtx = fxRefundComputeContext($recCommandes, $intEveContext); // Auteur = promoteur connecte (alimente l'encart "Ajoute par" du formulaire). $strAuteur = trim((string)($_SESSION['com_info']['com_prenom'] ?? '') . ' ' . (string)($_SESSION['com_info']['com_nom'] ?? '')); // Markup seul (sans