';
+ if ($blnClosed) {
+ echo '
Événement fermé — push manuel autorisé pour tests ou rattrapage.
';
+ }
echo '
Lit resultats_participants (comme le rapport chrono). ';
echo 'External ID = par_id_original. POST vers ChronoTrack — aucune modification MS1.
';
echo '
Chargement…
';
@@ -322,9 +330,14 @@ function fxChronotrackApiAdminRenderPageScript($intEveId, $arrConfig, $blnClosed
$('.ct-api-set-status').on('click', function () {
var strStatus = $(this).data('status');
- var strConfirm = (strStatus === 'ferme')
- ? 'Terminer la course ? Aucun changement ne sera plus envoyé à ChronoTrack.'
- : 'Activer la synchronisation automatique pour cet événement ?';
+ var strConfirm;
+ if (strStatus === 'ferme') {
+ strConfirm = 'Terminer la course ? La sync auto et les changements de config seront bloqués (push manuel toujours possible).';
+ } else if (strStatus === 'lie') {
+ strConfirm = 'Rouvrir cet événement ChronoTrack (statut Lié) ?';
+ } else {
+ strConfirm = 'Activer la synchronisation automatique pour cet événement ?';
+ }
if (!window.confirm(strConfirm)) {
return;
}
@@ -584,7 +597,7 @@ function fxChronotrackApiAdminRenderPageScript($intEveId, $arrConfig, $blnClosed
function loadPushPreview() {
var $sum = $('#ct_api_push_summary');
- if (!$sum.length || blnClosed) {
+ if (!$sum.length) {
return;
}
$sum.html('
Calcul du diff MS1 ↔ ChronoTrack…');
@@ -595,7 +608,7 @@ function fxChronotrackApiAdminRenderPageScript($intEveId, $arrConfig, $blnClosed
});
}
- if ($('#ct_api_push_card').length && !blnClosed) {
+ if ($('#ct_api_push_card').length) {
loadPushPreview();
$('#ct_api_btn_push_refresh').on('click', function () {
diff --git a/php/chronotrack_api/fx_chronotrack_config.php b/php/chronotrack_api/fx_chronotrack_config.php
index 3dbf336..1a3cc8a 100644
--- a/php/chronotrack_api/fx_chronotrack_config.php
+++ b/php/chronotrack_api/fx_chronotrack_config.php
@@ -85,7 +85,9 @@ function fxChronotrackApiConfigSetStatus($intEveId, $strStatus, $intUsaId) {
}
if ($arrExisting['sync_status'] === MSIN_API_CHRONOTRACK_SYNC_FERME) {
- return array('state' => 'error', 'message' => 'Événement déjà fermé');
+ if ($strStatus !== MSIN_API_CHRONOTRACK_SYNC_LIE) {
+ return array('state' => 'error', 'message' => 'Événement fermé — seule la réouverture (Lié) est permise.');
+ }
}
$strStatus = trim($strStatus);
@@ -100,6 +102,9 @@ function fxChronotrackApiConfigSetStatus($intEveId, $strStatus, $intUsaId) {
if ($strStatus === MSIN_API_CHRONOTRACK_SYNC_FERME) {
$strExtra = ", closed_at = '" . fxGetDateTime() . "', closed_by_usa_id = " . intval($intUsaId);
}
+ if ($strStatus === MSIN_API_CHRONOTRACK_SYNC_LIE && $arrExisting['sync_status'] === MSIN_API_CHRONOTRACK_SYNC_FERME) {
+ $strExtra = ", closed_at = NULL, closed_by_usa_id = NULL";
+ }
$sql = "UPDATE api_chronotrack_config SET sync_status = '" . $objDatabase->fxEscape($strStatus) . "'"
. $strExtra
diff --git a/php/chronotrack_api/fx_chronotrack_sync.php b/php/chronotrack_api/fx_chronotrack_sync.php
index 1ede1b3..44a1788 100644
--- a/php/chronotrack_api/fx_chronotrack_sync.php
+++ b/php/chronotrack_api/fx_chronotrack_sync.php
@@ -256,9 +256,7 @@ function fxChronotrackApiSyncBuildPreview($intEveId) {
if ($arrConfig === null) {
return array('state' => 'error', 'message' => 'Événement non lié à ChronoTrack');
}
- if ($arrConfig['sync_status'] === MSIN_API_CHRONOTRACK_SYNC_FERME) {
- return array('state' => 'error', 'message' => 'Sync fermée pour cet événement');
- }
+
if (!fxChronotrackApiSettingsConfigured()) {
return array('state' => 'error', 'message' => fxChronotrackApiSettingsErrorMessage());
}