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',
|
'expense_status_id',
|
||||||
function ($model) {
|
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) {
|
if ($invoiceId) {
|
||||||
$label = trans('texts.invoiced');
|
if (floatval($balance)) {
|
||||||
$class = 'success';
|
$label = trans('texts.invoiced');
|
||||||
|
$class = 'default';
|
||||||
|
} else {
|
||||||
|
$label = trans('texts.paid');
|
||||||
|
$class = 'success';
|
||||||
|
}
|
||||||
} elseif ($shouldBeInvoiced) {
|
} elseif ($shouldBeInvoiced) {
|
||||||
$label = trans('texts.pending');
|
$label = trans('texts.pending');
|
||||||
$class = 'warning';
|
$class = 'warning';
|
||||||
|
@ -96,13 +96,18 @@ class TaskDatatable extends EntityDatatable
|
|||||||
private function getStatusLabel($model)
|
private function getStatusLabel($model)
|
||||||
{
|
{
|
||||||
if ($model->invoice_number) {
|
if ($model->invoice_number) {
|
||||||
$class = 'success';
|
if (floatval($model->balance)) {
|
||||||
$label = trans('texts.invoiced');
|
$label = trans('texts.invoiced');
|
||||||
|
$class = 'default';
|
||||||
|
} else {
|
||||||
|
$class = 'success';
|
||||||
|
$label = trans('texts.paid');
|
||||||
|
}
|
||||||
} elseif ($model->is_running) {
|
} elseif ($model->is_running) {
|
||||||
$class = 'primary';
|
$class = 'primary';
|
||||||
$label = trans('texts.running');
|
$label = trans('texts.running');
|
||||||
} else {
|
} else {
|
||||||
$class = 'default';
|
$class = 'warning';
|
||||||
$label = trans('texts.logged');
|
$label = trans('texts.logged');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,6 +79,7 @@ class ExpenseRepository extends BaseRepository
|
|||||||
'expenses.user_id',
|
'expenses.user_id',
|
||||||
'invoices.public_id as invoice_public_id',
|
'invoices.public_id as invoice_public_id',
|
||||||
'invoices.user_id as invoice_user_id',
|
'invoices.user_id as invoice_user_id',
|
||||||
|
'invoices.balance',
|
||||||
'vendors.name as vendor_name',
|
'vendors.name as vendor_name',
|
||||||
'vendors.public_id as vendor_public_id',
|
'vendors.public_id as vendor_public_id',
|
||||||
'vendors.user_id as vendor_user_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
|
// prevent loading all of the documents if we don't have to
|
||||||
if ( ! $expense->wasRecentlyCreated) {
|
if ( ! $expense->wasRecentlyCreated) {
|
||||||
foreach ($expense->documents as $document){
|
foreach ($expense->documents as $document){
|
||||||
|
@ -38,6 +38,7 @@ class TaskRepository
|
|||||||
'invoices.invoice_number',
|
'invoices.invoice_number',
|
||||||
'invoices.public_id as invoice_public_id',
|
'invoices.public_id as invoice_public_id',
|
||||||
'invoices.user_id as invoice_user_id',
|
'invoices.user_id as invoice_user_id',
|
||||||
|
'invoices.balance',
|
||||||
'tasks.is_running',
|
'tasks.is_running',
|
||||||
'tasks.time_log',
|
'tasks.time_log',
|
||||||
'tasks.created_at',
|
'tasks.created_at',
|
||||||
@ -89,7 +90,7 @@ class TaskRepository
|
|||||||
} else {
|
} else {
|
||||||
$timeLog = [];
|
$timeLog = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
array_multisort($timeLog);
|
array_multisort($timeLog);
|
||||||
|
|
||||||
if (isset($data['action'])) {
|
if (isset($data['action'])) {
|
||||||
|
Loading…
Reference in New Issue
Block a user