mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 15:24:36 -04:00
Improve bank transaction filters
This commit is contained in:
parent
9d0ba8d30a
commit
3a376fddf6
@ -152,7 +152,22 @@ class BankTransactionFilters extends QueryFilters
|
|||||||
public function sort(string $sort) : Builder
|
public function sort(string $sort) : Builder
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
|
if(!is_array($sort_col))
|
||||||
|
return $this->builder;
|
||||||
|
|
||||||
|
if($sort_col[0] == 'deposit')
|
||||||
|
return $this->builder->where('base_type', 'CREDIT')->orderBy('amount', $sort_col[1]);
|
||||||
|
|
||||||
|
if($sort_col[0] == 'withdrawal')
|
||||||
|
return $this->builder->where('base_type', 'DEBIT')->orderBy('amount', $sort_col[1]);
|
||||||
|
|
||||||
|
if($sort_col[0] == 'status')
|
||||||
|
$sort_col[0] = 'status_id';
|
||||||
|
|
||||||
|
if(in_array($sort_col[0],['invoices','expense']))
|
||||||
|
return $this->builder;
|
||||||
|
|
||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user