Check if entries have an encrypted description and act accordingly.

This commit is contained in:
James Cole 2015-02-01 14:56:25 +01:00
parent 37fe79944f
commit 2998382969
2 changed files with 3 additions and 1 deletions

View File

@ -281,7 +281,8 @@ class GoogleChartController extends BaseController
$unpaid['items'][] = $entry->name;
$unpaid['amount'] += floatval($entry->averageAmount);
} else {
$paid['items'][] = $entry->description;
$description = intval($entry->encrypted) == 1 ? Crypt::decrypt($entry->description) : $entry->description;
$paid['items'][] = $description;
$paid['amount'] += floatval($entry->actualAmount);
}
}

View File

@ -67,6 +67,7 @@ class Chart implements ChartInterface
->groupBy('bills.id')
->get(
['bills.id', 'bills.name', 'transaction_journals.description',
'transaction_journals.encrypted',
'transaction_journals.id as journalId',
\DB::Raw('SUM(`bills`.`amount_min` + `bills`.`amount_max`) / 2 as `averageAmount`'),
'transactions.amount AS actualAmount']