mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Removed unused Twig methods.
This commit is contained in:
parent
394ef23eda
commit
48e8cd20b4
@ -19,7 +19,6 @@ use FireflyIII\Support\FireflyConfig;
|
|||||||
use FireflyIII\Support\Navigation;
|
use FireflyIII\Support\Navigation;
|
||||||
use FireflyIII\Support\Preferences;
|
use FireflyIII\Support\Preferences;
|
||||||
use FireflyIII\Support\Steam;
|
use FireflyIII\Support\Steam;
|
||||||
use FireflyIII\Support\Twig\Budget;
|
|
||||||
use FireflyIII\Support\Twig\General;
|
use FireflyIII\Support\Twig\General;
|
||||||
use FireflyIII\Support\Twig\Journal;
|
use FireflyIII\Support\Twig\Journal;
|
||||||
use FireflyIII\Support\Twig\PiggyBank;
|
use FireflyIII\Support\Twig\PiggyBank;
|
||||||
@ -51,7 +50,6 @@ class FireflyServiceProvider extends ServiceProvider
|
|||||||
Twig::addExtension(new PiggyBank);
|
Twig::addExtension(new PiggyBank);
|
||||||
Twig::addExtension(new General);
|
Twig::addExtension(new General);
|
||||||
Twig::addExtension(new Journal);
|
Twig::addExtension(new Journal);
|
||||||
Twig::addExtension(new Budget);
|
|
||||||
Twig::addExtension(new Translation);
|
Twig::addExtension(new Translation);
|
||||||
Twig::addExtension(new Transaction);
|
Twig::addExtension(new Transaction);
|
||||||
Twig::addExtension(new Rule);
|
Twig::addExtension(new Rule);
|
||||||
|
@ -1,68 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Budget.php
|
|
||||||
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
|
||||||
*
|
|
||||||
* This software may be modified and distributed under the terms of the
|
|
||||||
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
|
||||||
*
|
|
||||||
* See the LICENSE file for details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types = 1);
|
|
||||||
|
|
||||||
namespace FireflyIII\Support\Twig;
|
|
||||||
|
|
||||||
use FireflyIII\Models\LimitRepetition;
|
|
||||||
use FireflyIII\Support\CacheProperties;
|
|
||||||
use Twig_Extension;
|
|
||||||
use Twig_SimpleFunction;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class Budget
|
|
||||||
*
|
|
||||||
* @package FireflyIII\Support\Twig
|
|
||||||
*/
|
|
||||||
class Budget extends Twig_Extension
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public function getFunctions(): array
|
|
||||||
{
|
|
||||||
$functions = [];
|
|
||||||
$functions[] = new Twig_SimpleFunction(
|
|
||||||
'spentInRepetition', function (LimitRepetition $repetition) {
|
|
||||||
$cache = new CacheProperties;
|
|
||||||
$cache->addProperty($repetition->id);
|
|
||||||
$cache->addProperty('spentInRepetition');
|
|
||||||
if ($cache->has()) {
|
|
||||||
return $cache->get();
|
|
||||||
}
|
|
||||||
$sum
|
|
||||||
= auth()->user()->transactionJournals()
|
|
||||||
->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('limit_repetitions', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id')
|
|
||||||
->before($repetition->enddate)
|
|
||||||
->after($repetition->startdate)
|
|
||||||
->where('limit_repetitions.id', '=', $repetition->id)
|
|
||||||
->get(['transaction_journals.*'])->sum('amount');
|
|
||||||
$cache->store($sum);
|
|
||||||
|
|
||||||
return $sum;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return $functions;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public function getName(): string
|
|
||||||
{
|
|
||||||
return 'FireflyIII\Support\Twig\Budget';
|
|
||||||
}
|
|
||||||
}
|
|
@ -40,7 +40,6 @@ class General extends Twig_Extension
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
$this->formatAmount(),
|
$this->formatAmount(),
|
||||||
$this->formatTransaction(),
|
|
||||||
$this->formatAmountPlain(),
|
$this->formatAmountPlain(),
|
||||||
$this->formatJournal(),
|
$this->formatJournal(),
|
||||||
$this->balance(),
|
$this->balance(),
|
||||||
@ -236,18 +235,6 @@ class General extends Twig_Extension
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Twig_SimpleFilter
|
|
||||||
*/
|
|
||||||
protected function formatTransaction(): Twig_SimpleFilter
|
|
||||||
{
|
|
||||||
return new Twig_SimpleFilter(
|
|
||||||
'formatTransaction', function (Transaction $transaction) : string {
|
|
||||||
return app('amount')->formatTransaction($transaction);
|
|
||||||
}, ['is_safe' => ['html']]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Twig_SimpleFilter
|
* @return Twig_SimpleFilter
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user