mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
Rename author_email→contact_interne, author_show_contact→contact_public across view/controllers/templates
- v_theses_full: author_email→contact_interne, author_show_contact→contact_public - Updated schema.sql and live DB view - Renamed all PHP variables: currentAuthorEmail→contactInterne, currentAuthorShowContact→contactPublic - Restored contact_interne backoffice field with proper wiring (takes precedence over mail field) - Updated admin/add.php, admin/edit.php, partage/index.php, public/tfe.php templates
This commit is contained in:
@@ -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)) {
|
||||
|
||||
@@ -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,
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user