fixed sostegno

This commit is contained in:
2026-10-23 20:25:14 +02:00
parent 98f4f004ed
commit 1c793384ff
+11 -10
View File
@@ -233,23 +233,22 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['ajax']) && $_POST['aj
$row_id = (int)($_POST['row_id'] ?? 0);
$idmescola = (int)($_POST['idmescola'] ?? 0);
$pos = 0; // auto-assign
if ($idmescola <= 0) {
echo json_encode(['success' => false, 'message' => 'Seleziona una mescola']);
exit;
}
if ($pos <= 0) $pos = 1;
$mix_weight = $_POST['mix_weight_g_m'] !== '' ? (float)$_POST['mix_weight_g_m'] : null;
$mix_weight = ($_POST['mix_weight_g_m'] ?? '') !== ''
? (float)str_replace(',', '.', $_POST['mix_weight_g_m'])
: null;
$support_weight = ($_POST['support_weight_g_m'] ?? '') !== ''
? (float)str_replace(',', '.', $_POST['support_weight_g_m'])
: null;
$density = trim($_POST['required_density'] ?? '');
$hardness = trim($_POST['required_hardness_shore_a'] ?? '');
$lub_type = ($_POST['lubrication_type'] ?? '') !== '' ? $_POST['lubrication_type'] : null;
$lub_note = trim($_POST['lubrication_notes'] ?? '');
$density = trim($_POST['required_density'] ?? '');
$hardness = trim($_POST['required_hardness_shore_a'] ?? '');
$lub_type = ($_POST['lubrication_type'] ?? '') !== '' ? $_POST['lubrication_type'] : null;
$lub_note = trim($_POST['lubrication_notes'] ?? '');
$pdo->beginTransaction();
@@ -267,6 +266,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['ajax']) && $_POST['aj
");
$stmt->execute([
$idmescola,
$mix_weight,
$support_weight,
$density !== '' ? $density : null,
$hardness !== '' ? $hardness : null,
$lub_type,
@@ -293,8 +294,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['ajax']) && $_POST['aj
$stmt = $pdo->prepare("
INSERT INTO work_sheet_mescole
(
worksheet_id, idmescola, mix_position, mix_weight_g_m,
support_weight_g_m,
worksheet_id, idmescola, mix_position,
mix_weight_g_m, support_weight_g_m,
required_density, required_hardness_shore_a,
lubrication_type, lubrication_notes
)