mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-18 18:44:16 +00:00
Some code cleanup.
This commit is contained in:
@@ -8,13 +8,13 @@ use Zizaco\Entrust\EntrustPermission;
|
|||||||
* Class Permission
|
* Class Permission
|
||||||
*
|
*
|
||||||
* @package FireflyIII\Models
|
* @package FireflyIII\Models
|
||||||
* @property integer $id
|
* @property integer $id
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property string $display_name
|
* @property string $display_name
|
||||||
* @property string $description
|
* @property string $description
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Config::get('entrust.role')[] $roles
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Config::get('entrust.role')[] $roles
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Permission whereId($value)
|
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Permission whereId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Permission whereName($value)
|
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Permission whereName($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Permission whereDisplayName($value)
|
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Permission whereDisplayName($value)
|
||||||
|
@@ -8,14 +8,14 @@ use Zizaco\Entrust\EntrustRole;
|
|||||||
* Class Role
|
* Class Role
|
||||||
*
|
*
|
||||||
* @package FireflyIII\Models
|
* @package FireflyIII\Models
|
||||||
* @property integer $id
|
* @property integer $id
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property string $display_name
|
* @property string $display_name
|
||||||
* @property string $description
|
* @property string $description
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Config::get('auth.model')[] $users
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Config::get('auth.model')[] $users
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Config::get('entrust.permission')[] $perms
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Config::get('entrust.permission')[] $perms
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Role whereId($value)
|
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Role whereId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Role whereName($value)
|
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Role whereName($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Role whereDisplayName($value)
|
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Role whereDisplayName($value)
|
||||||
|
@@ -68,9 +68,10 @@ use Watson\Validating\ValidatingTrait;
|
|||||||
* @property mixed account_id
|
* @property mixed account_id
|
||||||
* @property mixed name
|
* @property mixed name
|
||||||
* @property mixed symbol
|
* @property mixed symbol
|
||||||
* @property-read mixed $correct_amount
|
* @property-read mixed $correct_amount
|
||||||
* @method static \FireflyIII\Models\TransactionJournal orderBy
|
* @method static \FireflyIII\Models\TransactionJournal orderBy
|
||||||
* @method static \FireflyIII\Models\TransactionJournal|null first
|
* @method static \FireflyIII\Models\TransactionJournal|null first
|
||||||
|
* @property-read mixed $source_account
|
||||||
*/
|
*/
|
||||||
class TransactionJournal extends Model
|
class TransactionJournal extends Model
|
||||||
{
|
{
|
||||||
@@ -294,14 +295,17 @@ class TransactionJournal extends Model
|
|||||||
*/
|
*/
|
||||||
public function getDestinationAccountAttribute()
|
public function getDestinationAccountAttribute()
|
||||||
{
|
{
|
||||||
/** @var Transaction $transaction */
|
$cache = new CacheProperties;
|
||||||
foreach ($this->transactions()->get() as $transaction) {
|
$cache->addProperty($this->id);
|
||||||
if (floatval($transaction->amount) > 0) {
|
$cache->addProperty('destinationAccount');
|
||||||
return $transaction->account;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->transactions()->first()->account;
|
if ($cache->has()) {
|
||||||
|
return $cache->get(); // @codeCoverageIgnore
|
||||||
|
}
|
||||||
|
$account = $this->transactions()->where('amount', '>', 0)->first()->account;
|
||||||
|
$cache->store($account);
|
||||||
|
|
||||||
|
return $account;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -325,6 +329,23 @@ class TransactionJournal extends Model
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Account
|
||||||
|
*/
|
||||||
|
public function getSourceAccountAttribute()
|
||||||
|
{
|
||||||
|
$cache = new CacheProperties;
|
||||||
|
$cache->addProperty($this->id);
|
||||||
|
$cache->addProperty('destinationAccount');
|
||||||
|
if ($cache->has()) {
|
||||||
|
return $cache->get(); // @codeCoverageIgnore
|
||||||
|
}
|
||||||
|
$account = $this->transactions()->where('amount', '<', 0)->first()->account;
|
||||||
|
$cache->store($account);
|
||||||
|
|
||||||
|
return $account;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||||
@@ -415,7 +436,7 @@ class TransactionJournal extends Model
|
|||||||
public function scopeWithRelevantData(EloquentBuilder $query)
|
public function scopeWithRelevantData(EloquentBuilder $query)
|
||||||
{
|
{
|
||||||
$query->with(
|
$query->with(
|
||||||
['transactions' => function(HasMany $q) {
|
['transactions' => function (HasMany $q) {
|
||||||
$q->orderBy('amount', 'ASC');
|
$q->orderBy('amount', 'ASC');
|
||||||
}, 'transactiontype', 'transactioncurrency', 'budgets', 'categories', 'transactions.account.accounttype', 'bill', 'budgets', 'categories']
|
}, 'transactiontype', 'transactioncurrency', 'budgets', 'categories', 'transactions.account.accounttype', 'bill', 'budgets', 'categories']
|
||||||
);
|
);
|
||||||
|
@@ -8,6 +8,7 @@ use FireflyIII\Models\Budget;
|
|||||||
use FireflyIII\Models\BudgetLimit;
|
use FireflyIII\Models\BudgetLimit;
|
||||||
use FireflyIII\Models\LimitRepetition;
|
use FireflyIII\Models\LimitRepetition;
|
||||||
use FireflyIII\Repositories\Shared\ComponentRepository;
|
use FireflyIII\Repositories\Shared\ComponentRepository;
|
||||||
|
use FireflyIII\Support\CacheProperties;
|
||||||
use Illuminate\Database\Query\Builder as QueryBuilder;
|
use Illuminate\Database\Query\Builder as QueryBuilder;
|
||||||
use Illuminate\Pagination\LengthAwarePaginator;
|
use Illuminate\Pagination\LengthAwarePaginator;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
@@ -79,10 +80,10 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn
|
|||||||
/** @var Collection $repetitions */
|
/** @var Collection $repetitions */
|
||||||
return LimitRepetition::
|
return LimitRepetition::
|
||||||
leftJoin('budget_limits', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id')
|
leftJoin('budget_limits', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id')
|
||||||
->where('limit_repetitions.startdate', '<=', $end->format('Y-m-d 00:00:00'))
|
->where('limit_repetitions.startdate', '<=', $end->format('Y-m-d 00:00:00'))
|
||||||
->where('limit_repetitions.startdate', '>=', $start->format('Y-m-d 00:00:00'))
|
->where('limit_repetitions.startdate', '>=', $start->format('Y-m-d 00:00:00'))
|
||||||
->where('budget_limits.budget_id', $budget->id)
|
->where('budget_limits.budget_id', $budget->id)
|
||||||
->get(['limit_repetitions.*']);
|
->get(['limit_repetitions.*']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -113,7 +114,17 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn
|
|||||||
*/
|
*/
|
||||||
public function getCurrentRepetition(Budget $budget, Carbon $date)
|
public function getCurrentRepetition(Budget $budget, Carbon $date)
|
||||||
{
|
{
|
||||||
return $budget->limitrepetitions()->where('limit_repetitions.startdate', $date)->first(['limit_repetitions.*']);
|
$cache = new CacheProperties;
|
||||||
|
$cache->addProperty($budget->id);
|
||||||
|
$cache->addProperty($date);
|
||||||
|
$cache->addProperty('getCurrentRepetition');
|
||||||
|
if ($cache->has()) {
|
||||||
|
return $cache->get(); // @codeCoverageIgnore
|
||||||
|
}
|
||||||
|
$data = $budget->limitrepetitions()->where('limit_repetitions.startdate', $date)->first(['limit_repetitions.*']);
|
||||||
|
$cache->store($data);
|
||||||
|
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -150,13 +161,22 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn
|
|||||||
*/
|
*/
|
||||||
public function getJournals(Budget $budget, LimitRepetition $repetition = null, $take = 50)
|
public function getJournals(Budget $budget, LimitRepetition $repetition = null, $take = 50)
|
||||||
{
|
{
|
||||||
$offset = intval(Input::get('page')) > 0 ? intval(Input::get('page')) * $take : 0;
|
$cache = new CacheProperties;
|
||||||
|
$cache->addProperty($budget->id);
|
||||||
|
if ($repetition) {
|
||||||
|
$cache->addProperty($repetition->id);
|
||||||
|
}
|
||||||
|
$cache->addProperty($take);
|
||||||
|
$cache->addProperty('getJournals');
|
||||||
|
if ($cache->has()) {
|
||||||
|
return $cache->get(); // @codeCoverageIgnore
|
||||||
|
}
|
||||||
|
|
||||||
|
$offset = intval(Input::get('page')) > 0 ? intval(Input::get('page')) * $take : 0;
|
||||||
$setQuery = $budget->transactionJournals()->withRelevantData()->take($take)->offset($offset)
|
$setQuery = $budget->transactionJournals()->withRelevantData()->take($take)->offset($offset)
|
||||||
->orderBy('transaction_journals.date', 'DESC')
|
->orderBy('transaction_journals.date', 'DESC')
|
||||||
->orderBy('transaction_journals.order', 'ASC')
|
->orderBy('transaction_journals.order', 'ASC')
|
||||||
->orderBy('transaction_journals.id', 'DESC');
|
->orderBy('transaction_journals.id', 'DESC');
|
||||||
$countQuery = $budget->transactionJournals();
|
$countQuery = $budget->transactionJournals();
|
||||||
|
|
||||||
|
|
||||||
@@ -169,7 +189,11 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn
|
|||||||
$set = $setQuery->get(['transaction_journals.*']);
|
$set = $setQuery->get(['transaction_journals.*']);
|
||||||
$count = $countQuery->count();
|
$count = $countQuery->count();
|
||||||
|
|
||||||
return new LengthAwarePaginator($set, $count, $take, $offset);
|
|
||||||
|
$paginator = new LengthAwarePaginator($set, $count, $take, $offset);
|
||||||
|
$cache->store($paginator);
|
||||||
|
|
||||||
|
return $paginator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -196,9 +220,9 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn
|
|||||||
public function getLimitAmountOnDate(Budget $budget, Carbon $date)
|
public function getLimitAmountOnDate(Budget $budget, Carbon $date)
|
||||||
{
|
{
|
||||||
$repetition = LimitRepetition::leftJoin('budget_limits', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id')
|
$repetition = LimitRepetition::leftJoin('budget_limits', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id')
|
||||||
->where('limit_repetitions.startdate', $date->format('Y-m-d 00:00:00'))
|
->where('limit_repetitions.startdate', $date->format('Y-m-d 00:00:00'))
|
||||||
->where('budget_limits.budget_id', $budget->id)
|
->where('budget_limits.budget_id', $budget->id)
|
||||||
->first(['limit_repetitions.*']);
|
->first(['limit_repetitions.*']);
|
||||||
|
|
||||||
if ($repetition) {
|
if ($repetition) {
|
||||||
return floatval($repetition->amount);
|
return floatval($repetition->amount);
|
||||||
@@ -216,15 +240,15 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn
|
|||||||
public function getWithoutBudget(Carbon $start, Carbon $end)
|
public function getWithoutBudget(Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
return Auth::user()
|
return Auth::user()
|
||||||
->transactionjournals()
|
->transactionjournals()
|
||||||
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
|
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
|
||||||
->whereNull('budget_transaction_journal.id')
|
->whereNull('budget_transaction_journal.id')
|
||||||
->before($end)
|
->before($end)
|
||||||
->after($start)
|
->after($start)
|
||||||
->orderBy('transaction_journals.date', 'DESC')
|
->orderBy('transaction_journals.date', 'DESC')
|
||||||
->orderBy('transaction_journals.order', 'ASC')
|
->orderBy('transaction_journals.order', 'ASC')
|
||||||
->orderBy('transaction_journals.id', 'DESC')
|
->orderBy('transaction_journals.id', 'DESC')
|
||||||
->get(['transaction_journals.*']);
|
->get(['transaction_journals.*']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -236,22 +260,22 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn
|
|||||||
public function getWithoutBudgetSum(Carbon $start, Carbon $end)
|
public function getWithoutBudgetSum(Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
$noBudgetSet = Auth::user()
|
$noBudgetSet = Auth::user()
|
||||||
->transactionjournals()
|
->transactionjournals()
|
||||||
->whereNotIn(
|
->whereNotIn(
|
||||||
'transaction_journals.id', function (QueryBuilder $query) use ($start, $end) {
|
'transaction_journals.id', function (QueryBuilder $query) use ($start, $end) {
|
||||||
$query
|
$query
|
||||||
->select('transaction_journals.id')
|
->select('transaction_journals.id')
|
||||||
->from('transaction_journals')
|
->from('transaction_journals')
|
||||||
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
|
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
|
||||||
->where('transaction_journals.date', '>=', $start->format('Y-m-d 00:00:00'))
|
->where('transaction_journals.date', '>=', $start->format('Y-m-d 00:00:00'))
|
||||||
->where('transaction_journals.date', '<=', $end->format('Y-m-d 00:00:00'))
|
->where('transaction_journals.date', '<=', $end->format('Y-m-d 00:00:00'))
|
||||||
->whereNotNull('budget_transaction_journal.budget_id');
|
->whereNotNull('budget_transaction_journal.budget_id');
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
->after($start)
|
->after($start)
|
||||||
->before($end)
|
->before($end)
|
||||||
->transactionTypes(['Withdrawal'])
|
->transactionTypes(['Withdrawal'])
|
||||||
->get(['transaction_journals.*'])->sum('amount');
|
->get(['transaction_journals.*'])->sum('amount');
|
||||||
|
|
||||||
return floatval($noBudgetSet) * -1;
|
return floatval($noBudgetSet) * -1;
|
||||||
}
|
}
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
namespace FireflyIII\Repositories\Shared;
|
namespace FireflyIII\Repositories\Shared;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use FireflyIII\Support\CacheProperties;
|
||||||
use Illuminate\Database\Query\JoinClause;
|
use Illuminate\Database\Query\JoinClause;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,6 +26,21 @@ class ComponentRepository
|
|||||||
*/
|
*/
|
||||||
protected function spentInPeriod($object, Carbon $start, Carbon $end, $shared = false)
|
protected function spentInPeriod($object, Carbon $start, Carbon $end, $shared = false)
|
||||||
{
|
{
|
||||||
|
// we must cache this.
|
||||||
|
|
||||||
|
$cache = new CacheProperties;
|
||||||
|
$cache->addProperty($object->id);
|
||||||
|
$cache->addProperty(get_class($object));
|
||||||
|
$cache->addProperty($start);
|
||||||
|
$cache->addProperty($end);
|
||||||
|
$cache->addProperty($shared);
|
||||||
|
$cache->addProperty('spentInPeriod');
|
||||||
|
|
||||||
|
if($cache->has()) {
|
||||||
|
return $cache->get(); // @codeCoverageIgnore
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($shared === true) {
|
if ($shared === true) {
|
||||||
// shared is true.
|
// shared is true.
|
||||||
// always ignore transfers between accounts!
|
// always ignore transfers between accounts!
|
||||||
@@ -51,6 +67,8 @@ class ComponentRepository
|
|||||||
->get(['transaction_journals.*'])->sum('amount');
|
->get(['transaction_journals.*'])->sum('amount');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$cache->store($sum);
|
||||||
|
|
||||||
return $sum;
|
return $sum;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,7 @@ namespace FireflyIII\Support\Twig;
|
|||||||
|
|
||||||
use Auth;
|
use Auth;
|
||||||
use FireflyIII\Models\LimitRepetition;
|
use FireflyIII\Models\LimitRepetition;
|
||||||
|
use FireflyIII\Support\CacheProperties;
|
||||||
use Twig_Extension;
|
use Twig_Extension;
|
||||||
use Twig_SimpleFunction;
|
use Twig_SimpleFunction;
|
||||||
|
|
||||||
@@ -21,18 +22,25 @@ class Budget extends Twig_Extension
|
|||||||
{
|
{
|
||||||
$functions = [];
|
$functions = [];
|
||||||
$functions[] = new Twig_SimpleFunction(
|
$functions[] = new Twig_SimpleFunction(
|
||||||
'spentInRepetitionCorrected', function(LimitRepetition $repetition) {
|
'spentInRepetitionCorrected', function (LimitRepetition $repetition) {
|
||||||
|
$cache = new CacheProperties;
|
||||||
|
$cache->addProperty($repetition->id);
|
||||||
|
$cache->addProperty('spentInRepetitionCorrected');
|
||||||
|
if ($cache->has()) {
|
||||||
|
return $cache->get(); // @codeCoverageIgnore
|
||||||
|
}
|
||||||
$sum
|
$sum
|
||||||
= Auth::user()->transactionjournals()
|
= Auth::user()->transactionjournals()
|
||||||
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
|
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
|
||||||
->leftJoin('budget_limits', 'budget_limits.budget_id', '=', 'budget_transaction_journal.budget_id')
|
->leftJoin('budget_limits', 'budget_limits.budget_id', '=', 'budget_transaction_journal.budget_id')
|
||||||
->leftJoin('limit_repetitions', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id')
|
->leftJoin('limit_repetitions', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id')
|
||||||
->before($repetition->enddate)
|
->before($repetition->enddate)
|
||||||
->after($repetition->startdate)
|
->after($repetition->startdate)
|
||||||
->where('limit_repetitions.id', '=', $repetition->id)
|
->where('limit_repetitions.id', '=', $repetition->id)
|
||||||
->get(['transaction_journals.*'])->sum('amount');
|
->get(['transaction_journals.*'])->sum('amount');
|
||||||
|
$cache->store($sum);
|
||||||
|
|
||||||
return floatval($sum);
|
return $sum;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@@ -87,8 +87,18 @@ class Journal extends Twig_Extension
|
|||||||
|
|
||||||
$functions[] = new Twig_SimpleFunction(
|
$functions[] = new Twig_SimpleFunction(
|
||||||
'relevantTags', function(TransactionJournal $journal) {
|
'relevantTags', function(TransactionJournal $journal) {
|
||||||
|
$cache = new CacheProperties;
|
||||||
|
$cache->addProperty('relevantTags');
|
||||||
|
$cache->addProperty($journal->id);
|
||||||
|
|
||||||
|
if($cache->has()) {
|
||||||
|
return $cache->get(); // @codeCoverageIgnore
|
||||||
|
}
|
||||||
|
|
||||||
if ($journal->tags->count() == 0) {
|
if ($journal->tags->count() == 0) {
|
||||||
return App::make('amount')->formatJournal($journal);
|
$string = App::make('amount')->formatJournal($journal);
|
||||||
|
$cache->store($string);
|
||||||
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -97,9 +107,10 @@ class Journal extends Twig_Extension
|
|||||||
// return tag formatted for a "balancing act", even if other
|
// return tag formatted for a "balancing act", even if other
|
||||||
// tags are present.
|
// tags are present.
|
||||||
$amount = App::make('amount')->format($journal->actual_amount, false);
|
$amount = App::make('amount')->format($journal->actual_amount, false);
|
||||||
|
$string = '<a href="' . route('tags.show', [$tag->id]) . '" class="label label-success" title="' . $amount
|
||||||
return '<a href="' . route('tags.show', [$tag->id]) . '" class="label label-success" title="' . $amount
|
|
||||||
. '"><i class="fa fa-fw fa-refresh"></i> ' . $tag->tag . '</a>';
|
. '"><i class="fa fa-fw fa-refresh"></i> ' . $tag->tag . '</a>';
|
||||||
|
$cache->store($string);
|
||||||
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -107,9 +118,10 @@ class Journal extends Twig_Extension
|
|||||||
*/
|
*/
|
||||||
if ($tag->tagMode == 'advancePayment' && $journal->transactionType->type == 'Deposit') {
|
if ($tag->tagMode == 'advancePayment' && $journal->transactionType->type == 'Deposit') {
|
||||||
$amount = App::make('amount')->formatJournal($journal, false);
|
$amount = App::make('amount')->formatJournal($journal, false);
|
||||||
|
$string = '<a href="' . route('tags.show', [$tag->id]) . '" class="label label-success" title="' . $amount
|
||||||
return '<a href="' . route('tags.show', [$tag->id]) . '" class="label label-success" title="' . $amount
|
|
||||||
. '"><i class="fa fa-fw fa-sort-numeric-desc"></i> ' . $tag->tag . '</a>';
|
. '"><i class="fa fa-fw fa-sort-numeric-desc"></i> ' . $tag->tag . '</a>';
|
||||||
|
$cache->store($string);
|
||||||
|
return $string;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* AdvancePayment with a withdrawal will show the amount with a link to
|
* AdvancePayment with a withdrawal will show the amount with a link to
|
||||||
@@ -118,13 +130,17 @@ class Journal extends Twig_Extension
|
|||||||
if ($tag->tagMode == 'advancePayment' && $journal->transactionType->type == 'Withdrawal') {
|
if ($tag->tagMode == 'advancePayment' && $journal->transactionType->type == 'Withdrawal') {
|
||||||
$amount = App::make('amount')->formatJournal($journal);
|
$amount = App::make('amount')->formatJournal($journal);
|
||||||
|
|
||||||
return '<a href="' . route('tags.show', [$tag->id]) . '">' . $amount . '</a>';
|
$string = '<a href="' . route('tags.show', [$tag->id]) . '">' . $amount . '</a>';
|
||||||
|
$cache->store($string);
|
||||||
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($tag->tagMode == 'nothing') {
|
if ($tag->tagMode == 'nothing') {
|
||||||
// return the amount:
|
// return the amount:
|
||||||
return App::make('amount')->formatJournal($journal);
|
$string = App::make('amount')->formatJournal($journal);
|
||||||
|
$cache->store($string);
|
||||||
|
return $string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -33,7 +33,7 @@ use Zizaco\Entrust\Traits\EntrustUserTrait;
|
|||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User wherePassword($value)
|
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User wherePassword($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereReset($value)
|
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereReset($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereRememberToken($value)
|
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereRememberToken($value)
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Config::get('entrust.role')[] $roles
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Config::get('entrust.role')[] $roles
|
||||||
*/
|
*/
|
||||||
class User extends Model implements AuthenticatableContract, CanResetPasswordContract
|
class User extends Model implements AuthenticatableContract, CanResetPasswordContract
|
||||||
{
|
{
|
||||||
|
@@ -64,17 +64,17 @@
|
|||||||
{{journal.date.formatLocalized(monthAndDayFormat)}}
|
{{journal.date.formatLocalized(monthAndDayFormat)}}
|
||||||
</td>
|
</td>
|
||||||
<td class="hidden-xs">
|
<td class="hidden-xs">
|
||||||
{% if journal.transactions[0].account.accountType.type == 'Cash account' %}
|
{% if journal.source_account.accountType.type == 'Cash account' %}
|
||||||
<span class="text-success">(cash)</span>
|
<span class="text-success">(cash)</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="{{route('accounts.show',journal.transactions[0].account_id)}}">{{journal.transactions[0].account.name}}</a>
|
<a href="{{route('accounts.show',journal.source_account.id)}}">{{journal.source_account.name}}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td class="hidden-xs">
|
<td class="hidden-xs">
|
||||||
{% if journal.transactions[1].account.accountType.type == 'Cash account' %}
|
{% if journal.destination_account.accountType.type == 'Cash account' %}
|
||||||
<span class="text-success">(cash)</span>
|
<span class="text-success">(cash)</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="{{route('accounts.show',journal.transactions[1].account_id)}}">{{journal.transactions[1].account.name}}</a>
|
<a href="{{route('accounts.show',journal.destination_account.id)}}">{{journal.destination_account.name}}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user