fixed bugs
This commit is contained in:
parent
1325bf8b24
commit
994884d3c9
@ -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);
|
||||
} else {
|
||||
markForIntervention($entry['id'], $pdo);
|
||||
}
|
||||
} else {
|
||||
markForIntervention($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']));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
die(json_encode(['code' => 'success']));
|
||||
|
||||
// Function definitions
|
||||
|
||||
|
||||
@ -131,6 +131,14 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function refresh_table(){
|
||||
// location reload in 2 seconds
|
||||
setTimeout(function(){
|
||||
location.reload();
|
||||
}, 2000);
|
||||
|
||||
}
|
||||
|
||||
function handleImport(id) {
|
||||
formdata = new FormData();
|
||||
formdata.append('id', id);
|
||||
@ -171,7 +179,7 @@
|
||||
showWarningPopup("Excel data format is not valid!")
|
||||
} else {
|
||||
$('#f_csv').val("");
|
||||
showWarningAlert("Server eeee.")
|
||||
showWarningAlert("Server Error.")
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -197,7 +205,7 @@
|
||||
$('#ajax_preloader').fadeOut();
|
||||
if (data.code == "success") {
|
||||
showSuccessAlert("Successfully imported!");
|
||||
window.location.reload();
|
||||
refresh_table();
|
||||
} else {
|
||||
showWarningAlert("Server Error.")
|
||||
}
|
||||
@ -326,7 +334,7 @@
|
||||
|
||||
let str_arr_option = '';
|
||||
for (let i = 0; i < arr_similary.length; i++) {
|
||||
str_arr_option += '<option value="' + arr_similary[i]['refid'] + '">' + arr_similary[i]['namecompoundsvocabulary'] + '</option>';
|
||||
str_arr_option += '<option value="' + arr_similary[i]['idcompoundsvocabulary'] + '">' + arr_similary[i]['namecompoundsvocabulary'] + '</option>';
|
||||
}
|
||||
str_arr_option += tmp_str_arr_compunds_kind_option;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user