Fix expired list widget
This commit is contained in:
parent
66d67cb61d
commit
009040cd3c
@ -7,13 +7,13 @@ class customer_expired
|
|||||||
|
|
||||||
public function getWidget()
|
public function getWidget()
|
||||||
{
|
{
|
||||||
global $ui, $current_date;
|
global $ui, $current_date, $config;
|
||||||
|
|
||||||
//user expire
|
//user expire
|
||||||
$query = ORM::for_table('tbl_user_recharges')
|
$query = ORM::for_table('tbl_user_recharges')
|
||||||
->table_alias('tur')
|
->table_alias('tur')
|
||||||
->selects([
|
->selects([
|
||||||
'tur.id',
|
'c.id',
|
||||||
'tur.username',
|
'tur.username',
|
||||||
'c.fullname',
|
'c.fullname',
|
||||||
'c.phonenumber',
|
'c.phonenumber',
|
||||||
@ -25,7 +25,7 @@ class customer_expired
|
|||||||
'tur.namebp',
|
'tur.namebp',
|
||||||
'tur.routers'
|
'tur.routers'
|
||||||
])
|
])
|
||||||
->join('tbl_customers', ['tur.customer_id', '=', 'c.id'], 'c')
|
->innerJoin('tbl_customers', ['tur.customer_id', '=', 'c.id'], 'c')
|
||||||
->where_lte('expiration', $current_date)
|
->where_lte('expiration', $current_date)
|
||||||
->order_by_desc('expiration');
|
->order_by_desc('expiration');
|
||||||
$expire = Paginator::findMany($query);
|
$expire = Paginator::findMany($query);
|
||||||
@ -38,6 +38,23 @@ class customer_expired
|
|||||||
// Pass the total count and current page to the paginator
|
// Pass the total count and current page to the paginator
|
||||||
$paginator['total_count'] = $totalCount;
|
$paginator['total_count'] = $totalCount;
|
||||||
|
|
||||||
|
if(!empty($_COOKIE['expdef']) && $_COOKIE['expdef'] != $config['customer_expired_expdef']) {
|
||||||
|
$d = ORM::for_table('tbl_appconfig')->where('setting', 'customer_expired_expdef')->find_one();
|
||||||
|
if ($d) {
|
||||||
|
$d->value = $_COOKIE['expdef'];
|
||||||
|
$d->save();
|
||||||
|
} else {
|
||||||
|
$d = ORM::for_table('tbl_appconfig')->create();
|
||||||
|
$d->setting = 'customer_expired_expdef';
|
||||||
|
$d->value = $_COOKIE['expdef'];
|
||||||
|
$d->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!empty($config['customer_expired_expdef']) && empty($_COOKIE['expdef'])){
|
||||||
|
$_COOKIE['expdef'] = $config['customer_expired_expdef'];
|
||||||
|
setcookie('expdef', $config['customer_expired_expdef'], time() + (86400 * 30), "/");
|
||||||
|
}
|
||||||
|
|
||||||
// Assign the pagination HTML to the template variable
|
// Assign the pagination HTML to the template variable
|
||||||
$ui->assign('expire', $expire);
|
$ui->assign('expire', $expire);
|
||||||
$ui->assign('cookie', $_COOKIE);
|
$ui->assign('cookie', $_COOKIE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user