fix: author name casing not updating — use ID lookup priority

Root cause: SQLite uses BINARY collation, so WHERE name = ? is
case-sensitive. When changing 'john doe' to 'John Doe', the name
lookup failed and fell through to the email path which didn't update
the name. The previous fix only added UPDATE in the name-match branch.

Fixes in findOrCreateAuthor:
1. Accept optional $idHint parameter — when known (edit flow), update
   directly by ID (fastest, zero ambiguity)
2. Add COLLATE NOCASE to the name lookup (fallback path)
3. Add UPDATE in the email fallback path too

setThesisAuthors now fetches existing author_ids before deletion and
passes them as position-based hints, so identity is always preserved.
This commit is contained in:
Pontoporeia
2026-06-09 12:33:26 +02:00
parent 3016c199bd
commit 3df1456781
12 changed files with 62 additions and 16 deletions

View File

@@ -119,6 +119,15 @@ $adminMode = $adminMode ?? false;
<p class="licence-note"><em>L'auteur·ice peut, à tout moment, décider de restreindre son propre choix. Iel ne peut par contre pas l'ouvrir.</em></p>
</div>
<!-- Seed saved licence values for the initial htmx load.
These are overridden by visible inputs inside .licence-license-choice
once htmx renders them — later DOM order wins in POST. -->
<input type="hidden" name="license_id" value="<?= htmlspecialchars((string)($formData['license_id'] ?? '')) ?>">
<input type="hidden" name="license_custom" value="<?= htmlspecialchars($formData['license_custom'] ?? '') ?>">
<input type="hidden" name="cc2r" value="<?= !empty($formData['cc2r']) ? '1' : '' ?>">
<?php $wantLicense = !empty($formData['license_id']) || !empty($formData['license_custom']); ?>
<input type="hidden" name="want_license" value="<?= $wantLicense ? '1' : '' ?>">
<!-- Licence — swapped via htmx when radio changes -->
<div class="licence-license-choice"
hx-post="<?= $adminMode ? '/admin/fragments/licence.php' : '/partage/fragments/licence.php' ?>"