Error tests, FK violations fix

- ErrorHandler tests: 77 assertions covering FK extraction, normalization, dedup, edge cases. Fix FK table map for child tables.
- Fix FK violation: (int)null → 0 in createThesis for orientation/ap/finality/license FK columns. Add FK value logging to updateThesis.
- Add CURRENT_ISSUES.md with summary of FK violation, dev debugging, and tag dedup status for next conversation
This commit is contained in:
Pontoporeia
2026-05-09 21:36:42 +02:00
parent a80b2c08bf
commit 6cc0e407f3
38 changed files with 1515 additions and 82 deletions

View File

@@ -222,13 +222,36 @@ $checkedFormatsForSiteWeb = $checkedFormatsForSiteWeb ?? [];
<fieldset>
<legend>Mots-clés</legend>
<?php
// Build selectedTags array from form data or thesis keywords
$_selectedTags = [];
// If formData has tag as an array (pill-based repopulation), prefer that
if (!empty($formData['tag']) && is_array($formData['tag'])) {
foreach ($formData['tag'] as $_t) {
if (is_string($_t) && trim($_t) !== '') {
$_selectedTags[] = ['name' => trim($_t)];
}
}
} elseif (!empty($currentTags) && is_array($currentTags)) {
$_selectedTags = array_map(fn($n) => ['name' => $n], $currentTags);
} else {
$_tagsRaw = $formData["tag"] ?? '';
if (is_string($_tagsRaw) && $_tagsRaw !== '') {
foreach (array_map('trim', explode(',', $_tagsRaw)) as $_t) {
if ($_t !== '') {
$_selectedTags[] = ['name' => $_t];
}
}
}
}
$name = "tag";
$label = "Mots-clés (max 10) :";
$value = $oldFn("tag");
$placeholder = "sociologie, anthropologie, ...";
$hint = "Séparez par des virgules. Max 10 mots-clés.";
$attrs = $withAutofocusFn("tag");
include APP_ROOT . "/templates/partials/form/text-field.php";
$label = "Mots-clés :";
$placeholder = "Rechercher un mot-clé…";
$hint = "Tapez pour rechercher ou créer des mots-clés.";
$selectedTags = $_selectedTags;
$hxPost = ($mode === 'partage') ? "/partage/tag-search-fragment" : "/admin/tag-search-fragment.php";
include APP_ROOT . "/templates/partials/form/tag-search.php";
unset($_tagsRaw, $_selectedTags, $_t, $name, $label, $placeholder, $hint, $selectedTags, $hxPost);
?>
</fieldset>