1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 20:52:56 +01:00

Working on task kanban

This commit is contained in:
Hillel Coren 2017-12-19 21:08:27 +02:00
parent 7832fc0c0b
commit 648f6957e8
3 changed files with 20 additions and 5 deletions

View File

@ -205,10 +205,10 @@ if (! defined('APP_NAME')) {
define('PAYMENT_STATUS_PARTIALLY_REFUNDED', 5);
define('PAYMENT_STATUS_REFUNDED', 6);
define('TASK_STATUS_LOGGED', 1);
define('TASK_STATUS_RUNNING', 2);
define('TASK_STATUS_INVOICED', 3);
define('TASK_STATUS_PAID', 4);
define('TASK_STATUS_LOGGED', -1);
define('TASK_STATUS_RUNNING', -2);
define('TASK_STATUS_INVOICED', -3);
define('TASK_STATUS_PAID', -4);
define('EXPENSE_STATUS_LOGGED', 1);
define('EXPENSE_STATUS_PENDING', 2);

View File

@ -239,7 +239,17 @@ class Task extends EntityModel
public static function getStatuses($entityType = false)
{
$statuses = [];
$statuses[TASK_STATUS_LOGGED] = trans('texts.logged');
$taskStatues = TaskStatus::scope()->orderBy('sort_order')->get();
foreach ($taskStatues as $status) {
$statuses[$status->id] = $status->name;
}
if (! $taskStatues->count()) {
$statuses[TASK_STATUS_LOGGED] = trans('texts.logged');
}
$statuses[TASK_STATUS_RUNNING] = trans('texts.running');
$statuses[TASK_STATUS_INVOICED] = trans('texts.invoiced');
$statuses[TASK_STATUS_PAID] = trans('texts.paid');

View File

@ -88,6 +88,11 @@ class TaskRepository extends BaseRepository
if (in_array(TASK_STATUS_PAID, $statuses)) {
$query->orWhere('invoices.balance', '=', 0);
}
$query->orWhere(function ($query) use ($statuses) {
$query->whereIn('tasks.task_status_id', $statuses)
->whereNull('tasks.invoice_id');
});
});
}