diff --git a/ajax_promoteur.php b/ajax_promoteur.php index 51f0ad9..ca0c1d6 100644 --- a/ajax_promoteur.php +++ b/ajax_promoteur.php @@ -88,7 +88,14 @@ switch($strAction) { $tabRetour = fxUpdateQuantiteTotale($intEpreuve, intval($strQuantiteTotale)); if (($tabRetour['state'] ?? 'error') !== 'success') { - $tabRetour['message'] = afficheTexte('promoteur_bad_qte_update', 0); + if (($tabRetour['error_code'] ?? '') === 'total_below_registrations') { + $tabRetour['message'] = fxBibMsg( + 'bib_v5_qte_total_min', + intval($tabRetour['qte_inscrits'] ?? 0) + ); + } else { + $tabRetour['message'] = afficheTexte('promoteur_bad_qte_update', 0); + } } break; case 'no_equipe': diff --git a/js/v2/bib-assignments.js b/js/v2/bib-assignments.js index 8766b1f..f2c0e7f 100644 --- a/js/v2/bib-assignments.js +++ b/js/v2/bib-assignments.js @@ -2294,6 +2294,12 @@ if (elInscrits) { elInscrits.textContent = row.qte_inscrits; } + let gestionPanel = document.querySelector( + '.epr-gestion-panel[data-epr-id="' + eprId + '"]' + ); + if (gestionPanel && row.qte_inscrits !== undefined) { + gestionPanel.dataset.qteInscrits = row.qte_inscrits; + } if (elCheckin) { elCheckin.textContent = row.qte_checkin; } @@ -2345,6 +2351,15 @@ return; } + let gestionPanel = btn.closest('.epr-gestion-panel'); + let intNbInscriptions = gestionPanel + ? parseInt(gestionPanel.dataset.qteInscrits, 10) || 0 + : 0; + if (intQteTotale < intNbInscriptions) { + alert(bibJsFmt('jsQteTotalMin', intNbInscriptions)); + return; + } + bibLoaderShow(); fetch('/ajax_promoteur.php', { method: 'POST', diff --git a/php/inc_fx_promoteur.php b/php/inc_fx_promoteur.php index 8c7e46d..3ec7a71 100644 --- a/php/inc_fx_promoteur.php +++ b/php/inc_fx_promoteur.php @@ -2741,6 +2741,8 @@ function fxUpdateQuantiteTotale($intEpreuve, $intQuantiteTotale) { $arrQuantites = fxGetQuantites($intEpreuve); $intNbInscriptions = intval($arrQuantites['qte_inscrits'] ?? 0); if ($intQuantiteTotale < $intNbInscriptions) { + $arrRetour['error_code'] = 'total_below_registrations'; + $arrRetour['qte_inscrits'] = $intNbInscriptions; return $arrRetour; } @@ -3893,6 +3895,7 @@ function fxBibModuleJsDataAttrs() { 'range-invalid' => 'bib_v4_js_range_invalid', 'range-invalid-end' => 'bib_v4_js_range_invalid_end', 'range-invalid-qty' => 'bib_v4_js_range_invalid_qty', + 'qte-total-min' => 'bib_v5_qte_total_min', 'batch-progress' => 'bib_v4_js_batch_progress', 'global-no-epr' => 'bib_v4_js_global_no_epr', 'global-no-seq' => 'bib_v4_js_global_no_seq', @@ -4464,7 +4467,7 @@ function renderBibGestionEpreuve($epr_id, $int_eve_id, $strLangue) { ob_start(); ?> -
+
diff --git a/php/inc_settings.php b/php/inc_settings.php index e3ae179..2ca332e 100644 --- a/php/inc_settings.php +++ b/php/inc_settings.php @@ -7,7 +7,7 @@ * Constantes * * **************/ -define('_VERSION_CODE', '4.72.852'); // MSIN-4468 +define('_VERSION_CODE', '4.72.853'); // MSIN-4468 define('_DATE_CODE', '2026-07-21'); //MSIN-4290 define('QR_SECRET_KEY', 'ms1_qr_2026_cle_secrete_longue_et_fixe'); diff --git a/sql/MSIN-4468-message-quantite-totale.sql b/sql/MSIN-4468-message-quantite-totale.sql new file mode 100644 index 0000000..eb9a3b1 --- /dev/null +++ b/sql/MSIN-4468-message-quantite-totale.sql @@ -0,0 +1,49 @@ +-- MSIN-4468 — Message de validation de la quantité totale +-- À exécuter avec le déploiement de l'édition de la quantité totale dans la gestion des dossards. +-- Idempotent; ajoute uniquement les libellés FR/EN absents pour compte.php. + +INSERT INTO info ( + info_clef, + info_langue, + info_texte, + info_aide, + info_prg, + info_description, + info_trie, + info_actif, + info_option1, + info_option2, + info_option3, + info_creation +) +SELECT + src.info_clef, + src.info_langue, + src.info_texte, + '', + 'compte.php', + 'MSIN-4468', + 0, + 1, + '', + '', + '', + NOW() +FROM ( + SELECT + 'bib_v5_qte_total_min' AS info_clef, + 'fr' AS info_langue, + 'Quantité refusée : le total doit être d''au moins %d, soit le nombre d''inscriptions déjà vendues.' AS info_texte + UNION ALL + SELECT + 'bib_v5_qte_total_min', + 'en', + 'Quantity rejected: the total must be at least %d, which is the number of registrations already sold.' +) src +WHERE NOT EXISTS ( + SELECT 1 + FROM info current_info + WHERE current_info.info_clef = src.info_clef + AND current_info.info_langue = src.info_langue + AND current_info.info_prg = 'compte.php' +);