MSIN-4459 — Refactor participant list to include individual bib numbers and team details. Update SQL queries and PHP functions for enhanced data retrieval. Modify CSS to remove deprecated styles. Increment version code to 4.72.838.

This commit is contained in:
2026-07-20 12:19:55 -04:00
parent 44b7e4cf84
commit afac2f175e
4 changed files with 70 additions and 44 deletions

View File

@ -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;

View File

@ -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 '<div id="module-inscr-gestion" class="inscr-gestion-shell" data-inscr-gestion="1">';
@ -2261,20 +2282,17 @@ function fxInscrGestionRenderList($intEveId, $strLangue, $strBaseUrl, $arrReq) {
for ($j = $intStart; $j <= $intEnd; $j++) {
$row = $tabRows[$j];
$strFicheUrl = fxInscrGestionBuildUrl($strBaseUrl, $intEveId, $arrReq, array(
'pec_id' => (int)$row['pec_id_original'],
'pg' => $intPage,
));
$strFicheHref = fxInscrGestionEsc($strFicheUrl);
$blnEquipe = (intval($row['pec_equipe']) === 1);
$intPecId = (int)$row['pec_id_original'];
$tabMates = array();
$strTeamName = '';
$strTeamNo = '';
// MSIN-4459 — Ligne parente = capitaine ; coéquipiers en sous-liste.
if ($blnEquipe) {
$strTeamName = trim(fxUnescape(isset($row['pec_nom_equipe']) ? $row['pec_nom_equipe'] : ''));
$strTeamNo = trim(fxUnescape(isset($row['no_equipe']) ? $row['no_equipe'] : ''));
$tabMembers = isset($tabTeamMembersByPec[$intPecId]) ? $tabTeamMembersByPec[$intPecId] : array();
$arrCaptain = null;
foreach ($tabMembers as $arrMem) {
@ -2304,8 +2322,21 @@ function fxInscrGestionRenderList($intEveId, $strLangue, $strBaseUrl, $arrReq) {
}
}
$intParId = (int)$row['par_id'];
// MSIN-4459 — Fiche cible le bon participant (capitaine ou coéquipier).
$strFicheUrl = fxInscrGestionBuildUrl($strBaseUrl, $intEveId, $arrReq, array(
'pec_id' => $intPecId,
'par_id' => $intParId,
'pg' => $intPage,
));
$strFicheHref = fxInscrGestionEsc($strFicheUrl);
$strBib = fxInscrGestionBibDisplay($row);
$strName = fxUnescape($row['par_nom']) . ', ' . fxUnescape($row['par_prenom']);
// No d'équipe en parenthèses (lecture seule), jamais dans la colonne dossard.
if ($blnEquipe && $strTeamNo !== '') {
$strName .= ' (' . $strTeamNo . ')';
}
$strRace = fxInscrGestionEpreuveLabel($row['epr_id'], $strLangue);
$strStatutLabel = fxInscrGestionStatutCourseLabel(
isset($row['par_statut_course']) ? $row['par_statut_course'] : '',
@ -2325,11 +2356,10 @@ function fxInscrGestionRenderList($intEveId, $strLangue, $strBaseUrl, $arrReq) {
}
$blnRemis = (intval($row['no_bib_remis']) === 1);
$intParId = (int)$row['par_id'];
// MSIN-4448 — Ligne en div : cellules nav (lien) vs dossard/remis editables.
echo '<div class="' . $strCardClass . '">';
// MSIN-4459 — Bloc nom : capitaine + nom d'équipe + coéquipiers.
// MSIN-4459 — Bloc nom : capitaine (no équipe) + nom d'équipe + coéquipiers.
echo '<div class="inscr-gestion-list-item__who">';
echo '<a class="inscr-gestion-list-item__name" href="' . $strFicheHref . '">'
. fxInscrGestionEsc($strName) . $strCancelBadge . '</a>';
@ -2338,26 +2368,28 @@ function fxInscrGestionRenderList($intEveId, $strLangue, $strBaseUrl, $arrReq) {
. fxInscrGestionEsc(sprintf(fxInscrGestionT('inscr_gestion_list_team_name'), $strTeamName))
. '</span>';
}
if ($blnEquipe) {
$strTeamNo = trim(fxUnescape(isset($row['no_equipe']) ? $row['no_equipe'] : ''));
if ($strTeamNo !== '') {
echo '<span class="inscr-gestion-list-item__team-no">'
. fxInscrGestionEsc(sprintf(fxInscrGestionT('inscr_gestion_list_team_no'), $strTeamNo))
. '</span>';
}
}
if ($blnEquipe && count($tabMates) > 0) {
$strBibColLabel = fxInscrGestionT('inscr_gestion_col_dossard');
echo '<ul class="inscr-gestion-list-mates">';
foreach ($tabMates as $arrMate) {
$intMateParId = (int)$arrMate['par_id'];
$strMateName = fxUnescape($arrMate['par_nom']) . ', ' . fxUnescape($arrMate['par_prenom']);
if ($strTeamNo !== '') {
$strMateName .= ' (' . $strTeamNo . ')';
}
$strMateBib = fxInscrGestionBibDisplay(array(
'no_bib' => isset($arrMate['no_bib']) ? $arrMate['no_bib'] : '',
'epr_id' => $row['epr_id'],
));
$strMateFicheUrl = fxInscrGestionBuildUrl($strBaseUrl, $intEveId, $arrReq, array(
'pec_id' => $intPecId,
'par_id' => $intMateParId,
'pg' => $intPage,
));
$strMateFicheHref = fxInscrGestionEsc($strMateFicheUrl);
echo '<li class="inscr-gestion-list-mates__item">';
echo '<div class="inscr-gestion-list-mates__row">';
echo '<a class="inscr-gestion-list-mates__link" href="' . $strFicheHref . '">';
echo '<a class="inscr-gestion-list-mates__link" href="' . $strMateFicheHref . '">';
echo '<span class="inscr-gestion-list-mates__role">'
. fxInscrGestionEsc($strTeammateLabel) . '</span> ';
echo fxInscrGestionEsc($strMateName);
@ -2365,10 +2397,10 @@ function fxInscrGestionRenderList($intEveId, $strLangue, $strBaseUrl, $arrReq) {
echo '<span class="inscr-gestion-list-mates__bib">';
fxInscrGestionRenderListBibControl(array(
'bib' => $strMateBib,
'par_id' => (int)$arrMate['par_id'],
'par_id' => $intMateParId,
'eve_id' => (int)$row['eve_id'],
'epr_id' => (int)$row['epr_id'],
'pec_id' => (int)$row['pec_id_original'],
'pec_id' => $intPecId,
'can_bib' => $blnCanBib,
'ok_label' => $strBibOkLabel,
'col_label' => $strBibColLabel,
@ -2853,7 +2885,7 @@ function fxInscrGestionRun($intEveId, $strLangue) {
$arrReq = fxInscrGestionParseRequest();
if ($arrReq['pec_id'] > 0) {
$arrRow = fxInscrGestionFetchRowByPec($arrReq['pec_id'], $intEveId);
$arrRow = fxInscrGestionFetchRowByPec($arrReq['pec_id'], $intEveId, isset($arrReq['par_id']) ? (int)$arrReq['par_id'] : 0);
if ($arrRow === null) {
echo '<div class="alert alert-danger">' . fxInscrGestionEsc(fxInscrGestionT('txt_recherche_no_result')) . '</div>';
echo '<a class="btn btn-primary rounded-0" href="' . fxInscrGestionEsc(fxInscrGestionResolveBackUrl($strBaseUrl, $intEveId, $arrReq)) . '">';

View File

@ -7,7 +7,7 @@
* Constantes *
*
**************/
define('_VERSION_CODE', '4.72.837');
define('_VERSION_CODE', '4.72.838');
define('_DATE_CODE', '2026-07-20');
//MSIN-4290
define('QR_SECRET_KEY', 'ms1_qr_2026_cle_secrete_longue_et_fixe');

View File

@ -1,4 +1,4 @@
-- MSIN-4459 — Liste inscriptions : équipe (nom / no) + coéquipier ; dossard ≠ no_equipe
-- MSIN-4459 — Liste inscriptions : équipe + dossard individuel (≠ no_equipe)
-- Prérequis : aucun
-- Idempotent (DELETE + INSERT). Compte.php (contexte AJAX / fiche gestion).
@ -9,17 +9,18 @@ WHERE info_prg = 'compte.php'
'inscr_gestion_list_teammate',
'inscr_gestion_list_team_no',
'inscr_gestion_list_team_no_label',
'inscr_gestion_list_team_name_label'
'inscr_gestion_list_team_name_label',
'inscr_gestion_rech_bib_equipe'
);
INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation) VALUES
('inscr_gestion_list_team_name', 'fr', 'Nom d\'équipe : %s', '', 'compte.php', '', 0, 1, '', '', '', NOW()),
('inscr_gestion_list_team_name', 'en', 'Team name: %s', '', 'compte.php', '', 0, 1, '', '', '', NOW()),
('inscr_gestion_list_team_name', 'fr', 'Équipe : %s', '', 'compte.php', '', 0, 1, '', '', '', NOW()),
('inscr_gestion_list_team_name', 'en', 'Team: %s', '', 'compte.php', '', 0, 1, '', '', '', NOW()),
('inscr_gestion_list_teammate', 'fr', 'Coéquipier', '', 'compte.php', '', 0, 1, '', '', '', NOW()),
('inscr_gestion_list_teammate', 'en', 'Teammate', '', 'compte.php', '', 0, 1, '', '', '', NOW()),
('inscr_gestion_list_team_no', 'fr', 'No d\'équipe : %s', '', 'compte.php', '', 0, 1, '', '', '', NOW()),
('inscr_gestion_list_team_no', 'en', 'Team no.: %s', '', 'compte.php', '', 0, 1, '', '', '', NOW()),
('inscr_gestion_list_team_no_label', 'fr', 'No d\'équipe', '', 'compte.php', '', 0, 1, '', '', '', NOW()),
('inscr_gestion_list_team_no_label', 'en', 'Team no.', '', 'compte.php', '', 0, 1, '', '', '', NOW()),
('inscr_gestion_list_team_name_label', 'fr', 'Nom d\'équipe', '', 'compte.php', '', 0, 1, '', '', '', NOW()),
('inscr_gestion_list_team_name_label', 'en', 'Team name', '', 'compte.php', '', 0, 1, '', '', '', NOW());
('inscr_gestion_list_team_name_label', 'en', 'Team name', '', 'compte.php', '', 0, 1, '', '', '', NOW()),
('inscr_gestion_rech_bib_equipe', 'fr', 'Dossard', '', 'compte.php', '', 0, 1, '', '', '', NOW()),
('inscr_gestion_rech_bib_equipe', 'en', 'Bib', '', 'compte.php', '', 0, 1, '', '', '', NOW());