formulaire: correctifs identifiant/année, contact, fichiers optionnels

- Identifiant: mise à jour automatique quand l'année change en back-office (updateThesis + ThesisEditController)
- Contact: hint enrichi (1 seul contact, formatage Instagram/Mastodon)
- Fichiers: TFE rendu optionnel pour Site web/Performance/Installation (note d'intention reste obligatoire)
This commit is contained in:
Pontoporeia
2026-06-08 18:05:43 +02:00
parent c4664ec2e9
commit 3d524226a1
11 changed files with 107 additions and 44 deletions

View File

@@ -217,6 +217,16 @@ class ThesisEditController
'cc2r' => !empty($post['cc2r']),
'license_custom' => trim($post['license_custom'] ?? ''),
];
// Regenerate identifier if year changed
$oldThesis = $this->db->getThesis($thesisId);
$oldYear = (int)($oldThesis['year'] ?? 0);
$newYear = $meta['year'];
if ($newYear !== $oldYear && $newYear >= 2000) {
$newIdentifier = $this->db->generateThesisIdentifier($newYear);
$meta['identifier'] = $newIdentifier;
error_log('[ThesisEdit] Year changed ' . $oldYear . ' → ' . $newYear . ', new identifier: ' . $newIdentifier);
}
$this->db->updateThesis($thesisId, $meta);
error_log('[ThesisEdit] Step 1 OK — thesis_id=' . $thesisId);

View File

@@ -2122,8 +2122,16 @@ class Database
$this->fetchRow('theses', $thesisId)
);
$stmt = $this->pdo->prepare('
$identifierCol = '';
$params = [];
if (array_key_exists('identifier', $data)) {
$identifierCol = 'identifier = ?,';
$params[] = $data['identifier'];
}
$stmt = $this->pdo->prepare("
UPDATE theses SET
$identifierCol
title = ?,
subtitle = ?,
year = ?,
@@ -2144,7 +2152,7 @@ class Database
cc2r = ?,
updated_at = CURRENT_TIMESTAMP
WHERE id = ?
');
");
$orientation = ($data['orientation_id'] ?? null) ? (int)$data['orientation_id'] : null;
$ap = ($data['ap_program_id'] ?? null) ? (int)$data['ap_program_id'] : null;
$finality = ($data['finality_id'] ?? null) ? (int)$data['finality_id'] : null;
@@ -2153,7 +2161,7 @@ class Database
error_log("[DB:updateThesis] thesis_id=$thesisId orientation=$orientation ap=$ap finality=$finality license=$license access=$access");
$stmt->execute([
$params = array_merge($params, [
$data['title'],
!empty($data['subtitle']) ? $data['subtitle'] : null,
(int)$data['year'],
@@ -2174,6 +2182,7 @@ class Database
!empty($data['cc2r']) ? 1 : 0,
$thesisId,
]);
$stmt->execute($params);
}
/**

View File

@@ -52,19 +52,19 @@ class FilepondHandler
];
public const QUEUE_SIZE_LIMITS = [
'cover' => 20 * 1024 * 1024, // 20 MB
'note_intention' => 100 * 1024 * 1024, // 100 MB
'tfe' => 500 * 1024 * 1024, // 500 MB
'video' => 500 * 1024 * 1024, // 500 MB
'audio' => 500 * 1024 * 1024, // 500 MB
'annexe' => 500 * 1024 * 1024, // 500 MB
'peertube_video' => 500 * 1024 * 1024, // 500 MB
'peertube_audio' => 500 * 1024 * 1024, // 500 MB
'cover' => 20 * 1024 * 1024, // 20 MB
'note_intention' => 100 * 1024 * 1024, // 100 MB
'tfe' => 1024 * 1024 * 1024, // 1 GB (default for non-AV, non-PDF)
'video' => 8 * 1024 * 1024 * 1024, // 8 GB
'audio' => 8 * 1024 * 1024 * 1024, // 8 GB
'annexe' => 1024 * 1024 * 1024, // 1 GB
'peertube_video' => 8 * 1024 * 1024 * 1024, // 8 GB
'peertube_audio' => 8 * 1024 * 1024 * 1024, // 8 GB
];
public const AV_EXTENSIONS = ['mp4', 'webm', 'ogv', 'mov', 'mp3', 'ogg', 'oga', 'wav', 'flac', 'aac', 'm4a'];
public const MAX_PDF_SIZE = 100 * 1024 * 1024; // 100 MB
public const MAX_AV_SIZE = 2 * 1024 * 1024 * 1024; // 2 GB
public const MAX_PDF_SIZE = 100 * 1024 * 1024; // 100 MB
public const MAX_AV_SIZE = 8 * 1024 * 1024 * 1024; // 8 GB
// ── Log prefix for distinguishing admin vs partage ───────────────────────