fixed import fogli di lavoro and disegni tecnici

This commit is contained in:
2026-10-02 11:24:51 +02:00
parent 63674ea6be
commit c2212f7022
11 changed files with 802 additions and 87 deletions
@@ -0,0 +1,29 @@
<?php
ob_start();
include('include/headscript.php');
$db = DBHandlerSelect::getInstance();
$pdo = $db->getConnection();
function jsonOut($success, $message = '')
{
if (ob_get_length()) ob_clean();
header('Content-Type: application/json; charset=utf-8');
echo json_encode(['success' => $success, 'message' => $message]);
exit;
}
$id = (int)($_POST['id'] ?? 0);
$value = ($_POST['is_disegno'] ?? '0') === '1' ? 1 : 0;
if ($id <= 0) {
jsonOut(false, 'ID allegato non valido');
}
try {
$st = $pdo->prepare("UPDATE matrice_attachments SET is_disegno = ? WHERE id = ?");
$st->execute([$value, $id]);
jsonOut(true, $value ? 'Segnato come disegno tecnico' : 'Rimosso dai disegni tecnici');
} catch (Throwable $e) {
jsonOut(false, 'Errore: ' . $e->getMessage());
}