Complex but workable code for #865

This commit is contained in:
James Cole
2017-09-26 10:59:17 +02:00
parent d99adb515a
commit 6f55049fb6
3 changed files with 70 additions and 0 deletions

View File

@@ -49,6 +49,7 @@ class AmountFormat extends Twig_Extension
$this->formatAmountBySymbol(),
$this->transactionAmount(),
$this->journalAmount(),
$this->journalTotalAmount(),
$this->formatDestinationAfter(),
$this->formatDestinationBefore(),
$this->formatSourceAfter(),
@@ -261,6 +262,19 @@ class AmountFormat extends Twig_Extension
);
}
/**
* @return Twig_SimpleFunction
*/
protected function journalTotalAmount(): Twig_SimpleFunction
{
return new Twig_SimpleFunction(
'journalTotalAmount', function (TransactionJournal $journal): string {
return app('amount')->journalTotalAmount($journal, true);
}, ['is_safe' => ['html']]
);
}
/**
* @return Twig_SimpleFunction
*/