update sales list

This commit is contained in:
Flatlogic Bot 2026-05-03 10:34:24 +00:00
parent 80416b952b
commit 19ccad0890

View File

@ -1,5 +1,27 @@
<?php <?php
// Shared Sales/Purchases data loading extracted from index.php to reduce risk when editing this module. // Shared Sales/Purchases data loading extracted from index.php to reduce risk when editing this module.
$requestedLimit = isset($limit) ? (int)$limit : (isset($_GET['limit']) ? (int)$_GET['limit'] : 20);
if ($requestedLimit < 1) {
if (function_exists('runtime_debug_mark')) {
runtime_debug_mark('page:sales_purchases_limit_fallback', [
'page' => (string)($page ?? ''),
'requested_limit' => isset($_GET['limit']) ? (string)$_GET['limit'] : 'unset',
'applied_limit' => 20,
]);
}
if (function_exists('app_debug_file_log')) {
app_debug_file_log(
'runtime_debug.log',
date('Y-m-d H:i:s') . " [sales_purchases_limit_fallback] page=" . (string)($page ?? '')
. " requested_limit=" . (isset($_GET['limit']) ? (string)$_GET['limit'] : 'unset')
. " applied_limit=20"
);
}
}
$limit = min(500, max(5, $requestedLimit > 0 ? $requestedLimit : 20));
$page_num = isset($page_num) ? max(1, (int)$page_num) : (isset($_GET['p']) ? max(1, (int)$_GET['p']) : 1);
$offset = ($page_num - 1) * $limit;
$type = ($page === 'sales') ? 'sale' : 'purchase'; $type = ($page === 'sales') ? 'sale' : 'purchase';
$table = ($type === 'purchase') ? 'purchases' : 'invoices'; $table = ($type === 'purchase') ? 'purchases' : 'invoices';
$cust_supplier_col = ($type === 'purchase') ? 'supplier_id' : 'customer_id'; $cust_supplier_col = ($type === 'purchase') ? 'supplier_id' : 'customer_id';