38471-vm/patch_payment.php
2026-02-26 05:15:35 +00:00

24 lines
1.2 KiB
PHP

<?php
$content = file_get_contents('index.php');
$search = <<<'SQL'
$stmt = db()->prepare("SELECT p.*, i.customer_id, c.name as customer_name,
o.name as outlet_name, o.address as outlet_address, o.phone as outlet_phone
FROM payments p
JOIN invoices i ON p.invoice_id = i.id
LEFT JOIN customers c ON i.customer_id = c.id
LEFT JOIN outlets o ON i.outlet_id = o.id
WHERE p.id = ?");
SQL;
$replace = <<<'SQL'
$stmt = db()->prepare("SELECT p.*, i.customer_id, i.id as inv_id, c.name as customer_name,
o.name as outlet_name, o.address as outlet_address, o.phone as outlet_phone
FROM payments p
JOIN invoices i ON p.invoice_id = i.id
LEFT JOIN customers c ON i.customer_id = c.id
LEFT JOIN outlets o ON i.outlet_id = o.id
WHERE p.id = ?");
SQL;
$content = str_replace($search, $replace, $content);
file_put_contents('index.php', $content);