diff --git a/php/inc_fx_import_resultats.php b/php/inc_fx_import_resultats.php index ddeb2e8..8c1139f 100644 --- a/php/inc_fx_import_resultats.php +++ b/php/inc_fx_import_resultats.php @@ -1011,10 +1011,12 @@ function fxImportResultatsSaveQuestionAnswer($intParIdOriginal, $intPecId, $intQ $sql = "UPDATE resultats_questions SET" . " que_choix_fr = '" . fxImportResultatsDbEsc($strValue) . "'," . " que_choix_en = '" . fxImportResultatsDbEsc($strValue) . "'," - . " que_actif = 1," . " pqu_maj = '" . fxImportResultatsDbEsc($strNow) . "'" . " WHERE pqu_id = " . intval($tabFind[1]['pqu_id']); $objDatabase->fxQuery($sql); + @$objDatabase->fxQuery( + "UPDATE resultats_questions SET que_actif = 1 WHERE pqu_id = " . intval($tabFind[1]['pqu_id']) + ); return; } $sql = "INSERT INTO resultats_questions SET" @@ -1026,13 +1028,20 @@ function fxImportResultatsSaveQuestionAnswer($intParIdOriginal, $intPecId, $intQ . " que_choix_fr = '" . fxImportResultatsDbEsc($strValue) . "'," . " que_choix_en = '" . fxImportResultatsDbEsc($strValue) . "'," . " que_modifiable = 1," - . " que_actif = 1," . " pqu_note = ''," . " pqu_maj = '" . fxImportResultatsDbEsc($strNow) . "'," . " no_panier = ''," . " no_commande = ''," . " pqu_id_original = 0"; - $objDatabase->fxQuery($sql); + if ($objDatabase->fxQuery($sql) === false) { + return; + } + $intPqu = intval($objDatabase->fxGetLastId()); + if ($intPqu > 0) { + @$objDatabase->fxQuery( + "UPDATE resultats_questions SET que_actif = 1 WHERE pqu_id = " . $intPqu + ); + } } /** * MSIN-4482 — détecte une ligne qui n'est que la répétition des en-têtes. diff --git a/php/inc_fx_inscriptions_gestion.php b/php/inc_fx_inscriptions_gestion.php index 56b4fe1..5995722 100644 --- a/php/inc_fx_inscriptions_gestion.php +++ b/php/inc_fx_inscriptions_gestion.php @@ -1258,18 +1258,6 @@ function fxInscrGestionFetchFicheProfile($arrRow, $strLangue) { $intEveId = (int)$arrRow['eve_id']; $strLangCol = ($strLangue === 'en') ? 'en' : 'fr'; - // MSIN-4482 — type hors inscription en ligne : assouplir filtres fiche (sans toucher au flux payant) - $blnHorsTx = false; - if ($intEveId > 0) { - $tabTe = $objDatabase->fxGetRow( - "SELECT t.te_nom_fr FROM inscriptions_evenements e" - . " INNER JOIN inscriptions_types_evenements t ON t.te_id = e.te_id" - . " WHERE e.eve_id = " . $intEveId . " LIMIT 1" - ); - $blnHorsTx = is_array($tabTe) - && trim((string)($tabTe['te_nom_fr'] ?? '')) === 'Sans inscription en ligne'; - } - // Le titre "Capitaine" n'a de sens qu'en epreuve d'equipe : meme condition que le champ "Type" // de la fiche (cf. fxInscrGestionRenderFiche). En individuel, on ne l'affiche pas, meme si rol_id=1. $blnEquipe = (intval($arrRow['pec_equipe']) === 1) @@ -1304,31 +1292,25 @@ function fxInscrGestionFetchFicheProfile($arrRow, $strLangue) { $intParIdOriginal = (int)$tabProfile['par_id_original']; - // MSIN-4482 hors tx : réponses souvent sur e.pec_id (PK) alors que la fiche filtre pec_id_original ; - // que_cart_show / que_actif parfois absents sur l'import initial. - $strPecFilter = 'rq.pec_id = ' . $intPecId; - if ($blnHorsTx && $intPecPk > 0 && $intPecPk !== $intPecId) { - $strPecFilter = '(rq.pec_id = ' . $intPecId . ' OR rq.pec_id = ' . $intPecPk . ')'; - } elseif ($blnHorsTx) { - $strPecFilter = '(rq.pec_id = ' . $intPecId - . ($intPecPk > 0 ? (' OR rq.pec_id = ' . $intPecPk) : '') - . ')'; + // MSIN-4482 — hors tx : accepter pec_id PK ou pec_id_original (réponses import). + // Pas de IFNULL(que_actif) / pas de requête te_nom ici : une SQL en erreur = plantage + // (fxGetResults → mysqli_num_rows(false)). + $strPecClause = 'rq.pec_id = ' . $intPecId; + if ($intPecPk > 0 && $intPecPk !== $intPecId) { + $strPecClause = '(rq.pec_id = ' . $intPecId . ' OR rq.pec_id = ' . $intPecPk . ')'; } - $strCartFilter = $blnHorsTx ? '1=1' : 'iq.que_cart_show = 1'; - $strActifFilter = $blnHorsTx ? 'IFNULL(rq.que_actif, 1) = 1' : 'rq.que_actif = 1'; - $sqlQuestions = 'SELECT rq.que_choix_' . $strLangCol . ' AS que_choix,' . ' iq.que_cart_label_' . $strLangCol . ' AS que_label,' . ' rq.que_question_' . $strLangCol . ' AS que_question,' . ' iq.que_tri, iq.que_id' . ' FROM resultats_questions rq' . ' INNER JOIN inscriptions_questions iq ON iq.que_id = rq.que_id' - . ' WHERE ' . $strCartFilter + . ' WHERE iq.que_cart_show = 1' . ' AND iq.eve_id = ' . $intEveId - . ' AND ' . $strPecFilter + . ' AND ' . $strPecClause . ' AND (rq.par_id = ' . $intParId . ' OR rq.par_id = ' . $intParIdOriginal . ')' - . ' AND ' . $strActifFilter + . ' AND rq.que_actif = 1' . " AND TRIM(COALESCE(rq.que_choix_" . $strLangCol . ", '')) <> ''" . ' ORDER BY iq.que_tri, iq.que_id'; diff --git a/sql/MSIN-4482-urgence-rollback-te-1284.sql b/sql/MSIN-4482-urgence-rollback-te-1284.sql new file mode 100644 index 0000000..645834e --- /dev/null +++ b/sql/MSIN-4482-urgence-rollback-te-1284.sql @@ -0,0 +1,15 @@ +-- MSIN-4482 — Urgence : débloquer / rollback type eve 1284 si besoin +-- Notes : exécution UNIQUEMENT sur dev préprod +-- +-- 1) Si MySQL est saturé par un gros UPDATE/DELETE import : +-- SHOW FULL PROCESSLIST; +-- puis KILL ; sur les requêtes longues sur resultats_* / inscriptions_questions +-- +-- 2) Remettre l'événement 1284 en type « Course » (te_id typique = 1 — vérifier d'abord) : + +SELECT te_id, te_nom_fr FROM inscriptions_types_evenements WHERE te_actif = 1 ORDER BY te_nom_fr; + +-- Exemple si Course = te_id 1 : +-- UPDATE inscriptions_evenements SET te_id = 1 WHERE eve_id = 1284; + +SELECT eve_id, te_id, eve_nom_fr FROM inscriptions_evenements WHERE eve_id = 1284;