Fixes for quote queries
This commit is contained in:
parent
0c86e828a4
commit
45fac70557
1 changed files with 12 additions and 13 deletions
|
|
@ -66,17 +66,8 @@ class QuoteFilters extends QueryFilters
|
|||
return $this->builder;
|
||||
}
|
||||
|
||||
$quote_filters = [];
|
||||
|
||||
$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)) {
|
||||
$query->orWhere(function ($q){
|
||||
$q->where('status_id', Quote::STATUS_SENT)
|
||||
|
|
@ -84,13 +75,21 @@ class QuoteFilters extends QueryFilters
|
|||
->orWhere('due_date', '>=', now()->toDateString());
|
||||
});
|
||||
}
|
||||
|
||||
$quote_filters = [];
|
||||
|
||||
if (in_array('approved', $status_parameters)) {
|
||||
$query->orWhere(function ($q){
|
||||
$q->where('status_id', Quote::STATUS_APPROVED)->company();
|
||||
});
|
||||
if (in_array('draft', $status_parameters)) {
|
||||
$quote_filters[] = Quote::STATUS_DRAFT;
|
||||
}
|
||||
|
||||
|
||||
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)) {
|
||||
$query->orWhere(function ($q){
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue