diff --git a/TODO.md b/TODO.md index 862809e..5f3a5ba 100644 --- a/TODO.md +++ b/TODO.md @@ -75,5 +75,8 @@ - [x] Fix: formulaire.php unconditionally suppresses display_errors even in dev mode - [x] Fix: access_type_id radio has no "none" option — added "— Non défini" radio for admin mode - [x] Fix: radio button checked detection broken (int vs string strict comparison in fieldset-licence-explanation.php) +- [x] Rename author_email → contact_interne in v_theses_full view, controllers, forms, and templates +- [x] Rename author_show_contact → contact_public in v_theses_full view +- [x] Restore contact_interne backoffice field with proper variable name, wire to save (takes precedence over mail) - [x] Fix: htmlspecialchars(null) crash in old() on admin/add.php and admin/edit.php (null values in form data) - [x] Fix: jury-fieldset.php old() return type confusion (array vs string) for jury_lecteur:_interne:_externe keys diff --git a/app/public/partage/index.php b/app/public/partage/index.php index 3bb6eb2..3f4d488 100644 --- a/app/public/partage/index.php +++ b/app/public/partage/index.php @@ -337,8 +337,8 @@ function renderShareLinkForm(string $slug, array $link): void // Context / backoffice not shown in partage $currentRaw = []; - $currentAuthorEmail = null; - $currentAuthorShowContact = false; + $contactInterne = null; + $contactPublic = false; $currentContextNote = null; ?> diff --git a/app/src/Controllers/ThesisCreateController.php b/app/src/Controllers/ThesisCreateController.php index 862c9ba..778b9f7 100644 --- a/app/src/Controllers/ThesisCreateController.php +++ b/app/src/Controllers/ThesisCreateController.php @@ -323,7 +323,12 @@ class ThesisCreateController throw new Exception("Le champ 'Nom/Prénom/Pseudo' est requis."); } - $mail = !empty($post['mail']) ? $this->sanitiseString($post['mail']) : ''; + // contact_interne (backoffice) takes precedence over mail (tfe-info fieldset) + $contactInterne = trim($post['contact_interne'] ?? ''); + $mail = !empty($post['mail']) ? $this->sanitiseString($post['mail']) : ''; + if ($contactInterne !== '') { + $mail = $contactInterne; + } // contact_public: respected if present (admin form); defaults to true for student forms // where the spec says contact is always visible when provided. if (array_key_exists('contact_public', $post)) { diff --git a/app/src/Controllers/ThesisEditController.php b/app/src/Controllers/ThesisEditController.php index 1fb6902..58193ec 100644 --- a/app/src/Controllers/ThesisEditController.php +++ b/app/src/Controllers/ThesisEditController.php @@ -106,8 +106,8 @@ class ThesisEditController $currentContextNote = $rawRow['context_note'] ?? ''; // Author contact info (from view) - $currentAuthorEmail = $thesis['author_email'] ?? ''; - $currentAuthorShowContact = (bool)($thesis['author_show_contact'] ?? false); + $contactInterne = $thesis['contact_interne'] ?? ''; + $contactPublic = (bool)($thesis['contact_public'] ?? false); return [ 'thesis' => $thesis, @@ -126,8 +126,8 @@ class ThesisEditController 'currentLicenseId' => $currentLicenseId, 'currentAccessTypeId' => $currentAccessTypeId, 'currentContextNote' => $currentContextNote, - 'currentAuthorEmail' => $currentAuthorEmail, - 'currentAuthorShowContact' => $currentAuthorShowContact, + 'contactInterne' => $contactInterne, + 'contactPublic' => $contactPublic, 'currentRaw' => $rawRow, 'pageTitle' => 'Éditer TFE - ' . htmlspecialchars($thesis['title']), ]; @@ -219,6 +219,9 @@ class ThesisEditController // ── 2. Authors (alphabetically sorted) ───────────────────────────── $authorsRaw = trim($post['auteurice'] ?? ''); $showContact = !empty($post['contact_public']); + // contact_interne (backoffice) takes precedence over mail (tfe-info fieldset) + $contactInterne = trim($post['contact_interne'] ?? ''); + $firstAuthorEmail = $contactInterne !== '' ? $contactInterne : ($post['mail'] ?? null); $authorNames = []; if ($authorsRaw !== '') { $authorNames = array_values(array_filter(array_map('trim', explode(',', $authorsRaw)), fn ($n) => $n !== '')); @@ -228,7 +231,7 @@ class ThesisEditController foreach ($authorNames as $i => $name) { $authorEntries[] = [ 'name' => $name, - 'email' => $i === 0 ? ($post['mail'] ?? null) : null, + 'email' => $i === 0 ? $firstAuthorEmail : null, 'show_contact' => $i === 0 ? $showContact : false, ]; } diff --git a/app/storage/schema.sql b/app/storage/schema.sql index c8e3005..82183a6 100644 --- a/app/storage/schema.sql +++ b/app/storage/schema.sql @@ -529,8 +529,8 @@ SELECT GROUP_CONCAT(DISTINCT fmt.name) as formats, GROUP_CONCAT(DISTINCT tg.name) as keywords, -- First author's email and contact-visibility flag - (SELECT a2.email FROM authors a2 JOIN thesis_authors ta2 ON a2.id = ta2.author_id WHERE ta2.thesis_id = t.id ORDER BY ta2.author_order LIMIT 1) as author_email, - (SELECT a2.show_contact FROM authors a2 JOIN thesis_authors ta2 ON a2.id = ta2.author_id WHERE ta2.thesis_id = t.id ORDER BY ta2.author_order LIMIT 1) as author_show_contact + (SELECT a2.email FROM authors a2 JOIN thesis_authors ta2 ON a2.id = ta2.author_id WHERE ta2.thesis_id = t.id ORDER BY ta2.author_order LIMIT 1) as contact_interne, + (SELECT a2.show_contact FROM authors a2 JOIN thesis_authors ta2 ON a2.id = ta2.author_id WHERE ta2.thesis_id = t.id ORDER BY ta2.author_order LIMIT 1) as contact_public FROM theses t LEFT JOIN orientations o ON t.orientation_id = o.id LEFT JOIN ap_programs ap ON t.ap_program_id = ap.id diff --git a/app/templates/admin/acces.php b/app/templates/admin/acces.php index 56375d9..9790626 100644 --- a/app/templates/admin/acces.php +++ b/app/templates/admin/acces.php @@ -74,6 +74,19 @@ +%%%%%%% diff from: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision) +\\\\\\\ to: vpwuyvyv f513921d "Fix: email clearing in findOrCreateAuthor, htmlspecialchars(null) crash in old(), dead contact_interne field, access_type_id radio clearing" (rebased revision) ++ $linkName = $link['name'] ?? ''; +++ $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; +%%%%%%%%%%%%%%%%%%% diff from: vpwuyvyv f513921d "Fix: email clearing in findOrCreateAuthor, htmlspecialchars(null) crash in old(), dead contact_interne field, access_type_id radio clearing" (rebased revision) +\\\\\\\\\\\\\\\\\\\ to: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision) +- $linkName = $link['name'] ?? ''; +- $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; +%%%%%%%%%%%%%%%%%%% diff from: somsyvxz 14a3cd10 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebase destination) +\\\\\\\\\\\\\\\\\\\ to: pntwsqvs baf8b60c "Rename author_email→contact_interne, author_show_contact→contact_public across view/controllers/templates" (rebased revision) + $linkName = $link['name'] ?? ''; + $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; + $linkLockedYear = $link['locked_year'] ?? null; ++%%%%%%% diff from: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision) ++\\\\\\\ to: pntwsqvs dd95b4d3 "Rename author_email→contact_interne, author_show_contact→contact_public across view/controllers/templates" (rebased revision) +++ $linkName = $link['name'] ?? ''; ++ $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; ?>