diff --git a/css/style.css b/css/style.css index 39f81cf..5a63f0f 100644 --- a/css/style.css +++ b/css/style.css @@ -4075,13 +4075,6 @@ a.ms1-trad-link.btn-aide-trad{ line-height:1.35; } -.inscr-gestion-list-item__team-no{ - font-size:11px; - font-weight:500; - color:#6c757d; - line-height:1.35; -} - .inscr-gestion-list-mates{ list-style:none; margin:2px 0 0; diff --git a/php/inc_fx_inscriptions_gestion.php b/php/inc_fx_inscriptions_gestion.php index 8f1c514..6f14aab 100644 --- a/php/inc_fx_inscriptions_gestion.php +++ b/php/inc_fx_inscriptions_gestion.php @@ -271,7 +271,11 @@ function fxInscrGestionResolveBackUrl($strBaseUrl, $intEveId, $arrReq) { } } - return fxInscrGestionBuildUrl($strBaseUrl, $intEveId, $arrReq, array('pec_id' => null, 'pg' => $arrReq['pg'])); + return fxInscrGestionBuildUrl($strBaseUrl, $intEveId, $arrReq, array( + 'pec_id' => null, + 'par_id' => null, + 'pg' => $arrReq['pg'], + )); } /** MSIN-4436 — Libellé du bouton retour selon le contexte d'origine. */ @@ -534,7 +538,7 @@ function fxInscrGestionFallbackTexte($strClef, $strLangue) { 'inscr_gestion_list_count_many' => $blnFr ? '%d inscriptions' : '%d registrations', 'inscr_gestion_list_page' => $blnFr ? 'Page %d / %d' : 'Page %d / %d', 'inscr_gestion_list_filter_kv' => $blnFr ? '%s : %s' : '%s: %s', - 'inscr_gestion_rech_bib_equipe' => $blnFr ? 'Dossard ou équipe' : 'Bib or team', + 'inscr_gestion_rech_bib_equipe' => $blnFr ? 'Dossard' : 'Bib', 'inscr_gestion_bib_match_exact' => $blnFr ? 'Exact' : 'Exact', 'inscr_gestion_bib_match_partial' => $blnFr ? 'Partiel' : 'Partial', 'inscr_gestion_bib_match_aria' => $blnFr @@ -543,9 +547,8 @@ function fxInscrGestionFallbackTexte($strClef, $strLangue) { 'chk_bib' => $blnFr ? 'Sans numéro de dossard' : 'Without bib number', 'inscr_gestion_reset_search' => $blnFr ? 'Réinitialiser la recherche' : 'Reset search', // MSIN-4459 — Nom d'équipe + coéquipiers sous le capitaine en liste. - 'inscr_gestion_list_team_name' => $blnFr ? 'Nom d\'équipe : %s' : 'Team name: %s', + 'inscr_gestion_list_team_name' => $blnFr ? 'Équipe : %s' : 'Team: %s', 'inscr_gestion_list_teammate' => $blnFr ? 'Coéquipier' : 'Teammate', - 'inscr_gestion_list_team_no' => $blnFr ? 'No d\'équipe : %s' : 'Team no.: %s', 'inscr_gestion_list_team_no_label' => $blnFr ? 'No d\'équipe' : 'Team no.', 'inscr_gestion_list_team_name_label' => $blnFr ? 'Nom d\'équipe' : 'Team name', ); @@ -840,6 +843,8 @@ function fxInscrGestionParseRequest() { ), 'pg' => isset($_GET['pg']) ? max(1, intval($_GET['pg'])) : 1, 'pec_id' => isset($_GET['pec_id']) ? intval($_GET['pec_id']) : 0, + // MSIN-4459 — Participant cible de la fiche (coéquipier vs capitaine). + 'par_id' => isset($_GET['par_id']) ? intval($_GET['par_id']) : 0, // MSIN-4436 — Page d'origine (ex. gestion dossards) pour le bouton retour de la fiche. 'inscr_return' => isset($_GET['inscr_return']) ? trim((string)$_GET['inscr_return']) : '', // q = 1 lorsque l'utilisateur a lance une recherche/filtre. La liste reste vide tant que q = 0. @@ -896,6 +901,7 @@ function fxInscrGestionEmptyListRequest() { 'sel_rech_statut' => array(), 'pg' => 1, 'pec_id' => 0, + 'par_id' => 0, 'inscr_return' => '', 'q' => 0, ); @@ -1041,16 +1047,23 @@ function fxInscrGestionFetchTeamMembersByPecs($arrPecIds) { return $map; } -function fxInscrGestionFetchRowByPec($intPecId, $intEveId) { +function fxInscrGestionFetchRowByPec($intPecId, $intEveId, $intParId = 0) { global $objDatabase; + // MSIN-4459 — par_id precis = bon coéquipier ; sinon preferer le capitaine (rol_id=1). $sql = 'SELECT p.no_bib, p.no_bib_remis, p.no_bib_remis_date, p.no_bib_remis_par, p.par_statut_course, p.par_id, p.par_equipe,' . ' p.par_prenom, p.par_nom, p.par_id_original, p.ct_entry_id, e.pec_id_original, e.epr_id, e.eve_id, e.pec_id, e.is_cancelled, e.pec_actif, p.rol_id,' . ' e.no_commande, e.no_panier, e.no_equipe, e.pec_equipe, e.pec_nom_equipe' . ' FROM resultats_epreuves_commandees e, resultats_participants p' . ' WHERE e.eve_id = ' . intval($intEveId) . ' AND e.pec_id_original = ' . intval($intPecId) - . ' AND p.pec_id = e.pec_id_original' + . ' AND p.pec_id = e.pec_id_original'; + + if (intval($intParId) > 0) { + $sql .= ' AND p.par_id = ' . intval($intParId); + } + + $sql .= ' ORDER BY CASE WHEN p.rol_id = 1 THEN 0 ELSE 1 END, p.par_id' . ' LIMIT 1'; return $objDatabase->fxGetRow($sql); @@ -1596,7 +1609,10 @@ function fxInscrGestionQueryParams($intEveId, $arrReq, $arrExtra = array()) { } foreach ($arrExtra as $strKey => $mixVal) { - if ($mixVal === null || $mixVal === '' || ($strKey === 'pec_id' && (int)$mixVal === 0)) { + if ($mixVal === null || $mixVal === '' + || ($strKey === 'pec_id' && (int)$mixVal === 0) + || ($strKey === 'par_id' && (int)$mixVal === 0) + ) { unset($tab[$strKey]); } else { $tab[$strKey] = $mixVal; @@ -1614,8 +1630,8 @@ function fxInscrGestionBuildUrl($strBaseUrl, $intEveId, $arrReq, $arrExtra = arr } function fxInscrGestionPaginationUrl($strBaseUrl, $intEveId, $arrReq) { - $tab = fxInscrGestionQueryParams($intEveId, $arrReq, array('pec_id' => null)); - unset($tab['pg'], $tab['pec_id']); + $tab = fxInscrGestionQueryParams($intEveId, $arrReq, array('pec_id' => null, 'par_id' => null)); + unset($tab['pg'], $tab['pec_id'], $tab['par_id']); $strQs = http_build_query($tab, '', '&'); return $strBaseUrl . ($strQs !== '' ? '?' . $strQs : '?promoteur_eve_id=' . rawurlencode(base64_encode((string)$intEveId))); @@ -2039,8 +2055,13 @@ function fxInscrGestionRenderList($intEveId, $strLangue, $strBaseUrl, $arrReq) { if ($blnSearchActive && $blnFreshSearch) { $tabRows = fxInscrGestionFetchRows($intEveId, $arrReq); if ($tabRows !== null && count($tabRows) === 1) { + $intOnePec = (int)$tabRows[1]['pec_id_original']; + // MSIN-4459 — Preferer le capitaine si equipe (meme logique que la fiche sans par_id). + $arrOne = fxInscrGestionFetchRowByPec($intOnePec, $intEveId, 0); + $intOnePar = ($arrOne !== null) ? (int)$arrOne['par_id'] : (int)$tabRows[1]['par_id']; $strFicheUrl = fxInscrGestionBuildUrl($strBaseUrl, $intEveId, $arrReq, array( - 'pec_id' => (int)$tabRows[1]['pec_id_original'], + 'pec_id' => $intOnePec, + 'par_id' => $intOnePar, 'pg' => 1, )); echo '