API TO TEMP UPDATE

This commit is contained in:
2024-11-06 11:31:24 +01:00
parent ca405f4bd2
commit f9f9d45f08
13 changed files with 19 additions and 20 deletions
+10 -1
View File
@@ -11,6 +11,9 @@ if ($conn->connect_error) {
// Check if POST request was received
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Array to collect messages about file processing
$file_messages = [];
// Receive JSON from the laboratory via a field in the form (e.g., 'json_data')
if (isset($_POST['json_data'])) {
$json_data = $_POST['json_data'];
@@ -108,6 +111,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Handle file uploads if they exist
if (!empty($_FILES)) {
include('process_files.php'); // Include file processing logic here
// Retrieve any messages added in process_files.php for files
if (!empty($GLOBALS['file_messages'])) {
$file_messages = $GLOBALS['file_messages'];
}
}
// Set a session variable to notify the report import
@@ -124,7 +132,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
"product_refnumber" => $product_refnumber, // Product number
"report_number" => $report_number, // Report number
"rating" => $rating, // Report rating
"saved_at" => $saved_at // Save date
"saved_at" => $saved_at, // Save date
"file_messages" => $file_messages // Include file messages
]);
} else {
echo json_encode([