From 08a9b7309fd356cc44d8a74ea874261370e3f1f9 Mon Sep 17 00:00:00 2001 From: Pontoporeia Date: Thu, 9 Jul 2026 17:05:58 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20locked=5Fyear=20cleared=20on=20edit=20?= =?UTF-8?q?=E2=80=94=20populate=20edit=20dialog=20field?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The openEditDialog JS function didn't populate the locked_year input in the edit dialog, and the PHP template didn't pass locked_year as an argument. Any edit to a link (even just changing the name) would clear the locked academic year to NULL. - Pass $linkLockedYear as 5th argument to openEditDialog in the template - Accept and populate edit-locked-year input in the JS handler --- TODO.md | 1 + app/public/assets/js/app/admin-acces.js | 3 ++- app/templates/admin/acces.php | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/TODO.md b/TODO.md index 51093a7..8b2637a 100644 --- a/TODO.md +++ b/TODO.md @@ -45,3 +45,4 @@ - [x] Close TOC (licence/charte/apropos) and Filtres (search.php)
by default on mobile - [x] Wider heading scale (h1/h2/h3) for apropos/licence/charte pages: step-5 / step-3 / step-1 - [x] Masquer le bloc "Durée" sur la page TFE quand aucune durée n'est encodée (ni pages ni minutes) +- [x] Fix: locked_year cleared on edit — edit dialog didn't populate the field, so any edit cleared the locked academic year diff --git a/app/public/assets/js/app/admin-acces.js b/app/public/assets/js/app/admin-acces.js index 64d7846..d0cfa29 100644 --- a/app/public/assets/js/app/admin-acces.js +++ b/app/public/assets/js/app/admin-acces.js @@ -74,10 +74,11 @@ function _copyTextToClipboard(text) { .catch(() => {}); } -window.openEditDialog = (id, name, _hasPassword, expiresVal) => { +window.openEditDialog = (id, name, _hasPassword, expiresVal, lockedYear) => { document.getElementById("edit-link-id").value = id; document.getElementById("edit-name").value = name || ""; document.getElementById("edit-expires").value = expiresVal || ""; + document.getElementById("edit-locked-year").value = lockedYear || ""; document.getElementById("edit-dialog").showModal(); }; diff --git a/app/templates/admin/acces.php b/app/templates/admin/acces.php index 559aef3..58af22a 100644 --- a/app/templates/admin/acces.php +++ b/app/templates/admin/acces.php @@ -94,7 +94,7 @@