fixed bugs
This commit is contained in:
@@ -13,19 +13,22 @@ try {
|
||||
} catch (PDOException $e) {
|
||||
die("Connection failed: " . $e->getMessage());
|
||||
}
|
||||
|
||||
$method = $_POST['method'];
|
||||
if ($method == 'intervention') {
|
||||
$query = "SELECT * FROM temp_json_queue WHERE processed = 2";
|
||||
$stmt = $pdo->prepare($query);
|
||||
$stmt->execute();
|
||||
$jsonEntries = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
} else {
|
||||
// method validation
|
||||
if (!isset($_POST['method'])) {
|
||||
$query = "SELECT * FROM temp_json_queue WHERE processed = 0";
|
||||
$stmt = $pdo->prepare($query);
|
||||
$stmt->execute();
|
||||
$jsonEntries = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
else {
|
||||
$method = $_POST['method'];
|
||||
if($method == 'intervention'){
|
||||
$query = "SELECT * FROM temp_json_queue WHERE processed = 2";
|
||||
$stmt = $pdo->prepare($query);
|
||||
$stmt->execute();
|
||||
$jsonEntries = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($jsonEntries as $entry) {
|
||||
$data = json_decode($entry['json_data'], true);
|
||||
@@ -180,17 +183,21 @@ foreach ($jsonEntries as $entry) {
|
||||
}
|
||||
|
||||
markAsProcessed($entry['id'], $pdo);
|
||||
importHistory($pdo, $uuid);
|
||||
die(json_encode(['code' => 'success']));
|
||||
} else {
|
||||
markForIntervention($entry['id'], $pdo);
|
||||
importHistory($pdo, $uuid);
|
||||
die(json_encode(['code' => 'success', 'message' => 'Intervention']));
|
||||
}
|
||||
} else {
|
||||
markForIntervention($entry['id'], $pdo);
|
||||
importHistory($pdo, $uuid);
|
||||
die(json_encode(['code' => 'success', 'message' => 'Intervention']));
|
||||
}
|
||||
importHistory($pdo, $uuid);
|
||||
}
|
||||
|
||||
|
||||
die(json_encode(['code' => 'success']));
|
||||
|
||||
// Function definitions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user