mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Improve filtering of Lists by clients
This commit is contained in:
parent
08f86419b4
commit
327c782ba5
@ -115,6 +115,11 @@ class CreditFilters extends QueryFilters
|
||||
return $this->builder;
|
||||
}
|
||||
|
||||
if ($sort_col[0] == 'client_id') {
|
||||
return $this->builder->orderBy(\App\Models\Client::select('name')
|
||||
->whereColumn('clients.id', 'credits.client_id'), $sort_col[1]);
|
||||
}
|
||||
|
||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||
}
|
||||
|
||||
|
@ -11,12 +11,14 @@
|
||||
|
||||
namespace App\Filters;
|
||||
|
||||
use RuntimeException;
|
||||
use App\Models\Client;
|
||||
use App\Models\Invoice;
|
||||
use App\Filters\QueryFilters;
|
||||
use InvalidArgumentException;
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Carbon;
|
||||
use InvalidArgumentException;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* InvoiceFilters.
|
||||
@ -205,10 +207,9 @@ class InvoiceFilters extends QueryFilters
|
||||
}
|
||||
|
||||
if ($sort_col[0] == 'client_id') {
|
||||
|
||||
$this->builder->with(['client' => function($q) use($sort_col){
|
||||
$q->orderBy('name', $sort_col[1]);
|
||||
}]);
|
||||
|
||||
return $this->builder->orderBy(\App\Models\Client::select('name')
|
||||
->whereColumn('clients.id', 'invoices.client_id'), $sort_col[1]);
|
||||
|
||||
}
|
||||
|
||||
|
@ -158,6 +158,13 @@ class PaymentFilters extends QueryFilters
|
||||
return $this->builder;
|
||||
}
|
||||
|
||||
|
||||
if ($sort_col[0] == 'client_id') {
|
||||
return $this->builder->orderBy(\App\Models\Client::select('name')
|
||||
->whereColumn('clients.id', 'payments.client_id'), $sort_col[1]);
|
||||
}
|
||||
|
||||
|
||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||
}
|
||||
|
||||
|
@ -135,6 +135,13 @@ class QuoteFilters extends QueryFilters
|
||||
return $this->builder;
|
||||
}
|
||||
|
||||
if($sort_col[0] == 'client_id'){
|
||||
|
||||
return $this->builder->orderBy(\App\Models\Client::select('name')
|
||||
->whereColumn('clients.id', 'quotes.client_id'), $sort_col[1]);
|
||||
|
||||
}
|
||||
|
||||
if ($sort_col[0] == 'valid_until') {
|
||||
$sort_col[0] = 'due_date';
|
||||
}
|
||||
|
@ -115,6 +115,13 @@ class RecurringInvoiceFilters extends QueryFilters
|
||||
return $this->builder;
|
||||
}
|
||||
|
||||
|
||||
if ($sort_col[0] == 'client_id') {
|
||||
return $this->builder->orderBy(\App\Models\Client::select('name')
|
||||
->whereColumn('clients.id', 'recurring_invoices.client_id'), $sort_col[1]);
|
||||
}
|
||||
|
||||
|
||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||
}
|
||||
|
||||
|
@ -110,6 +110,13 @@ class TaskFilters extends QueryFilters
|
||||
return $this->builder;
|
||||
}
|
||||
|
||||
|
||||
if ($sort_col[0] == 'client_id') {
|
||||
return $this->builder->orderBy(\App\Models\Client::select('name')
|
||||
->whereColumn('clients.id', 'tasks.client_id'), $sort_col[1]);
|
||||
}
|
||||
|
||||
|
||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||
}
|
||||
|
||||
|
@ -146,6 +146,8 @@ class UpdateTaxData implements ShouldQueue
|
||||
public function failed($exception)
|
||||
{
|
||||
nlog("UpdateTaxData failed => ".$exception->getMessage());
|
||||
config(['queue.failed.driver' => null]);
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user