39 lines
803 B
PHP
39 lines
803 B
PHP
<?php
|
|
include('../../include/headscript.php');
|
|
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
|
|
try {
|
|
$pdo = DBHandlerSelect::getInstance()->getConnection();
|
|
|
|
$id = (int)($_POST['id'] ?? 0);
|
|
|
|
if ($id <= 0) {
|
|
echo json_encode([
|
|
'success' => false,
|
|
'message' => 'ID DPI non valido.'
|
|
]);
|
|
exit;
|
|
}
|
|
|
|
$stmt = $pdo->prepare("
|
|
UPDATE employee_ppe_items
|
|
SET status = 'returned',
|
|
updated_at = NOW()
|
|
WHERE id = ?
|
|
");
|
|
$stmt->execute([$id]);
|
|
|
|
echo json_encode([
|
|
'success' => true,
|
|
'message' => 'DPI rimosso correttamente.'
|
|
]);
|
|
exit;
|
|
} catch (Throwable $e) {
|
|
echo json_encode([
|
|
'success' => false,
|
|
'message' => $e->getMessage()
|
|
]);
|
|
exit;
|
|
}
|