Add thesis status column for two-phase commit lifecycle tracking

This commit is contained in:
Pontoporeia
2026-06-11 12:09:43 +02:00
parent 11a6f6a9f2
commit f4a3e26901
5 changed files with 47 additions and 7 deletions
+18 -2
View File
@@ -1682,6 +1682,22 @@ class Database
Audit::log($this, Audit::actor(), 'UPDATE', 'theses', $thesisId, $old, $new);
}
/**
* Set the submission lifecycle status of a single thesis.
*
* Valid statuses: 'draft' (files not yet moved / failed) → 'active' (complete).
*/
public function setThesisStatus(int $thesisId, string $status): void
{
require_once __DIR__ . '/Audit.php';
$old = $this->fetchRow('theses', $thesisId);
$this->pdo->prepare(
'UPDATE theses SET status = ?, updated_at = CURRENT_TIMESTAMP WHERE id = ?'
)->execute([$status, $thesisId]);
$new = $this->fetchRow('theses', $thesisId);
Audit::log($this, Audit::actor(), 'UPDATE', 'theses', $thesisId, $old, $new);
}
/**
* Set the published state for multiple theses at once.
* @param int[] $thesisIds
@@ -2242,12 +2258,12 @@ class Database
baiu_link, license_id, license_custom,
access_type_id,
objet,
is_published,
is_published, status,
remarks, jury_points,
exemplaire_baiu, exemplaire_erg,
cc2r,
submitted_at
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP)
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, "draft", ?, ?, ?, ?, ?, CURRENT_TIMESTAMP)
');
$validObjet = ['tfe', 'thèse', 'frart'];