From fe06e618d4f2ceaa37bf067e3ea6508935f13cec Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Sun, 3 May 2026 08:21:48 +0000 Subject: [PATCH] update --- index.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/index.php b/index.php index bdf4f44..b1d23af 100644 --- a/index.php +++ b/index.php @@ -172,6 +172,19 @@ if (!function_exists('db_first_existing_column')) { } } +if (!function_exists('ensure_payment_methods_schema_ready')) { + function ensure_payment_methods_schema_ready(): void { + static $loaded = false; + + if ($loaded) { + return; + } + + require_once __DIR__ . '/db/migrations/20260502_zzz_payment_methods_schema_sync.php'; + $loaded = true; + } +} + if (!function_exists('entity_tax_column')) { function entity_tax_column(string $tableName): ?string { return db_first_existing_column($tableName, ['tax_id', 'tax_number', 'vat_number', 'tax_no', 'vat_no', 'trn']); @@ -2585,6 +2598,7 @@ function getPromotionalPrice($item) { } if (isset($_POST['add_payment_method'])) { + ensure_payment_methods_schema_ready(); $name_en = trim((string)($_POST['name_en'] ?? '')); $name_ar = trim((string)($_POST['name_ar'] ?? '')); @@ -2626,6 +2640,7 @@ function getPromotionalPrice($item) { } if (isset($_POST['edit_payment_method'])) { + ensure_payment_methods_schema_ready(); $id = (int)($_POST['id'] ?? 0); $name_en = trim((string)($_POST['name_en'] ?? '')); $name_ar = trim((string)($_POST['name_ar'] ?? '')); @@ -2669,6 +2684,7 @@ function getPromotionalPrice($item) { } if (isset($_POST['delete_payment_method'])) { + ensure_payment_methods_schema_ready(); $id = (int)($_POST['id'] ?? 0); if ($id > 0) { db()->prepare("DELETE FROM payment_methods WHERE id = ?")->execute([$id]); @@ -4187,6 +4203,7 @@ switch ($page) { $data['lpos'] = $stmt->fetchAll(); break; case 'payment_methods': + ensure_payment_methods_schema_ready(); $data['payment_methods'] = db()->query("SELECT * FROM payment_methods ORDER BY id DESC")->fetchAll(); break; case 'outlets':