MSIN-4328 — Update SQL queries in ajax_bib_range.php and inc_fx_promoteur.php to set par_maj alongside no_bib and par_date_bib, ensuring accurate timestamping for participant updates. Enhance fxChronotrackApiSync to include par_date_bib in filtering logic. Increment version code.

This commit is contained in:
2026-07-22 15:15:38 -04:00
parent b9e4395297
commit 23def197c8
3 changed files with 28 additions and 14 deletions

View File

@ -1274,7 +1274,9 @@ if ($action == 'reset_apply') {
$sql = "
UPDATE resultats_participants
SET no_bib = NULL
SET no_bib = NULL,
par_date_bib = NULL,
par_maj = '" . fxGetDateTime() . "'
WHERE par_id = $par_id
AND is_cancelled = 0
";
@ -1343,7 +1345,9 @@ if ($action == 'reset_all_apply') {
$sql = "
UPDATE resultats_participants
SET no_bib = NULL
SET no_bib = NULL,
par_date_bib = NULL,
par_maj = '" . fxGetDateTime() . "'
WHERE par_id = $par_id
AND is_cancelled = 0
";

View File

@ -228,6 +228,7 @@ function fxChronotrackApiSyncPickTeamRepresentative(array $tabMembers) {
* MSIN-4328 — éligibles dont par_maj > dernier push (ou tous si jamais poussé).
* Inclut aussi no_bib_remis_date : le check-in « dossard récupéré » met souvent
* par_maj = par_maj (nincrémente pas) mais rafraîchit no_bib_remis_date.
* Inclut aussi par_date_bib (filet si un chemin dossard oublie par_maj).
*/
function fxChronotrackApiSyncFilterChangedSincePush(array $tabTransferable, $strLastPushAt) {
$strLastPushAt = trim((string)$strLastPushAt);
@ -257,6 +258,15 @@ function fxChronotrackApiSyncFilterChangedSincePush(array $tabTransferable, $str
$intRemis = strtotime($strRemisDate);
if ($intRemis !== false && $intRemis > $intLast) {
$tabOut[] = $arrItem;
continue;
}
}
// MSIN-4328 — assignation dossard (par_date_bib) sans par_maj
$strDateBib = trim((string)($arrItem['row']['par_date_bib'] ?? ''));
if ($strDateBib !== '' && $strDateBib !== '0000-00-00 00:00:00') {
$intDateBib = strtotime($strDateBib);
if ($intDateBib !== false && $intDateBib > $intLast) {
$tabOut[] = $arrItem;
}
}
}
@ -707,7 +717,7 @@ function fxChronotrackApiSyncLoadMs1Participants($intEveId) {
$sql = "SELECT p.par_id, p.par_id_original, p.epr_id, p.pec_id, p.rol_id, p.par_equipe, p.par_nom_equipe,"
. " p.par_prenom, p.par_nom, p.par_sexe,"
. " p.par_naissance, p.no_bib, p.no_bib_remis, p.no_bib_remis_date, p.par_statut_course,"
. " p.par_naissance, p.no_bib, p.no_bib_remis, p.no_bib_remis_date, p.par_date_bib, p.par_statut_course,"
. " p.par_ville, p.par_adresse, p.par_codepostal,"
. " p.is_cancelled, p.par_maj, p.ct_entry_id,"
. " ec.pec_equipe, ec.no_equipe, ec.pec_nom_equipe,"

View File

@ -1824,7 +1824,7 @@ function fxSetBibNumbers($tab_data, $int_epr_id, $int_start, $int_finish, $int_t
}
// resultats_participants
$sqlUpdate = "UPDATE resultats_participants SET no_bib = null, par_date_bib = null WHERE epr_id = " . intval($int_epr_id);
$sqlUpdate = "UPDATE resultats_participants SET no_bib = null, par_date_bib = null, par_maj = '" . fxGetDateTime() . "' WHERE epr_id = " . intval($int_epr_id);
$qryUpdate = $objDatabase->fxQuery($sqlUpdate);
if (!$qryUpdate) {
@ -1914,15 +1914,14 @@ function fxSetBibNumbers($tab_data, $int_epr_id, $int_start, $int_finish, $int_t
$strNewBibBatch = ($str_action == 'reset') ? '' : (string)($intNoBib + $intCtr);
$sqlUpdate = "UPDATE resultats_participants ";
if ($str_action == 'reset') {
$sqlUpdate .= "SET no_bib = '', par_date_bib = null";
// MSIN-4328 — par_maj pour repousser vers ChronoTrack
$sqlUpdate .= "SET no_bib = '', par_date_bib = null, par_maj = '" . fxGetDateTime() . "'";
// $sqlUpdate .= "SET no_bib = ''";
} else {
if($tabInscriptions[$i]['par_date_bib'] == null){
$sqlUpdate .= "SET par_date_bib = '" . fxGetDateTime() . "', no_bib = '" . $objDatabase->fxEscape($intNoBib + $intCtr) . "'";
$sqlUpdate .= "SET par_date_bib = '" . fxGetDateTime() . "', no_bib = '" . $objDatabase->fxEscape($intNoBib + $intCtr) . "', par_maj = '" . fxGetDateTime() . "'";
} else{
$sqlUpdate .= "SET no_bib = '" . $objDatabase->fxEscape($intNoBib + $intCtr) . "'";
// $sqlUpdate .= "SET no_bib = '" . $objDatabase->fxEscape($intNoBib + $intCtr) . "', par_maj = '" . fxGetDateTime() . "'";
// $sqlUpdate .= "SET no_bib = '" . $objDatabase->fxEscape($intNoBib + $intCtr) . "', par_modification_promoteur = 1, par_maj = '" . fxGetDateTime() . "'";
$sqlUpdate .= "SET no_bib = '" . $objDatabase->fxEscape($intNoBib + $intCtr) . "', par_maj = '" . fxGetDateTime() . "'";
}
}
@ -1991,11 +1990,10 @@ function fxSetBibNumbers($tab_data, $int_epr_id, $int_start, $int_finish, $int_t
$strOldBibEq = (string)($tabEquipe[$j]['no_bib'] ?? '');
$strNewBibEq = (string)$intNoBib;
if($tabInscriptions[$i]['par_date_bib'] == null){
$sqlUpdatePart = "UPDATE resultats_participants SET par_date_bib = '" . fxGetDateTime() . "', no_bib = '" . $objDatabase->fxEscape($intNoBib). "' WHERE par_id = " . $intParEqBatch;
$sqlUpdatePart = "UPDATE resultats_participants SET par_date_bib = '" . fxGetDateTime() . "', no_bib = '" . $objDatabase->fxEscape($intNoBib). "', par_maj = '" . fxGetDateTime() . "' WHERE par_id = " . $intParEqBatch;
} else{
$sqlUpdatePart = "UPDATE resultats_participants SET no_bib = '" . $objDatabase->fxEscape($intNoBib) . "' WHERE par_id = " . $intParEqBatch;
// $sqlUpdatePart = "UPDATE resultats_participants SET par_maj = '" . fxGetDateTime() . "', no_bib = '" . $objDatabase->fxEscape($intNoBib) . "' WHERE par_id = " . intval($tabEquipe[$j]['par_id']);
// $sqlUpdatePart = "UPDATE resultats_participants SET par_maj = '" . fxGetDateTime() . "', par_modification_promoteur = 1, no_bib = '" . $objDatabase->fxEscape($intNoBib) . "' WHERE par_id = " . intval($tabEquipe[$j]['par_id']);
// MSIN-4328 — par_maj pour repousser vers ChronoTrack
$sqlUpdatePart = "UPDATE resultats_participants SET no_bib = '" . $objDatabase->fxEscape($intNoBib) . "', par_maj = '" . fxGetDateTime() . "' WHERE par_id = " . $intParEqBatch;
}
$qryUpdatePart = $objDatabase->fxQuery($sqlUpdatePart);
if (!$qryUpdatePart) {
@ -8511,10 +8509,12 @@ function fxTryAssignNextBibForParticipant($epr_id, $par_id, $tabRanges, $mode, &
function fxApplyBatchParticipantBib($epr_id, $par_id, $foundBib) {
global $objDatabase;
// MSIN-4328 — par_maj pour que ChronoTrack détecte le changement de dossard
$sqlUpdate = "
UPDATE resultats_participants
SET no_bib = " . intval($foundBib) . ",
par_date_bib = IFNULL(par_date_bib, NOW())
par_date_bib = IFNULL(par_date_bib, NOW()),
par_maj = '" . fxGetDateTime() . "'
WHERE par_id = " . intval($par_id) . "
AND is_cancelled = 0
AND (no_bib IS NULL OR no_bib = '' OR no_bib = 0)