mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for quote queries
This commit is contained in:
parent
0c86e828a4
commit
45fac70557
@ -66,17 +66,8 @@ class QuoteFilters extends QueryFilters
|
|||||||
return $this->builder;
|
return $this->builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
$quote_filters = [];
|
|
||||||
|
|
||||||
$this->builder->where(function ($query) use ($status_parameters){
|
$this->builder->where(function ($query) use ($status_parameters){
|
||||||
|
|
||||||
if (in_array('draft', $status_parameters)) {
|
|
||||||
$query->orWhere(function ($q){
|
|
||||||
$q->where('status_id', Quote::STATUS_DRAFT);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (in_array('sent', $status_parameters)) {
|
if (in_array('sent', $status_parameters)) {
|
||||||
$query->orWhere(function ($q){
|
$query->orWhere(function ($q){
|
||||||
$q->where('status_id', Quote::STATUS_SENT)
|
$q->where('status_id', Quote::STATUS_SENT)
|
||||||
@ -84,13 +75,21 @@ class QuoteFilters extends QueryFilters
|
|||||||
->orWhere('due_date', '>=', now()->toDateString());
|
->orWhere('due_date', '>=', now()->toDateString());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$quote_filters = [];
|
||||||
|
|
||||||
if (in_array('approved', $status_parameters)) {
|
if (in_array('draft', $status_parameters)) {
|
||||||
$query->orWhere(function ($q){
|
$quote_filters[] = Quote::STATUS_DRAFT;
|
||||||
$q->where('status_id', Quote::STATUS_APPROVED)->company();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (in_array('approved', $status_parameters)) {
|
||||||
|
$quote_filters[] = Quote::STATUS_APPROVED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(count($quote_filters) >0){
|
||||||
|
$query->orWhereIn('status_id', $quote_filters);
|
||||||
|
}
|
||||||
|
|
||||||
if (in_array('expired', $status_parameters)) {
|
if (in_array('expired', $status_parameters)) {
|
||||||
$query->orWhere(function ($q){
|
$query->orWhere(function ($q){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user