fix 4
This commit is contained in:
parent
4268e51b35
commit
bd73e23131
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', '1');
|
||||
declare(strict_types=1);
|
||||
require_once __DIR__ . '/../db/config.php';
|
||||
require_once __DIR__ . '/../includes/functions.php';
|
||||
@ -420,4 +422,4 @@ include 'includes/header.php';
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include 'includes/footer.php'; ?>
|
||||
<?php include 'includes/footer.php'; ?>
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', '1');
|
||||
require_once __DIR__ . '/../db/config.php';
|
||||
require_once __DIR__ . "/../includes/functions.php";
|
||||
require_permission("tables_view");
|
||||
@ -270,7 +272,8 @@ function showTableQR(id, number) {
|
||||
const qrContainer = document.getElementById('qrcode');
|
||||
qrContainer.innerHTML = '';
|
||||
|
||||
const url = baseUrl + '/qorder.php?table=' + id;
|
||||
// Fixed: using table_id as parameter name to match qorder.php expectation
|
||||
const url = baseUrl + '/qorder.php?table_id=' + id;
|
||||
|
||||
qrGenerator = new QRCode(qrContainer, {
|
||||
text: url,
|
||||
@ -310,4 +313,4 @@ function printQR() {
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php include 'includes/footer.php'; ?>
|
||||
<?php include 'includes/footer.php'; ?>
|
||||
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', '1');
|
||||
header('Content-Type: application/json');
|
||||
require_once __DIR__ . '/../db/config.php';
|
||||
require_once __DIR__ . '/../includes/functions.php';
|
||||
@ -417,4 +419,4 @@ You've earned *{points_earned} points* with this order.
|
||||
if ($pdo->inTransaction()) $pdo->rollBack();
|
||||
error_log("Order Error: " . $e->getMessage());
|
||||
echo json_encode(['success' => false, 'error' => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', '1');
|
||||
header('Content-Type: application/json');
|
||||
require_once __DIR__ . '/../db/config.php';
|
||||
|
||||
|
||||
33
qorder.php
33
qorder.php
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', '1');
|
||||
declare(strict_types=1);
|
||||
require_once __DIR__ . '/db/config.php';
|
||||
require_once __DIR__ . '/includes/functions.php';
|
||||
@ -6,25 +8,30 @@ require_once __DIR__ . '/includes/functions.php';
|
||||
$pdo = db();
|
||||
$settings = get_company_settings();
|
||||
|
||||
$table_id = isset($_GET['table_id']) ? (int)$_GET['table_id'] : 0;
|
||||
// Support both 'table_id' and 'table' for backward compatibility or different implementations
|
||||
$table_id = isset($_GET['table_id']) ? (int)$_GET['table_id'] : (isset($_GET['table']) ? (int)$_GET['table'] : 0);
|
||||
|
||||
if ($table_id <= 0) {
|
||||
die("Invalid table ID. Please scan the QR code on your table.");
|
||||
die("Invalid table ID ($table_id). Please scan the QR code on your table.");
|
||||
}
|
||||
|
||||
// Fetch table and outlet info
|
||||
$stmt = $pdo->prepare("
|
||||
SELECT t.id, t.table_number as table_name, a.outlet_id, o.name as outlet_name
|
||||
FROM tables t
|
||||
JOIN areas a ON t.area_id = a.id
|
||||
JOIN outlets o ON a.outlet_id = o.id
|
||||
WHERE t.id = ?
|
||||
");
|
||||
$stmt->execute([$table_id]);
|
||||
$table_info = $stmt->fetch();
|
||||
try {
|
||||
$stmt = $pdo->prepare("
|
||||
SELECT t.id, t.table_number as table_name, a.outlet_id, o.name as outlet_name
|
||||
FROM tables t
|
||||
JOIN areas a ON t.area_id = a.id
|
||||
JOIN outlets o ON a.outlet_id = o.id
|
||||
WHERE t.id = ?
|
||||
");
|
||||
$stmt->execute([$table_id]);
|
||||
$table_info = $stmt->fetch();
|
||||
|
||||
if (!$table_info) {
|
||||
die("Table not found. Please contact staff.");
|
||||
if (!$table_info) {
|
||||
die("Table with ID $table_id not found. Please contact staff.");
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
die("Database error: " . $e->getMessage());
|
||||
}
|
||||
|
||||
$outlet_id = (int)$table_info['outlet_id'];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user