Optimized decryption.

This commit is contained in:
James Cole
2015-03-31 22:46:11 +02:00
parent 566fadad15
commit e000fb5d80
4 changed files with 47 additions and 31 deletions

View File

@@ -22,11 +22,7 @@
@foreach($income as $entry)
<tr>
<td>
@if($entry->encrypted === true)
<a href="{{route('transactions.show',$entry->id)}}" title="{{{Crypt::decrypt($entry->description)}}}">{{{Crypt::decrypt($entry->description)}}}</a>
@else
<a href="{{route('transactions.show',$entry->id)}}" title="{{{$entry->description}}}">{{{$entry->description}}}</a>
@endif
<a href="{{route('transactions.show',$entry->id)}}" title="{{{$entry->description}}}">{{{$entry->description}}}</a>
</td>
<td>
<?php $tableSum += floatval($entry->amount);?>
@@ -44,11 +40,7 @@
{{$entry->date->format('j F Y')}}
</td>
<td>
@if(intval($entry->account_encrypted) == 1)
<a href="{{route('accounts.show',$entry->account_id)}}">{{{Crypt::decrypt($entry->name)}}}</a>
@else
<a href="{{route('accounts.show',$entry->account_id)}}">{{{$entry->name}}}</a>
@endif
<a href="{{route('accounts.show',$entry->account_id)}}">{{{$entry->name}}}</a>
</td>
</tr>
@endforeach
@@ -73,15 +65,12 @@
@foreach($expenses as $id => $expense)
<?php
$sum += floatval($expense['amount']);
$name = isset($expense['encrypted']) && intval($expense['encrypted']) ==1 ? Crypt::decrypt($expense['name']) :$expense['name'];
//var_dump($expense);
?>
<tr>
@if($id > 0)
<td><a href="{{route('accounts.show',$id)}}">{{{$name}}}</a></td>
<td><a href="{{route('accounts.show',$id)}}">{{{$expense['name']}}}</a></td>
@else
<td><em>{{{$expense['name']}}}</em></td>
<td><em>{{{$expense['name']}}}</em></td>
@endif
<td>{!! Amount::format($expense['amount']) !!}</td>
</tr>

View File

@@ -128,10 +128,9 @@
@foreach($groupedIncomes as $income)
<?php
$sum += floatval($income->amount)*-1;
$name = intval($income->encrypted) == 1 ? Crypt::decrypt($income->name) : $income->name;
?>
<tr>
<td><a href="{{route('accounts.show',$income->account_id)}}">{{{$name}}}</a></td>
<td><a href="{{route('accounts.show',$income->account_id)}}">{{{$income->name}}}</a></td>
<td>{!! Amount::format(floatval($income->amount)*-1) !!}</td>
</tr>
@endforeach
@@ -151,11 +150,8 @@
<table class="table">
<?php $sum = 0;?>
@foreach($groupedExpenses as $id => $expense)
<?php
$name = intval($expense['encrypted']) == 1 ? Crypt::decrypt($expense['name']) : $expense['name'];
?>
<tr>
<td><a href="{{route('accounts.show',$id)}}">{{{$name}}}</a></td>
<td><a href="{{route('accounts.show',$id)}}">{{{$expense['name']}}}</a></td>
<td>{!! Amount::format(floatval($expense['amount'])*-1) !!}</td>
</tr>
<?php $sum += floatval($expense['amount'])*-1;?>