From 09cd78d92e33b9fd334a69b7cd0976cce357002d Mon Sep 17 00:00:00 2001 From: stephan Date: Wed, 29 Jul 2026 11:29:46 -0400 Subject: [PATCH] =?UTF-8?q?MSIN-4521=20=E2=80=94=20Normalize=20gender=20ha?= =?UTF-8?q?ndling=20in=20participant=20profiles=20to=20use=20M/F/N/A=20cod?= =?UTF-8?q?es=20instead=20of=20h/f/n/a.=20Update=20related=20functions=20a?= =?UTF-8?q?nd=20UI=20elements=20for=20consistency.=20Increment=20version?= =?UTF-8?q?=20code=20to=204.72.893.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- php/inc_fx_inscriptions_gestion.php | 14 +++++- php/inc_fx_inscriptions_gestion_hors_tx.php | 49 ++++++++++++++++++--- php/inc_settings.php | 2 +- 3 files changed, 56 insertions(+), 9 deletions(-) diff --git a/php/inc_fx_inscriptions_gestion.php b/php/inc_fx_inscriptions_gestion.php index 0143ee0..877f3dc 100644 --- a/php/inc_fx_inscriptions_gestion.php +++ b/php/inc_fx_inscriptions_gestion.php @@ -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']; diff --git a/php/inc_fx_inscriptions_gestion_hors_tx.php b/php/inc_fx_inscriptions_gestion_hors_tx.php index 2126b55..b585f3e 100644 --- a/php/inc_fx_inscriptions_gestion_hors_tx.php +++ b/php/inc_fx_inscriptions_gestion_hors_tx.php @@ -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 '
'; @@ -504,13 +538,14 @@ function fxInscrGestionRenderHorsTxEditableFields( . ' value="' . fxInscrGestionEsc(fxUnescape($arrRow['par_nom'])) . '">
'; echo '
'; + // MSIN-4521 — valeurs M/F/N (comme import 4482 / CT), pas h/f du formulaire reserver. echo '