diff --git a/ajax_inscr_gestion.php b/ajax_inscr_gestion.php index 73e6b26..19af69f 100644 --- a/ajax_inscr_gestion.php +++ b/ajax_inscr_gestion.php @@ -151,18 +151,27 @@ switch ($strAction) { break; case 'transaction_resume': - // Resume de la transaction (meme rendu que facture.php cote promoteur), affichable - // a tout moment depuis la barre Gestion via un panneau repliable independant. + // Resume de la transaction (meme rendu que facture.php cote promoteur) + detail des + // remboursements PayPal, affichable a tout moment via le panneau repliable de la barre Gestion. $strNoPanier = trim((string)($_REQUEST['no_panier'] ?? '')); if ($strNoPanier === '') { $tabRetour = array('state' => 'error', 'message' => 'no_panier_manquant'); break; } - // L'eve_id fait foi cote serveur : on le derive de la commande (jamais du client). - $intEveId = intval($objDatabase->fxGetVar( - "SELECT eve_id FROM inscriptions_panier_acheteurs WHERE no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "' LIMIT 1" - )); + // Commande complete (meme source que refund_form / Super Admin) : alimente fxRefundComputeContext. + $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 fait foi cote serveur (jamais le client). Acces = acces a la fiche : + // qui peut voir la transaction peut voir ses remboursements (decision produit). + $intEveId = intval($recCommandes['eve_id']); if ($intEveId <= 0 || !fxInscrGestionCanAccess($intComId, $intEveId)) { $tabRetour = array('state' => 'error', 'message' => 'unauthorized'); break; @@ -171,11 +180,23 @@ switch ($strAction) { require_once $_SERVER['DOCUMENT_ROOT'] . '/php/inc_fx_panier.php'; $strResume = fxShowPanier($strNoPanier, 0, 'web', 1, $strLangue); + // Detail des remboursements PayPal (meme rendu que Super Admin). N'apparait que + // s'il existe une capture PayPal exploitable ; sinon rien (les cas gratuits/non-PayPal + // sont deja couverts par la facture ci-dessus). + $strRefunds = ''; + require_once $_SERVER['DOCUMENT_ROOT'] . '/superadm/php/inc_fx_paypal.php'; + $arrRefundCtx = fxRefundComputeContext($recCommandes); + if (!empty($arrRefundCtx['ok'])) { + $strRefunds = '
' + . renderPayPalCaptureHtml($arrRefundCtx['paypaldetails']) + . '
'; + } + // Conteneur encadre (sans bascule interne : le bouton de la barre Gestion fait office de toggle). $strHtml = '
' - . '
' . $strResume . '
' + . '
' . $strResume . $strRefunds . '
' . '
'; $tabRetour = array('state' => 'ok', 'html' => $strHtml);