Update bib matching logic in inscription management to set 'exact' as the default option and adjust related comments for clarity. Enhance search reset functionality to include a query parameter for all inscriptions. Refactor conditions for matching to improve consistency in handling exact and partial matches.

This commit is contained in:
2026-07-14 08:25:59 -04:00
parent b9a8d5ffd2
commit c6bc9ce4b0

View File

@ -763,8 +763,8 @@ function fxInscrGestionParseRequest() {
'rech_nom' => isset($_GET['rech_nom']) ? trim($_GET['rech_nom']) : '',
'rech_no_commande' => isset($_GET['rech_no_commande']) ? trim($_GET['rech_no_commande']) : '',
'rech_nom_equipe' => isset($_GET['rech_nom_equipe']) ? trim($_GET['rech_nom_equipe']) : '',
// MSIN-4401 — Match dossard : exact | partial (défaut).
'bib_match' => (isset($_GET['bib_match']) && $_GET['bib_match'] === 'exact') ? 'exact' : 'partial',
// MSIN-4399 — Match dossard : exact (défaut) | partial.
'bib_match' => (isset($_GET['bib_match']) && $_GET['bib_match'] === 'partial') ? 'partial' : 'exact',
'chk_bib' => !empty($_GET['chk_bib']) ? 1 : 0,
'chk_cancelled' => !empty($_GET['chk_cancelled']) ? 1 : 0,
'sel_rech_epreuve' => 0,
@ -823,7 +823,7 @@ function fxInscrGestionEmptyListRequest() {
'rech_nom' => '',
'rech_no_commande' => '',
'rech_nom_equipe' => '',
'bib_match' => 'partial',
'bib_match' => 'exact',
'chk_bib' => 0,
'chk_cancelled' => 0,
'sel_rech_epreuve' => 0,
@ -836,7 +836,9 @@ function fxInscrGestionEmptyListRequest() {
}
function fxInscrGestionSearchResetUrl($strBaseUrl, $intEveId) {
return fxInscrGestionBuildUrl($strBaseUrl, $intEveId, fxInscrGestionEmptyListRequest(), array('pg' => 1));
// MSIN-4399 — Réinit = champs vides + toutes les inscriptions (q=1).
// Distinct de la 1re visite (sans q) qui n'affiche que l'invite.
return fxInscrGestionBuildUrl($strBaseUrl, $intEveId, fxInscrGestionEmptyListRequest(), array('pg' => 1, 'q' => 1));
}
function fxInscrGestionBuildWhere($intEveId, $arrReq) {
@ -856,8 +858,8 @@ function fxInscrGestionBuildWhere($intEveId, $arrReq) {
}
if ($arrReq['rech_nom_equipe'] !== '') {
$strEscBibEquipe = $objDatabase->fxEscape($arrReq['rech_nom_equipe']);
// MSIN-4401 — Exact = égalité TRIM ; Partiel = LIKE %…% (défaut).
if (!empty($arrReq['bib_match']) && $arrReq['bib_match'] === 'exact') {
// MSIN-4399 — Exact = égalité TRIM (défaut) ; Partiel = LIKE %…%.
if (empty($arrReq['bib_match']) || $arrReq['bib_match'] !== 'partial') {
$strWhere .= ' AND ('
. " TRIM(IFNULL(p.no_bib, '')) = '" . $strEscBibEquipe . "'"
. " OR TRIM(IFNULL(e.no_equipe, '')) = '" . $strEscBibEquipe . "'"
@ -1387,9 +1389,9 @@ function fxInscrGestionQueryParams($intEveId, $arrReq, $arrExtra = array()) {
if ($arrReq['rech_nom_equipe'] !== '') {
$tab['rech_nom_equipe'] = $arrReq['rech_nom_equipe'];
}
// MSIN-4401 — Conserver le mode exact dans pagination / fiche (partiel = défaut, pas dans lURL).
if (!empty($arrReq['bib_match']) && $arrReq['bib_match'] === 'exact') {
$tab['bib_match'] = 'exact';
// MSIN-4399 — Conserver le mode partiel dans pagination / fiche (exact = défaut, pas dans lURL).
if (!empty($arrReq['bib_match']) && $arrReq['bib_match'] === 'partial') {
$tab['bib_match'] = 'partial';
}
if ($arrReq['chk_bib']) {
$tab['chk_bib'] = 1;
@ -1804,8 +1806,9 @@ function fxInscrGestionActiveFilterLabels($arrReq, $strLangue) {
fxInscrGestionT('inscr_gestion_rech_bib_equipe'),
$arrReq['rech_nom_equipe']
);
if (!empty($arrReq['bib_match']) && $arrReq['bib_match'] === 'exact') {
$tab[] = fxInscrGestionT('inscr_gestion_bib_match_exact');
// MSIN-4399 — Chip seulement si hors défaut (partiel).
if (!empty($arrReq['bib_match']) && $arrReq['bib_match'] === 'partial') {
$tab[] = fxInscrGestionT('inscr_gestion_bib_match_partial');
}
}
if ($arrReq['sel_rech_epreuve'] > 0) {
@ -1930,7 +1933,8 @@ function fxInscrGestionRenderList($intEveId, $strLangue, $strBaseUrl, $arrReq) {
echo '<input class="form-control form-control-sm rounded-0" type="text" id="rech_nom_equipe" name="rech_nom_equipe" value="'
. fxInscrGestionEsc($arrReq['rech_nom_equipe']) . '">';
// MSIN-4401 — Exact vs Partiel (entre champ et caméra).
$blnBibExact = (!empty($arrReq['bib_match']) && $arrReq['bib_match'] === 'exact');
// MSIN-4399 — Exact sélectionné par défaut.
$blnBibExact = (empty($arrReq['bib_match']) || $arrReq['bib_match'] !== 'partial');
echo '<div class="inscr-gestion-bib-match" role="group"'
. ' aria-label="' . fxInscrGestionEsc(fxInscrGestionT('inscr_gestion_bib_match_aria')) . '">';
echo '<label class="inscr-gestion-bib-match__opt">';