mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Fix for #920
This commit is contained in:
parent
6dc0f93534
commit
32a2f6cdc7
@ -75,7 +75,7 @@ class ExpenseDatatable extends EntityDatatable
|
||||
[
|
||||
'expense_status_id',
|
||||
function ($model) {
|
||||
return self::getStatusLabel($model->invoice_id, $model->should_be_invoiced);
|
||||
return self::getStatusLabel($model->invoice_id, $model->should_be_invoiced, $model->balance);
|
||||
}
|
||||
],
|
||||
];
|
||||
@ -115,11 +115,16 @@ class ExpenseDatatable extends EntityDatatable
|
||||
}
|
||||
|
||||
|
||||
private function getStatusLabel($invoiceId, $shouldBeInvoiced)
|
||||
private function getStatusLabel($invoiceId, $shouldBeInvoiced, $balance)
|
||||
{
|
||||
if ($invoiceId) {
|
||||
$label = trans('texts.invoiced');
|
||||
$class = 'success';
|
||||
if (floatval($balance)) {
|
||||
$label = trans('texts.invoiced');
|
||||
$class = 'default';
|
||||
} else {
|
||||
$label = trans('texts.paid');
|
||||
$class = 'success';
|
||||
}
|
||||
} elseif ($shouldBeInvoiced) {
|
||||
$label = trans('texts.pending');
|
||||
$class = 'warning';
|
||||
|
@ -96,13 +96,18 @@ class TaskDatatable extends EntityDatatable
|
||||
private function getStatusLabel($model)
|
||||
{
|
||||
if ($model->invoice_number) {
|
||||
$class = 'success';
|
||||
$label = trans('texts.invoiced');
|
||||
if (floatval($model->balance)) {
|
||||
$label = trans('texts.invoiced');
|
||||
$class = 'default';
|
||||
} else {
|
||||
$class = 'success';
|
||||
$label = trans('texts.paid');
|
||||
}
|
||||
} elseif ($model->is_running) {
|
||||
$class = 'primary';
|
||||
$label = trans('texts.running');
|
||||
} else {
|
||||
$class = 'default';
|
||||
$class = 'warning';
|
||||
$label = trans('texts.logged');
|
||||
}
|
||||
|
||||
|
@ -79,6 +79,7 @@ class ExpenseRepository extends BaseRepository
|
||||
'expenses.user_id',
|
||||
'invoices.public_id as invoice_public_id',
|
||||
'invoices.user_id as invoice_user_id',
|
||||
'invoices.balance',
|
||||
'vendors.name as vendor_name',
|
||||
'vendors.public_id as vendor_public_id',
|
||||
'vendors.user_id as vendor_user_id',
|
||||
@ -158,7 +159,7 @@ class ExpenseRepository extends BaseRepository
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// prevent loading all of the documents if we don't have to
|
||||
if ( ! $expense->wasRecentlyCreated) {
|
||||
foreach ($expense->documents as $document){
|
||||
|
@ -38,6 +38,7 @@ class TaskRepository
|
||||
'invoices.invoice_number',
|
||||
'invoices.public_id as invoice_public_id',
|
||||
'invoices.user_id as invoice_user_id',
|
||||
'invoices.balance',
|
||||
'tasks.is_running',
|
||||
'tasks.time_log',
|
||||
'tasks.created_at',
|
||||
@ -89,7 +90,7 @@ class TaskRepository
|
||||
} else {
|
||||
$timeLog = [];
|
||||
}
|
||||
|
||||
|
||||
array_multisort($timeLog);
|
||||
|
||||
if (isset($data['action'])) {
|
||||
|
Loading…
Reference in New Issue
Block a user