update
This commit is contained in:
parent
013232adaa
commit
fe06e618d4
17
index.php
17
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':
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user