fix 4
This commit is contained in:
parent
4268e51b35
commit
bd73e23131
@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
ini_set('display_errors', '1');
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
require_once __DIR__ . '/../db/config.php';
|
require_once __DIR__ . '/../db/config.php';
|
||||||
require_once __DIR__ . '/../includes/functions.php';
|
require_once __DIR__ . '/../includes/functions.php';
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
ini_set('display_errors', '1');
|
||||||
require_once __DIR__ . '/../db/config.php';
|
require_once __DIR__ . '/../db/config.php';
|
||||||
require_once __DIR__ . "/../includes/functions.php";
|
require_once __DIR__ . "/../includes/functions.php";
|
||||||
require_permission("tables_view");
|
require_permission("tables_view");
|
||||||
@ -270,7 +272,8 @@ function showTableQR(id, number) {
|
|||||||
const qrContainer = document.getElementById('qrcode');
|
const qrContainer = document.getElementById('qrcode');
|
||||||
qrContainer.innerHTML = '';
|
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, {
|
qrGenerator = new QRCode(qrContainer, {
|
||||||
text: url,
|
text: url,
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
ini_set('display_errors', '1');
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
require_once __DIR__ . '/../db/config.php';
|
require_once __DIR__ . '/../db/config.php';
|
||||||
require_once __DIR__ . '/../includes/functions.php';
|
require_once __DIR__ . '/../includes/functions.php';
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
ini_set('display_errors', '1');
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
require_once __DIR__ . '/../db/config.php';
|
require_once __DIR__ . '/../db/config.php';
|
||||||
|
|
||||||
|
|||||||
23
qorder.php
23
qorder.php
@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
ini_set('display_errors', '1');
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
require_once __DIR__ . '/db/config.php';
|
require_once __DIR__ . '/db/config.php';
|
||||||
require_once __DIR__ . '/includes/functions.php';
|
require_once __DIR__ . '/includes/functions.php';
|
||||||
@ -6,25 +8,30 @@ require_once __DIR__ . '/includes/functions.php';
|
|||||||
$pdo = db();
|
$pdo = db();
|
||||||
$settings = get_company_settings();
|
$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) {
|
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
|
// Fetch table and outlet info
|
||||||
$stmt = $pdo->prepare("
|
try {
|
||||||
|
$stmt = $pdo->prepare("
|
||||||
SELECT t.id, t.table_number as table_name, a.outlet_id, o.name as outlet_name
|
SELECT t.id, t.table_number as table_name, a.outlet_id, o.name as outlet_name
|
||||||
FROM tables t
|
FROM tables t
|
||||||
JOIN areas a ON t.area_id = a.id
|
JOIN areas a ON t.area_id = a.id
|
||||||
JOIN outlets o ON a.outlet_id = o.id
|
JOIN outlets o ON a.outlet_id = o.id
|
||||||
WHERE t.id = ?
|
WHERE t.id = ?
|
||||||
");
|
");
|
||||||
$stmt->execute([$table_id]);
|
$stmt->execute([$table_id]);
|
||||||
$table_info = $stmt->fetch();
|
$table_info = $stmt->fetch();
|
||||||
|
|
||||||
if (!$table_info) {
|
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'];
|
$outlet_id = (int)$table_info['outlet_id'];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user