mirror of
https://github.com/hotspotbilling/phpnuxbill.git
synced 2025-08-02 01:05:13 +02:00
feat: implement per-page entry selection for customer management with cookie support
This commit is contained in:
parent
944b4c82cb
commit
425e3a4401
2 changed files with 70 additions and 1 deletions
|
@ -904,7 +904,29 @@ switch ($action) {
|
|||
fclose($fp);
|
||||
die();
|
||||
}
|
||||
$d = Paginator::findMany($query, ['search' => $search], 30, $append_url);
|
||||
|
||||
if (!empty($_COOKIE['customer_per_page']) && $_COOKIE['customer_per_page'] != $config['customer_per_page']) {
|
||||
$d = ORM::for_table('tbl_appconfig')->where('setting', 'customer_per_page')->find_one();
|
||||
if ($d) {
|
||||
$d->value = $_COOKIE['customer_per_page'];
|
||||
$d->save();
|
||||
} else {
|
||||
$d = ORM::for_table('tbl_appconfig')->create();
|
||||
$d->setting = 'customer_per_page';
|
||||
$d->value = $_COOKIE['customer_per_page'];
|
||||
$d->save();
|
||||
}
|
||||
}
|
||||
if (!empty($config['customer_per_page']) && empty($_COOKIE['customer_per_page'])) {
|
||||
$_COOKIE['customer_per_page'] = $config['customer_per_page'];
|
||||
setcookie('customer_per_page', $config['customer_per_page'], time() + (86400 * 30), "/");
|
||||
}
|
||||
|
||||
$ui->assign('cookie', $_COOKIE['customer_per_page']);
|
||||
|
||||
$per_page = !empty($_COOKIE['customer_per_page']) ? $_COOKIE['customer_per_page'] : (!empty($config['customer_per_page']) ? $config['customer_per_page'] : '30');
|
||||
|
||||
$d = Paginator::findMany($query, ['search' => $search], $per_page, $append_url);
|
||||
$ui->assign('d', $d);
|
||||
$ui->assign('statuses', ORM::for_table('tbl_customers')->getEnum("status"));
|
||||
$ui->assign('filter', $filter);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue