This commit is contained in:
Flatlogic Bot 2026-02-27 02:55:44 +00:00
parent 4268e51b35
commit bd73e23131
5 changed files with 33 additions and 17 deletions

View File

@ -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';

View File

@ -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,

View File

@ -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';

View File

@ -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';

View File

@ -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,13 +8,15 @@ 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
try {
$stmt = $pdo->prepare("
SELECT t.id, t.table_number as table_name, a.outlet_id, o.name as outlet_name
FROM tables t
@ -24,7 +28,10 @@ $stmt->execute([$table_id]);
$table_info = $stmt->fetch();
if (!$table_info) {
die("Table not found. Please contact staff.");
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'];