fixed view and multi
This commit is contained in:
@@ -3,22 +3,31 @@ require_once("include/headscript.php");
|
||||
$db = DBHandlerSelect::getInstance();
|
||||
$pdo = $db->getConnection();
|
||||
|
||||
$programmati = json_decode($_POST["programmati"], true);
|
||||
$daProgrammare = json_decode($_POST["daProgrammare"], true);
|
||||
$programmati = json_decode($_POST["programmati"] ?? '[]', true);
|
||||
$daProgrammare = json_decode($_POST["daProgrammare"] ?? '[]', true);
|
||||
|
||||
$pdo->beginTransaction();
|
||||
|
||||
foreach ($programmati as $p) {
|
||||
$stmt = $pdo->prepare("UPDATE productiondata SET id_status=6, priority=? WHERE id=?");
|
||||
$stmt->execute([$p["priority"], $p["id"]]);
|
||||
if (empty($p['id'])) {
|
||||
continue;
|
||||
}
|
||||
$stmt = $pdo->prepare(
|
||||
"UPDATE productiondata SET id_status=6, priority=? WHERE id=?"
|
||||
);
|
||||
$stmt->execute([(int)$p["priority"], (int)$p["id"]]);
|
||||
}
|
||||
|
||||
foreach ($daProgrammare as $p) {
|
||||
$stmt = $pdo->prepare("UPDATE productiondata SET id_status=1, priority=? WHERE id=?");
|
||||
$stmt->execute([$p["priority"], $p["id"]]);
|
||||
if (empty($p['id'])) {
|
||||
continue;
|
||||
}
|
||||
$stmt = $pdo->prepare(
|
||||
"UPDATE productiondata SET id_status=1, priority=? WHERE id=?"
|
||||
);
|
||||
$stmt->execute([(int)$p["priority"], (int)$p["id"]]);
|
||||
}
|
||||
|
||||
|
||||
$pdo->commit();
|
||||
|
||||
echo json_encode(["success" => true]);
|
||||
|
||||
Reference in New Issue
Block a user