MSIN-4468 — Enhance quantity validation in AJAX and JavaScript for race management. Implement error handling for total quantity below registrations and update related UI elements. Increment version code to 4.72.853.
This commit is contained in:
@ -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':
|
||||
|
||||
@ -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',
|
||||
|
||||
@ -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();
|
||||
?>
|
||||
<div class="epr-gestion-panel" data-epr-id="<?php echo $epr_id; ?>">
|
||||
<div class="epr-gestion-panel" data-epr-id="<?php echo $epr_id; ?>" data-qte-inscrits="<?php echo (int)$arrQuantites['qte_inscrits']; ?>">
|
||||
<dl class="epr-gestion-stats">
|
||||
<div class="epr-gestion-stat">
|
||||
<dt><?php afficheTexte('promoteur_qte_epr_qte_total'); ?></dt>
|
||||
|
||||
@ -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');
|
||||
|
||||
49
sql/MSIN-4468-message-quantite-totale.sql
Normal file
49
sql/MSIN-4468-message-quantite-totale.sql
Normal file
@ -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'
|
||||
);
|
||||
Reference in New Issue
Block a user