MSIN-4405 Implement cancellation cause logic and UI enhancements

This commit introduces a new function, `fxGetAnnulationCause`, to determine the reason for a cancelled registration (e.g., transfer, modification, or true cancellation) without altering the database. Additionally, it adds CSS styles for displaying cancellation badges in the UI, enhancing the visual representation of registration statuses. The changes improve user experience by providing clear and informative feedback on registration cancellations throughout the management interface.
This commit is contained in:
2026-06-29 13:31:28 -04:00
parent bcc7d7974e
commit afff43abd6
4 changed files with 108 additions and 7 deletions

View File

@ -2707,6 +2707,30 @@ a.ms1-trad-link.btn-aide-trad{
border-color:#f1b0b7;
}
/* MSIN-4405 — pastille de cause d'annulation (annulee / transferee / modifiee) */
.inscr-gestion-cancel-badge{
display:inline-block;
margin-left:6px;
padding:1px 7px;
border-radius:10px;
font-size:.72rem;
font-weight:600;
line-height:1.4;
vertical-align:middle;
white-space:nowrap;
color:#fff;
background:#dc3545;
}
.inscr-gestion-cancel-badge--transfert{
background:#0d6efd;
}
.inscr-gestion-cancel-badge--modif{
background:#fd7e14;
}
.inscr-gestion-cancel-badge--annule{
background:#dc3545;
}
.inscr-gestion-list-item__main{
display:contents;
}

View File

@ -174,6 +174,51 @@ function fxcount($memarray)
}
/**
* MSIN-4405 — Determine, en LECTURE SEULE, pourquoi une inscription annulee (is_cancelled = 1)
* porte ce statut. Aucune ecriture : on ne touche ni is_cancelled, ni pec_actif, ni la base.
*
* Regles (cf. fxMajEpreuvesCommandees / annuler_inscription.php) :
* - vraie annulation : l'ancien pec reste actif (pec_actif = 1)
* - transfert complete: ligne dans inscriptions_transferts (ts_id = 2) pour ce pec
* - changement d'epreuve / upgrade : ligne dans inscriptions_panier_epreuves_commandees_upgrade
*
* @param int $intPecId pec_id_original de l'inscription
* @param int|null $intPecActif valeur de pec_actif si deja connue (evite une requete)
* @return string 'annule' | 'transfert' | 'modif'
*/
function fxGetAnnulationCause($intPecId, $intPecActif = null) {
global $objDatabase;
$intPecId = intval($intPecId);
if ($intPecId <= 0) {
return 'annule';
}
// Une vraie annulation laisse l'inscription active (pec_actif = 1).
if ($intPecActif !== null && intval($intPecActif) === 1) {
return 'annule';
}
// Transfert complete vers une autre personne.
$varTransfert = $objDatabase->fxGetVar(
"SELECT 1 FROM inscriptions_transferts WHERE pec_id = " . $intPecId . " AND ts_id = 2 LIMIT 1"
);
if ($varTransfert) {
return 'transfert';
}
// Changement d'epreuve / upgrade (ancien pec remplace par un nouveau).
$varUpgrade = $objDatabase->fxGetVar(
"SELECT 1 FROM inscriptions_panier_epreuves_commandees_upgrade WHERE pec_id_old = " . $intPecId . " LIMIT 1"
);
if ($varUpgrade) {
return 'modif';
}
return 'annule';
}
// fonction qui retourne les infos des champs de la table (SL / JSP)
// param : nom de la table, nom de la base de données

View File

@ -229,6 +229,11 @@ function fxInscrGestionFallbackTexte($strClef, $strLangue) {
'inscr_gestion_search_prompt' => $blnFr
? 'Utilisez la recherche ci-dessus pour afficher les inscriptions. Laissez les champs vides et lancez la recherche pour toutes les afficher.'
: 'Use the search above to display registrations. Leave the fields empty and search to show them all.',
// MSIN-4405 — Detail du statut annule (transfere / modifie / vraie annulation), derive en lecture.
'inscr_gestion_annulation_titre' => $blnFr ? 'Statut de l\'inscription' : 'Registration status',
'inscr_gestion_statut_annule' => $blnFr ? 'Annulée' : 'Cancelled',
'inscr_gestion_statut_transfert' => $blnFr ? 'Transférée' : 'Transferred',
'inscr_gestion_statut_modif' => $blnFr ? 'Modifiée (changement d\'épreuve)' : 'Modified (race change)',
);
}
@ -516,7 +521,7 @@ function fxInscrGestionFetchRows($intEveId, $arrReq) {
$strWhere = fxInscrGestionBuildWhere($intEveId, $arrReq);
$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, e.pec_id_original, e.epr_id, e.eve_id, e.pec_id, e.is_cancelled, p.rol_id,'
. ' p.par_prenom, p.par_nom, 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'
. ' FROM resultats_epreuves_commandees e, resultats_participants p'
. ' WHERE ' . $strWhere . ' AND p.pec_id = e.pec_id_original'
@ -530,7 +535,7 @@ function fxInscrGestionFetchRowByPec($intPecId, $intEveId) {
global $objDatabase;
$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, e.pec_id_original, e.epr_id, e.eve_id, e.pec_id, e.is_cancelled, p.rol_id,'
. ' p.par_prenom, p.par_nom, 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'
. ' FROM resultats_epreuves_commandees e, resultats_participants p'
. ' WHERE e.eve_id = ' . intval($intEveId)
@ -1277,12 +1282,17 @@ function fxInscrGestionRenderList($intEveId, $strLangue, $strBaseUrl, $arrReq) {
$strName = fxUnescape($row['par_nom']) . ', ' . fxUnescape($row['par_prenom']);
$strRace = fxInscrGestionEpreuveLabel($row['epr_id'], $strLangue);
$strCardClass = 'inscr-gestion-list-item';
$strCancelBadge = '';
if ($row['is_cancelled'] == '1') {
$strCardClass .= ' inscr-gestion-list-item--cancelled';
// MSIN-4405 — Cause derivee en lecture seule (aucune ecriture en base).
$strCause = fxGetAnnulationCause($row['pec_id_original'], $row['pec_actif']);
$strCardClass .= ' inscr-gestion-list-item--cancelled inscr-gestion-list-item--' . $strCause;
$strCancelBadge = ' <span class="inscr-gestion-cancel-badge inscr-gestion-cancel-badge--' . $strCause . '">'
. fxInscrGestionEsc(fxInscrGestionT('inscr_gestion_statut_' . $strCause)) . '</span>';
}
echo '<a class="' . $strCardClass . '" href="' . fxInscrGestionEsc($strFicheUrl) . '">';
echo '<span class="inscr-gestion-list-item__name">' . fxInscrGestionEsc($strName) . '</span>';
echo '<span class="inscr-gestion-list-item__name">' . fxInscrGestionEsc($strName) . $strCancelBadge . '</span>';
echo '<span class="inscr-gestion-list-item__race">' . fxInscrGestionEsc($strRace) . '</span>';
echo '<span class="inscr-gestion-list-item__order">' . fxInscrGestionEsc($row['no_commande']) . '</span>';
echo '<span class="inscr-gestion-list-item__bib">';
@ -1361,6 +1371,16 @@ function fxInscrGestionRenderFiche($intEveId, $strLangue, $strBaseUrl, $arrReq,
fxInscrGestionRenderKvListOpen();
fxInscrGestionRenderKvRow(fxInscrGestionT('inscr_gestion_epreuve'), fxInscrGestionEpreuveLabel($arrRow['epr_id'], $strLangue));
fxInscrGestionRenderKvRow(fxInscrGestionT('inscr_gestion_type'), $strDetailsType);
if ($blnCancelled) {
// MSIN-4405 — Detail de l'annulation (transfere / modifie / annule) derive en lecture seule.
$strCause = fxGetAnnulationCause($arrRow['pec_id_original'], $arrRow['pec_actif']);
fxInscrGestionRenderKvRow(
fxInscrGestionT('inscr_gestion_annulation_titre'),
'<span class="inscr-gestion-cancel-badge inscr-gestion-cancel-badge--' . $strCause . '">'
. fxInscrGestionEsc(fxInscrGestionT('inscr_gestion_statut_' . $strCause)) . '</span>',
true
);
}
fxInscrGestionRenderKvRow(fxInscrGestionT('inscr_gestion_modified'), fxCheckMAJ($arrRow['pec_id_original'], $intParId, $strLangue), true);
fxInscrGestionRenderFicheProfileKvRows($arrRow, $strLangue);
fxInscrGestionRenderKvListClose();

View File

@ -229,7 +229,7 @@ function fxShowRecherche($str_code, $int_promoteur_id, $blnDon, $strLangue, $int
$strWhere .= ' AND e.is_cancelled = 0 AND e.pec_actif = 1'; // MSIN-3522
}
$sqlInscriptionsParPage = 'select p.no_bib,p.no_bib_remis,p.no_bib_remis_date,p.no_bib_remis_par, p.par_id, p.par_equipe, p.par_prenom, p.par_nom, e.pec_id_original, e.epr_id, e.eve_id, e.pec_id, e.is_cancelled, p.rol_id, e.no_commande, e.no_panier, e.no_equipe, e.pec_equipe from resultats_epreuves_commandees e, resultats_participants p where ' . $strWhere . ' and p.pec_id = e.pec_id_original group by e.pec_id_original';
$sqlInscriptionsParPage = 'select p.no_bib,p.no_bib_remis,p.no_bib_remis_date,p.no_bib_remis_par, p.par_id, p.par_equipe, p.par_prenom, p.par_nom, 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 from resultats_epreuves_commandees e, resultats_participants p where ' . $strWhere . ' and p.pec_id = e.pec_id_original group by e.pec_id_original';
$tabInscriptionsParPage = $objDatabase->fxGetResults($sqlInscriptionsParPage);
}
@ -558,7 +558,7 @@ function fxShowRechercheinscription($str_code, $int_promoteur_id, $blnDon, $strL
$strWhere .= ' AND e.is_cancelled = 0 AND e.pec_actif = 1'; // MSIN-3522
}
$sqlInscriptionsParPage = 'select p.no_bib,p.no_bib_remis,p.no_bib_remis_date,p.no_bib_remis_par, p.par_id, p.par_equipe, p.par_prenom, p.par_nom, e.pec_id_original, e.epr_id, e.eve_id, e.pec_id, e.is_cancelled, p.rol_id, e.no_commande, e.no_panier, e.no_equipe, e.pec_equipe from resultats_epreuves_commandees e, resultats_participants p where ' . $strWhere . ' and p.pec_id = e.pec_id_original group by e.pec_id_original';
$sqlInscriptionsParPage = 'select p.no_bib,p.no_bib_remis,p.no_bib_remis_date,p.no_bib_remis_par, p.par_id, p.par_equipe, p.par_prenom, p.par_nom, 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 from resultats_epreuves_commandees e, resultats_participants p where ' . $strWhere . ' and p.pec_id = e.pec_id_original group by e.pec_id_original';
$tabInscriptionsParPage = $objDatabase->fxGetResults($sqlInscriptionsParPage);
}
@ -2034,15 +2034,27 @@ function fxShowColumnPromoteur($arrColonnes, $arrListeParticipants, $x, $strLang
case 'management':
$strCode = fxGetEvenementsUrl($arrListeParticipants[$x]['eve_id']);
$strCancelBadge = '';
if ($arrListeParticipants[$x]['is_cancelled'] == '' || $arrListeParticipants[$x]['is_cancelled'] == '0') {
$strStyleEdit = $strStyleCancel = '';
$strStyleRetablir = ' d-none';
} else {
$strStyleEdit = $strStyleCancel = ' d-none';
$strStyleRetablir = '';
// MSIN-4405 — Cause de l'annulation derivee en lecture seule (transfere / modifie / annule).
$strCause = fxGetAnnulationCause($arrListeParticipants[$x]['pec_id_original'], isset($arrListeParticipants[$x]['pec_actif']) ? $arrListeParticipants[$x]['pec_actif'] : null);
if ($strCause == 'transfert') {
$strBadgeLbl = ($strLangue == 'fr') ? 'Transférée' : 'Transferred';
} elseif ($strCause == 'modif') {
$strBadgeLbl = ($strLangue == 'fr') ? 'Modifiée (changement d\'épreuve)' : 'Modified (race change)';
} else {
$strBadgeLbl = ($strLangue == 'fr') ? 'Annulée' : 'Cancelled';
}
$strCancelBadge = '<div class="mb-2"><span class="inscr-gestion-cancel-badge inscr-gestion-cancel-badge--' . $strCause . '">' . htmlspecialchars($strBadgeLbl, ENT_QUOTES, 'UTF-8') . '</span></div>';
}
$strAffichage = '
$strAffichage = $strCancelBadge . '
<button class="btn btn-primary btn-sm btn-block rounded-0 btn_edit_event_promo' . $strStyleEdit . '" id="modifier_' . $x . '" data-eve_code="' . $strCode . '" data-epr_id="' . $arrListeParticipants[$x]['epr_id'] . '" data-eve_id="' . $arrListeParticipants[$x]['eve_id'] . '" value="' . $arrListeParticipants[$x]['pec_id_original'] . '">' . afficheTexte('btn_modifierinscriptions', 0) . '</button>
<button class="btn btn-secondary btn-sm btn-block rounded-0 btn_cancel_event_promo' . $strStyleCancel . '" id="annuler_' . $x . '" type="button" data-eve_code="' . $strCode . '" data-epr_id="' . $arrListeParticipants[$x]['epr_id'] . '" data-eve_id="' . $arrListeParticipants[$x]['eve_id'] . '" value="' . $arrListeParticipants[$x]['pec_id_original'] . '">' . afficheTexte('btn_annulerinscriptions', 0) . '</button>
<button class="btn btn-secondary btn-sm btn-block rounded-0 btn_retablir_event_promo' . $strStyleRetablir . '" id="retablir_' . $x . '" type="button" data-eve_code="' . $strCode . '" data-epr_id="' . $arrListeParticipants[$x]['epr_id'] . '" data-eve_id="' . $arrListeParticipants[$x]['eve_id'] . '" value="' . $arrListeParticipants[$x]['pec_id_original'] . '">' . afficheTexte('btn_retablirinscriptions', 0) . '</button>