MSIN-4521 — Normalize gender handling in participant profiles to use M/F/N/A codes instead of h/f/n/a. Update related functions and UI elements for consistency. Increment version code to 4.72.893.

This commit is contained in:
2026-07-29 11:29:46 -04:00
parent cc029a2998
commit 09cd78d92e
3 changed files with 56 additions and 9 deletions

View File

@ -1305,9 +1305,21 @@ function fxInscrGestionFetchFicheProfile($arrRow, $strLangue) {
$strBirthGender = '';
$strNaissance = trim((string)$tabProfile['par_naissance']);
if ($strNaissance !== '' && $strNaissance !== '0000-00-00') {
// MSIN-4521 — import hors-tx stocke M/F/N ; fxGetGender attend h/f/n/a.
$strSexeDisp = trim((string)$tabProfile['par_sexe']);
$strSexeLow = mb_strtolower($strSexeDisp, 'UTF-8');
if ($strSexeDisp === 'M' || $strSexeLow === 'm') {
$strSexeDisp = 'h';
} elseif ($strSexeDisp === 'F' || $strSexeLow === 'f') {
$strSexeDisp = 'f';
} elseif ($strSexeDisp === 'N' || $strSexeLow === 'n') {
$strSexeDisp = 'n';
} elseif ($strSexeDisp === 'A' || $strSexeLow === 'a') {
$strSexeDisp = 'a';
}
$strBirthGender = fxShowDate($strNaissance, $strLangue)
. ' - '
. fxGetGender($tabProfile['par_sexe'], $strLangue);
. fxGetGender($strSexeDisp, $strLangue);
}
$intParIdOriginal = (int)$tabProfile['par_id_original'];

View File

@ -149,6 +149,39 @@ function fxInscrGestionHorsTxLoadQuestions($arrRow, $strLangue)
return $tabOut;
}
/**
* MSIN-4521 — normalise sexe pour la fiche hors-tx (import = M/F/N, formulaire MS1 = h/f/n/a).
* @return string M|F|N|A|''
*/
function fxInscrGestionHorsTxNormalizeSexe($strSexe)
{
$str = trim((string)$strSexe);
if ($str === '') {
return '';
}
if (function_exists('fxImportResultatsNormalizeSex')) {
$strImp = fxImportResultatsNormalizeSex($str);
if ($strImp !== '') {
return $strImp;
}
}
$strLow = mb_strtolower($str, 'UTF-8');
if ($strLow === 'f' || $strLow === 'female' || $strLow === 'femme' || $str === 'F') {
return 'F';
}
if ($strLow === 'h' || $strLow === 'm' || $strLow === 'male' || $strLow === 'homme'
|| $str === 'M' || $str === 'H') {
return 'M';
}
if ($strLow === 'n' || $strLow === 'x' || $str === 'N') {
return 'N';
}
if ($strLow === 'a' || $strLow === 'autre' || $strLow === 'other' || $str === 'A') {
return 'A';
}
return '';
}
/**
* @return array{ok:bool,needs_confirm?:bool,code?:string,message?:string}
*/
@ -222,12 +255,13 @@ function fxInscrGestionHorsTxSaveProfile($intParId, $intEveId, array $arrFields)
$strPrenom = trim((string)($arrFields['par_prenom'] ?? ''));
$strNom = trim((string)($arrFields['par_nom'] ?? ''));
$strSexe = trim((string)($arrFields['par_sexe'] ?? ''));
$strSexe = fxInscrGestionHorsTxNormalizeSexe($arrFields['par_sexe'] ?? '');
$strNaissance = trim((string)($arrFields['par_naissance'] ?? ''));
if ($strPrenom === '' || $strNom === '') {
return array('state' => 'error', 'message' => 'required');
}
if ($strSexe !== '' && !in_array($strSexe, array('h', 'f', 'n', 'a'), true)) {
// Codes acceptés : M/F/N/A (import/CT) — vide = non renseigné.
if ($strSexe !== '' && !in_array($strSexe, array('M', 'F', 'N', 'A'), true)) {
return array('state' => 'error', 'message' => 'sexe_invalid');
}
if ($strNaissance !== '' && $strNaissance !== '0000-00-00'
@ -483,7 +517,7 @@ function fxInscrGestionRenderHorsTxEditableFields(
if ($strNaissance === '0000-00-00') {
$strNaissance = '';
}
$strSexe = is_array($rowExtra) ? trim((string)($rowExtra['par_sexe'] ?? '')) : '';
$strSexe = fxInscrGestionHorsTxNormalizeSexe(is_array($rowExtra) ? ($rowExtra['par_sexe'] ?? '') : '');
if ($blnCanEdit) {
echo '<div class="inscr-gestion-field-block" data-inscr-field="hors-tx-profile">';
@ -504,13 +538,14 @@ function fxInscrGestionRenderHorsTxEditableFields(
. ' value="' . fxInscrGestionEsc(fxUnescape($arrRow['par_nom'])) . '"></div>';
echo '<div><label class="inscr-gestion-hors-tx-sublabel">'
. fxInscrGestionEsc(fxInscrGestionT('inscr_gestion_hors_tx_sexe')) . '</label>';
// MSIN-4521 — valeurs M/F/N (comme import 4482 / CT), pas h/f du formulaire reserver.
echo '<select class="form-control rounded-0" id="hors_tx_sexe_' . $intParId . '">';
$tabSexe = array(
'' => '—',
'h' => fxInscrGestionT('inscr_gestion_hors_tx_sexe_h'),
'f' => fxInscrGestionT('inscr_gestion_hors_tx_sexe_f'),
'n' => fxInscrGestionT('inscr_gestion_hors_tx_sexe_n'),
'a' => fxInscrGestionT('inscr_gestion_hors_tx_sexe_a'),
'M' => fxInscrGestionT('inscr_gestion_hors_tx_sexe_h'),
'F' => fxInscrGestionT('inscr_gestion_hors_tx_sexe_f'),
'N' => fxInscrGestionT('inscr_gestion_hors_tx_sexe_n'),
'A' => fxInscrGestionT('inscr_gestion_hors_tx_sexe_a'),
);
foreach ($tabSexe as $strCode => $strLab) {
echo '<option value="' . fxInscrGestionEsc($strCode) . '"'

View File

@ -7,7 +7,7 @@
* Constantes *
*
**************/
define('_VERSION_CODE', '4.72.892'); // MSIN-4521 — édition fiche hors inscription en ligne
define('_VERSION_CODE', '4.72.893'); // MSIN-4521 — sexe fiche : M/F/N (aligné import)
define('_DATE_CODE', '2026-07-29');
//MSIN-4290
define('QR_SECRET_KEY', 'ms1_qr_2026_cle_secrete_longue_et_fixe');