Refactor fxImportResultatsSaveQuestionAnswer to ensure que_actif is set correctly during question updates and insertions. Simplify SQL logic for handling pec_id and improve error handling for database queries in fxInscrGestionFetchFicheProfile. Increment version code.
This commit is contained in:
@ -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.
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
15
sql/MSIN-4482-urgence-rollback-te-1284.sql
Normal file
15
sql/MSIN-4482-urgence-rollback-te-1284.sql
Normal file
@ -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 <id>; 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;
|
||||
Reference in New Issue
Block a user