refactor: retire filtre courrier et lien Vision, prépare module licence Vision

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jules
2026-05-06 00:13:30 +02:00
parent 3f73421fd3
commit 01a0fea7cb
3 changed files with 84 additions and 27 deletions

View File

@@ -5,30 +5,14 @@ require_once __DIR__ . '/../includes/auth.php';
auth_check();
header('Content-Type: application/json');
// Filtre par compte si user non-admin avec compte associé
$accountFilter = current_account_id();
if ($accountFilter) {
$st = db()->prepare(
'SELECT sf.id, sf.title, sf.sender, sf.date_processing, a.username,
GROUP_CONCAT(f.id, ":", f.file_name, ":", f.path ORDER BY f.id SEPARATOR "|") as files
FROM source_file sf
LEFT JOIN accounts a ON sf.account_id = a.id
LEFT JOIN files f ON sf.id = f.source_file_id
WHERE sf.account_id = ?
GROUP BY sf.id ORDER BY sf.date_processing DESC'
);
$st->execute([$accountFilter]);
$rows = $st->fetchAll();
} else {
$rows = db()->query(
'SELECT sf.id, sf.title, sf.sender, sf.date_processing, a.username,
GROUP_CONCAT(f.id, ":", f.file_name, ":", f.path ORDER BY f.id SEPARATOR "|") as files
FROM source_file sf
LEFT JOIN accounts a ON sf.account_id = a.id
LEFT JOIN files f ON sf.id = f.source_file_id
GROUP BY sf.id ORDER BY sf.date_processing DESC'
)->fetchAll();
}
$rows = db()->query(
'SELECT sf.id, sf.title, sf.sender, sf.date_processing, a.username,
GROUP_CONCAT(f.id, ":", f.file_name, ":", f.path ORDER BY f.id SEPARATOR "|") as files
FROM source_file sf
LEFT JOIN accounts a ON sf.account_id = a.id
LEFT JOIN files f ON sf.id = f.source_file_id
GROUP BY sf.id ORDER BY sf.date_processing DESC'
)->fetchAll();
$toDelete = []; // source_file ids à supprimer