Fix edit form: is_published reset, contact decoupling, note label, author name case

- Fix #1: Add is_published to getThesisRawFields() SELECT so the publish
  checkbox stays checked when editing an already-published TFE.
- Fix #2: Rename 'Note contextuelle' → 'Note contextuelle relative à
  soutenance' in all templates and StudentEmail.
- Fix #3: Update findOrCreateAuthor to also UPDATE the author name when
  a record is found by name (fixes inability to capitalise names).
- Fix #4/#5: Decouple contact_interne (private author email) from
  contact_visible (public contact on TFE page). Add migration 037 to
  add contact_visible TEXT column to theses table and rebuild
  v_theses_full view. Update all controllers, templates, and DB methods
  to treat them independently.
- Fix #6: Investigated libre→interne restriction — no code barrier
  found; likely resolved by is_published fix.
This commit is contained in:
Pontoporeia
2026-06-08 18:31:10 +02:00
parent 3d524226a1
commit 3016c199bd
15 changed files with 164 additions and 37 deletions

View File

@@ -42,6 +42,7 @@
$contactInterne = null;
$contactPublic = false;
$currentContextNote = null;
$currentContactVisible = null;
include APP_ROOT . '/templates/partials/form/form.php';
?>

View File

@@ -8,6 +8,7 @@
'subtitle' => $thesis['subtitle'] ?? '',
'auteurice' => $thesis['authors'] ?? '',
'mail' => $contactInterne ?? '',
'contact_visible' => $currentContactVisible ?? '',
'synopsis' => $thesis['synopsis'] ?? '',
'tag' => $thesis['keywords'] ?? '',
'année' => $thesis['year'],

View File

@@ -45,10 +45,12 @@
<dt>Sous-titre</dt><dd><?= htmlspecialchars($thesis['subtitle']) ?></dd>
<?php endif; ?>
<dt>Auteur·ice(s)</dt><dd><?= htmlspecialchars($thesis['authors']) ?></dd>
<?php if (!empty($thesis['contact_interne'])): ?>
<dt>Contact (interne)</dt><dd><?= htmlspecialchars($thesis['contact_interne']) ?></dd>
<?php if (!empty($thesis['contact_visible'])): ?>
<dt>Contact visible</dt><dd><?= htmlspecialchars($thesis['contact_visible']) ?></dd>
<?php endif; ?>
<?php if (!empty($thesis['contact_interne'])): ?>
<dt>Contact interne (privé)</dt><dd><?= htmlspecialchars($thesis['contact_interne']) ?></dd>
<?php endif; ?>
<dt>Contact public</dt><dd><?= !empty($thesis['contact_public']) ? 'Oui' : 'Non' ?></dd>
<dt>Année</dt><dd><?= htmlspecialchars((string)$thesis['year']) ?></dd>
<dt>Objet</dt><dd><?= htmlspecialchars($thesis['objet'] ?? 'tfe') ?></dd>
<?php if ($thesis['is_doctoral']): ?>
@@ -113,7 +115,7 @@
<dd class="recap-synopsis"><?= nl2br(htmlspecialchars($thesis['synopsis'] ?? '')) ?></dd>
<?php if ($thesis['context_note']): ?>
<dt>Note contextuelle</dt>
<dt>Note contextuelle relative à soutenance</dt>
<dd class="recap-long-text"><?= nl2br(htmlspecialchars($thesis['context_note'])) ?></dd>
<?php endif; ?>

View File

@@ -58,12 +58,14 @@ $adminMode = $adminMode ?? false;
$hint = 'Séparez les auteur·ices par des virgules.';
include APP_ROOT . '/templates/partials/form/text-field.php';
?>
<?php if (!$adminMode): ?>
<?php
$name = 'mail'; $label = 'Contact visible (optionnel) [mail/site/insta/etc.] :'; $value = $oldFn('mail');
$attrs = ['autocomplete' => 'email'];
$hint = 'Un seul contact. Indiquez l\'URL complète pour un site (https://…), l\'adresse mail, le nom d\'utilisateur avec @ pour Instagram (@pseudo), ou l\'adresse complète pour Mastodon (@pseudo@instance). Ce contact sera visible publiquement sur la fiche du TFE.';
include APP_ROOT . '/templates/partials/form/text-field.php';
?>
<?php endif; ?>
<div>
<label for="synopsis">Synopsis :<?= $adminMode ? '' : ' <span class="asterisk">*</span>' ?></label>

View File

@@ -32,7 +32,7 @@
* bool $showContact — Contact checkbox fieldset
* bool $showCoverPreview — cover image preview + remove checkbox
* bool $showExistingFiles — existing thesis files list (deletable)
* bool $showBackoffice — Backoffice fieldset (context_note, jury_points, remarks, baiu_link, exemplaires, contact_interne, is_published)
* bool $showBackoffice — Backoffice fieldset (context_note, jury_points, remarks, baiu_link, exemplaires, contact_visible, contact_interne, is_published)
* bool $showEmailConfirmation — E-mail de confirmation fieldset
* string $helpFn — fn(string $key): string (for help blocks)
@@ -408,9 +408,9 @@ if ($filesMode === 'add'): ?>
<fieldset>
<legend>Backoffice</legend>
<!-- 1. Note contextuelle -->
<!-- 1. Note contextuelle relative à soutenance -->
<div class="admin-form-group">
<label for="context_note">Note contextuelle :</label>
<label for="context_note">Note contextuelle relative à soutenance :</label>
<div>
<textarea id="context_note" name="context_note"
rows="4" maxlength="1500"><?= htmlspecialchars(
@@ -479,16 +479,25 @@ if ($filesMode === 'add'): ?>
<small>Case logistique : cocher si un exemplaire physique est disponible à l'ERG.</small>
</div>
<!-- 7. Contact interne -->
<!-- 7. Contact visible (public) -->
<div class="admin-form-group">
<label for="contact_interne">Contact interne :</label>
<label for="contact_visible">Contact visible :</label>
<input type="text" id="contact_visible" name="contact_visible"
value="<?= htmlspecialchars($currentContactVisible ?? $formData['contact_visible'] ?? '') ?>"
placeholder="email, URL, @pseudo...">
<small>Contact affiché publiquement sur la page du TFE (email, site web, réseau social…). Laisser vide pour ne rien afficher.</small>
</div>
<!-- 8. Contact interne (privé) -->
<div class="admin-form-group">
<label for="contact_interne">Contact interne (privé) :</label>
<input type="email" id="contact_interne" name="contact_interne"
value="<?= htmlspecialchars($contactInterne ?? $formData['contact_interne'] ?? '') ?>"
placeholder="ton.email@exemple.be">
<small>Adresse de contact interne (non visible publiquement). Peut être laissé vide.</small>
<small>Email privé de l'étudiant·e, utilisé pour l'envoi de la confirmation du formulaire. Non visible publiquement.</small>
</div>
<!-- 8. Publication -->
<!-- 9. Publication -->
<div class="admin-form-group">
<label class="admin-checkbox-label">
<input type="checkbox" name="is_published" value="1"

View File

@@ -185,16 +185,16 @@
<?php if (!empty($data["context_note"])): ?>
<p class="tfe-meta-item tfe-meta-note">
<span class="tfe-meta-label">Note :</span>
<span class="tfe-meta-label">Note contextuelle relative à soutenance :</span>
<span class="tfe-note-value"><?= nl2br(htmlspecialchars($data["context_note"])) ?></span>
</p>
<?php endif; ?>
<?php if (!empty($data["contact_interne"]) && !empty($data["contact_public"])): ?>
<?php if (!empty($data["contact_visible"])): ?>
<p class="tfe-meta-item">
<span class="tfe-meta-label">Contact :</span>
<?php
$_contact = $data["contact_interne"];
$_contact = $data["contact_visible"];
$_isUrl = filter_var($_contact, FILTER_VALIDATE_URL) !== false;
$_isEmail = !$_isUrl && str_contains($_contact, "@");
if ($_isUrl):