MSIN-4474 — Implement return URL preservation for event modifications and participant management. Enhance navigation logic to ensure users return to the original list after actions like save or cancel. Introduce new functions to validate and resolve return URLs, maintaining consistency across the application. Increment version code.
This commit is contained in:
@ -450,7 +450,10 @@ if ($strLangue == 'fr') {
|
||||
strpath = '/book/';
|
||||
}
|
||||
|
||||
document.location.href = '<?php echo $vDomaine; ?>' + strpath + code + '/' + intEprId + '?promoteur=1&action=mod&pec_id=' + intPecId;
|
||||
// MSIN-4474 — ramener à la liste d'origine après Enregistrer / Annuler
|
||||
document.location.href = '<?php echo $vDomaine; ?>' + strpath + code + '/' + intEprId
|
||||
+ '?promoteur=1&action=mod&pec_id=' + intPecId
|
||||
+ '&return_url=' + encodeURIComponent(window.location.href);
|
||||
});
|
||||
<?php
|
||||
}
|
||||
@ -1353,9 +1356,13 @@ if ($strLangue == 'fr') {
|
||||
} else {
|
||||
echo '';
|
||||
} ?>';
|
||||
//sl
|
||||
// alert('<?php echo $vDomaine?>/' + strPage + '/' + strUrl + '/' + $("#sel_epreuve").val() + '?action=mod&switch=true' + strPromoteur + '&pec_id=<?php echo $_GET['pec_id']; ?>');
|
||||
document.location.href = '<?php echo $vDomaine?>/' + strPage + '/' + strUrl + '/' + $("#sel_epreuve").val() + '?action=mod&switch=true' + strPromoteur + '&pec_id=<?php echo isset($_GET['pec_id']) ? $_GET['pec_id'] : ''; ?>';
|
||||
// MSIN-4474 — préserver return_url au switch d'épreuve
|
||||
var strReturn = '';
|
||||
var $returnUrl = $("#return_url");
|
||||
if ($returnUrl.length && $returnUrl.val()) {
|
||||
strReturn = '&return_url=' + encodeURIComponent($returnUrl.val());
|
||||
}
|
||||
document.location.href = '<?php echo $vDomaine?>/' + strPage + '/' + strUrl + '/' + $("#sel_epreuve").val() + '?action=mod&switch=true' + strPromoteur + '&pec_id=<?php echo isset($_GET['pec_id']) ? $_GET['pec_id'] : ''; ?>' + strReturn;
|
||||
});
|
||||
$("#frm_participant").valid();
|
||||
<?php
|
||||
|
||||
@ -387,6 +387,57 @@ function fxGetReferer()
|
||||
return $url_retour;
|
||||
}
|
||||
|
||||
/**
|
||||
* MSIN-4474 — URL de retour après modif inscription (même hôte uniquement).
|
||||
* Préserve la liste d'origine (ex. inscriptions_gestion) via GET/POST return_url.
|
||||
*/
|
||||
function fxSafeReturnUrl($strUrl, $strFallback = '')
|
||||
{
|
||||
global $vDomaine;
|
||||
|
||||
$strUrl = trim((string)$strUrl);
|
||||
$strFallback = trim((string)$strFallback);
|
||||
|
||||
if ($strUrl === '') {
|
||||
return $strFallback;
|
||||
}
|
||||
|
||||
$arrDom = parse_url($vDomaine);
|
||||
$arrUrl = parse_url($strUrl);
|
||||
|
||||
if ($arrUrl === false || empty($arrUrl['host']) || empty($arrDom['host'])) {
|
||||
return $strFallback;
|
||||
}
|
||||
|
||||
if (stripos($arrUrl['host'], $arrDom['host']) === false) {
|
||||
return $strFallback;
|
||||
}
|
||||
|
||||
return $strUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* MSIN-4474 — Résout l'URL de retour pour le formulaire modifier (promoteur/client).
|
||||
* Ignore le referer s'il pointe déjà vers reserver/book (après Suivant / switch).
|
||||
*/
|
||||
function fxModInscriptionReturnUrl($strFallback = '')
|
||||
{
|
||||
$strCandidate = '';
|
||||
|
||||
if (!empty($_POST['return_url'])) {
|
||||
$strCandidate = $_POST['return_url'];
|
||||
} elseif (!empty($_GET['return_url'])) {
|
||||
$strCandidate = $_GET['return_url'];
|
||||
} elseif (!empty($_SERVER['HTTP_REFERER'])) {
|
||||
$strRef = (string)$_SERVER['HTTP_REFERER'];
|
||||
if (!preg_match('#/(reserver|book)(/|\\?|$)#i', $strRef)) {
|
||||
$strCandidate = $strRef;
|
||||
}
|
||||
}
|
||||
|
||||
return fxSafeReturnUrl($strCandidate, $strFallback);
|
||||
}
|
||||
|
||||
// fonction pour un message via la page contact (JSP)
|
||||
// param : données post, langue
|
||||
// créé : 2012-07-03
|
||||
|
||||
@ -1273,9 +1273,14 @@ LEFT JOIN inscriptions_panier_epreuves ee on e.epr_id=ee.epr_id
|
||||
else
|
||||
$strPage = 'account';
|
||||
|
||||
if ($_POST['promoteur'] == 1)
|
||||
header("Location: " . $vDomaine . '/' . $strPage . '/inc_tableau_promoteur?promoteur_eve_id=' . urlencode(base64_encode($tabEvenement['general']['eve_id'])));
|
||||
else
|
||||
if ($_POST['promoteur'] == 1) {
|
||||
// MSIN-4474 — retour à la page d'origine (gestion / promoteur), sinon tableau promoteur legacy
|
||||
$strReturnAfterMod = fxModInscriptionReturnUrl('');
|
||||
if ($strReturnAfterMod === '') {
|
||||
$strReturnAfterMod = $vDomaine . '/' . $strPage . '/inc_tableau_promoteur?promoteur_eve_id=' . urlencode(base64_encode($tabEvenement['general']['eve_id']));
|
||||
}
|
||||
header("Location: " . $strReturnAfterMod);
|
||||
} else
|
||||
header("Location: " . $vDomaine . '/' . $strPage);
|
||||
} else {
|
||||
header("Location: " . $tabData['url']);
|
||||
|
||||
@ -433,13 +433,16 @@ function fxShowFormParticipant($tabEvenement, $strAction, $strLangue, $intEpreuv
|
||||
</button>
|
||||
<?php
|
||||
} elseif ($strAction == 'mod') {
|
||||
// MSIN-4474 — conserver la page d'origine (liste promoteur / gestion inscriptions)
|
||||
$strReturnUrl = fxModInscriptionReturnUrl(fxGetReferer());
|
||||
?>
|
||||
<input type="hidden" id="promoteur_eve_id" name="promoteur_eve_id" value="<?php echo $tabEvenement['general']['eve_id']; ?>">
|
||||
<input type="hidden" id="return_url" name="return_url" value="<?php echo htmlspecialchars($strReturnUrl, ENT_QUOTES, 'UTF-8'); ?>">
|
||||
<button class="btn btn-primary rounded-0" id="btn_enregistrer_modif" name="btn_enregistrer_modif" type="submit">
|
||||
<i class="fa fa-check mr-2" aria-hidden="true"></i>
|
||||
<?php echo afficheTexte('btn_enregistrer', 0, 1, 1) ?>
|
||||
</button>
|
||||
<button class="btn btn-secondary rounded-0 btn_page_prec" data-code="<?php echo fxGetReferer(); ?>" type="button">
|
||||
<button class="btn btn-secondary rounded-0 btn_page_prec" data-code="<?php echo htmlspecialchars($strReturnUrl, ENT_QUOTES, 'UTF-8'); ?>" type="button">
|
||||
<i class="fa fa-cart-plus mr-2" aria-hidden="true"></i>
|
||||
<?php afficheTexte('btn_annulerinscriptions'); ?>
|
||||
</button>
|
||||
|
||||
@ -90,7 +90,9 @@ if (isset($_SESSION['com_info']['com_id'])) {
|
||||
strpath = '/book/';
|
||||
}
|
||||
|
||||
document.location.href = '<?php echo $vDomaine; ?>' + strpath + code + '/' + intEprId + '?promoteur=1&action=mod&pec_id=' + intPecId;
|
||||
document.location.href = '<?php echo $vDomaine; ?>' + strpath + code + '/' + intEprId
|
||||
+ '?promoteur=1&action=mod&pec_id=' + intPecId
|
||||
+ '&return_url=' + encodeURIComponent(window.location.href);
|
||||
});
|
||||
|
||||
$('.btn_update_panier').click(function () {
|
||||
|
||||
Reference in New Issue
Block a user