mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 09:54:34 -04:00
Update filters
This commit is contained in:
parent
c7362aefef
commit
6db1dae3b0
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace App\Filters;
|
namespace App\Filters;
|
||||||
|
|
||||||
|
use App\Models\Quote;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
|
||||||
@ -41,6 +42,51 @@ class QuoteFilters extends QueryFilters
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter based on client status.
|
||||||
|
*
|
||||||
|
* Statuses we need to handle
|
||||||
|
* - all
|
||||||
|
* - active
|
||||||
|
* - paused
|
||||||
|
* - completed
|
||||||
|
*
|
||||||
|
* @param string client_status The invoice status as seen by the client
|
||||||
|
* @return Builder
|
||||||
|
*/
|
||||||
|
public function client_status(string $value = '') :Builder
|
||||||
|
{
|
||||||
|
if (strlen($value) == 0) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
$status_parameters = explode(',', $value);
|
||||||
|
|
||||||
|
if (in_array('all', $status_parameters)) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('draft', $status_parameters)) {
|
||||||
|
$this->builder->where('status_id', Quote::STATUS_DRAFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('sent', $status_parameters)) {
|
||||||
|
$this->builder->where('status_id', Quote::STATUS_SENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('approved', $status_parameters)) {
|
||||||
|
$this->builder->where('status_id', Quote::STATUS_APPROVED);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('expired', $status_parameters)) {
|
||||||
|
$this->builder->where('status_id', Quote::STATUS_SENT)
|
||||||
|
->where('due_date', '<=', now()->toDateString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the list based on the status
|
* Filters the list based on the status
|
||||||
* archived, active, deleted.
|
* archived, active, deleted.
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace App\Filters;
|
namespace App\Filters;
|
||||||
|
|
||||||
|
use App\Models\RecurringInvoice;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
|
||||||
@ -40,6 +41,46 @@ class RecurringInvoiceFilters extends QueryFilters
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter based on client status.
|
||||||
|
*
|
||||||
|
* Statuses we need to handle
|
||||||
|
* - all
|
||||||
|
* - active
|
||||||
|
* - paused
|
||||||
|
* - completed
|
||||||
|
*
|
||||||
|
* @param string client_status The invoice status as seen by the client
|
||||||
|
* @return Builder
|
||||||
|
*/
|
||||||
|
public function client_status(string $value = '') :Builder
|
||||||
|
{
|
||||||
|
if (strlen($value) == 0) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
$status_parameters = explode(',', $value);
|
||||||
|
|
||||||
|
if (in_array('all', $status_parameters)) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('active', $status_parameters)) {
|
||||||
|
$this->builder->where('status_id', RecurringInvoice::STATUS_ACTIVE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('paused', $status_parameters)) {
|
||||||
|
$this->builder->where('status_id', RecurringInvoice::STATUS_PAUSED);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('completed', $status_parameters)) {
|
||||||
|
$this->builder->where('status_id', RecurringInvoice::STATUS_COMPLETED);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the list based on the status
|
* Filters the list based on the status
|
||||||
* archived, active, deleted.
|
* archived, active, deleted.
|
||||||
|
@ -4839,6 +4839,10 @@ $LANG = array(
|
|||||||
'show_tasks_in_client_portal' => 'Show Tasks in Client Portal',
|
'show_tasks_in_client_portal' => 'Show Tasks in Client Portal',
|
||||||
'notification_quote_expired_subject' => 'Quote :invoice has expired for :client',
|
'notification_quote_expired_subject' => 'Quote :invoice has expired for :client',
|
||||||
'notification_quote_expired' => 'The following Quote :invoice for client :client and :amount has now expired.',
|
'notification_quote_expired' => 'The following Quote :invoice for client :client and :amount has now expired.',
|
||||||
|
'auto_sync' => 'Auto Sync',
|
||||||
|
'refresh_accounts' => 'Refresh Accounts',
|
||||||
|
'upgrade_to_connect_bank_account' => 'Upgrade to Enterprise to connect your bank account',
|
||||||
|
'click_here_to_connect_bank_account' => 'Click here to connect your bank account',
|
||||||
);
|
);
|
||||||
|
|
||||||
return $LANG;
|
return $LANG;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user