mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-16 09:51:16 +00:00
Fix #10854 and another issue (again).
This commit is contained in:
@@ -26,6 +26,7 @@ namespace FireflyIII\Http\Controllers;
|
|||||||
use FireflyIII\Events\RequestedSendWebhookMessages;
|
use FireflyIII\Events\RequestedSendWebhookMessages;
|
||||||
use FireflyIII\Models\TransactionCurrency;
|
use FireflyIII\Models\TransactionCurrency;
|
||||||
use FireflyIII\Support\Facades\Amount;
|
use FireflyIII\Support\Facades\Amount;
|
||||||
|
use FireflyIII\Support\Facades\Preferences;
|
||||||
use FireflyIII\Support\Facades\Steam;
|
use FireflyIII\Support\Facades\Steam;
|
||||||
use FireflyIII\Support\Http\Controllers\RequestInformation;
|
use FireflyIII\Support\Http\Controllers\RequestInformation;
|
||||||
use FireflyIII\Support\Http\Controllers\UserNavigation;
|
use FireflyIII\Support\Http\Controllers\UserNavigation;
|
||||||
@@ -133,7 +134,7 @@ abstract class Controller extends BaseController
|
|||||||
$this->primaryCurrency = Amount::getPrimaryCurrency();
|
$this->primaryCurrency = Amount::getPrimaryCurrency();
|
||||||
$language = Steam::getLanguage();
|
$language = Steam::getLanguage();
|
||||||
$locale = Steam::getLocale();
|
$locale = Steam::getLocale();
|
||||||
$darkMode = app('preferences')->get('darkMode', 'browser')->data;
|
$darkMode = Preferences::get('darkMode', 'browser')->data;
|
||||||
$this->convertToPrimary = Amount::convertToPrimary();
|
$this->convertToPrimary = Amount::convertToPrimary();
|
||||||
$page = $this->getPageName();
|
$page = $this->getPageName();
|
||||||
$shownDemo = $this->hasSeenDemo();
|
$shownDemo = $this->hasSeenDemo();
|
||||||
|
@@ -85,52 +85,52 @@ class ShowController extends Controller
|
|||||||
public function show(TransactionGroup $transactionGroup)
|
public function show(TransactionGroup $transactionGroup)
|
||||||
{
|
{
|
||||||
/** @var User $admin */
|
/** @var User $admin */
|
||||||
$admin = auth()->user();
|
$admin = auth()->user();
|
||||||
|
|
||||||
// use new group collector:
|
// use new group collector:
|
||||||
/** @var GroupCollectorInterface $collector */
|
/** @var GroupCollectorInterface $collector */
|
||||||
$collector = app(GroupCollectorInterface::class);
|
$collector = app(GroupCollectorInterface::class);
|
||||||
$collector->setUser($admin)->setTransactionGroup($transactionGroup)->withAPIInformation();
|
$collector->setUser($admin)->setTransactionGroup($transactionGroup)->withAPIInformation();
|
||||||
|
|
||||||
/** @var null|TransactionGroup $selectedGroup */
|
/** @var null|TransactionGroup $selectedGroup */
|
||||||
$selectedGroup = $collector->getGroups()->first();
|
$selectedGroup = $collector->getGroups()->first();
|
||||||
if (null === $selectedGroup) {
|
if (null === $selectedGroup) {
|
||||||
throw new NotFoundHttpException();
|
throw new NotFoundHttpException();
|
||||||
}
|
}
|
||||||
|
|
||||||
// enrich
|
// enrich
|
||||||
$enrichment = new TransactionGroupEnrichment();
|
$enrichment = new TransactionGroupEnrichment();
|
||||||
$enrichment->setUser($admin);
|
$enrichment->setUser($admin);
|
||||||
$selectedGroup = $enrichment->enrichSingle($selectedGroup);
|
$selectedGroup = $enrichment->enrichSingle($selectedGroup);
|
||||||
|
|
||||||
|
|
||||||
$splits = count($selectedGroup['transactions']);
|
$splits = count($selectedGroup['transactions']);
|
||||||
$keys = array_keys($selectedGroup['transactions']);
|
$keys = array_keys($selectedGroup['transactions']);
|
||||||
$first = $selectedGroup['transactions'][array_shift($keys)];
|
$first = $selectedGroup['transactions'][array_shift($keys)];
|
||||||
unset($keys);
|
unset($keys);
|
||||||
|
|
||||||
if (null === $first) {
|
if (null === $first) {
|
||||||
throw new FireflyException('This transaction is broken :(.');
|
throw new FireflyException('This transaction is broken :(.');
|
||||||
}
|
}
|
||||||
$type = (string)trans(sprintf('firefly.%s', $first['transaction_type_type']));
|
$type = (string)trans(sprintf('firefly.%s', $first['transaction_type_type']));
|
||||||
$title = 1 === $splits ? $first['description'] : $selectedGroup['title'];
|
$title = 1 === $splits ? $first['description'] : $selectedGroup['title'];
|
||||||
$subTitle = sprintf('%s: "%s"', $type, $title);
|
$subTitle = sprintf('%s: "%s"', $type, $title);
|
||||||
|
|
||||||
// enrich
|
// enrich
|
||||||
$enrichment = new TransactionGroupEnrichment();
|
$enrichment = new TransactionGroupEnrichment();
|
||||||
$enrichment->setUser($admin);
|
$enrichment->setUser($admin);
|
||||||
|
|
||||||
/** @var array $selectedGroup */
|
/** @var array $selectedGroup */
|
||||||
$selectedGroup = $enrichment->enrichSingle($selectedGroup);
|
$selectedGroup = $enrichment->enrichSingle($selectedGroup);
|
||||||
|
|
||||||
/** @var TransactionGroupTransformer $transformer */
|
/** @var TransactionGroupTransformer $transformer */
|
||||||
$transformer = app(TransactionGroupTransformer::class);
|
$transformer = app(TransactionGroupTransformer::class);
|
||||||
$transformer->setParameters(new ParameterBag());
|
$transformer->setParameters(new ParameterBag());
|
||||||
$groupArray = $transformer->transformObject($transactionGroup);
|
$groupArray = $transformer->transformObject($transactionGroup);
|
||||||
|
|
||||||
// do some calculations:
|
// do some calculations:
|
||||||
$amounts = $this->getAmounts($selectedGroup);
|
$amounts = $this->getAmounts($selectedGroup);
|
||||||
$accounts = $this->getAccounts($selectedGroup);
|
$accounts = $this->getAccounts($selectedGroup);
|
||||||
|
|
||||||
foreach (array_keys($selectedGroup['transactions']) as $index) {
|
foreach (array_keys($selectedGroup['transactions']) as $index) {
|
||||||
$selectedGroup['transactions'][$index]['tags'] = $this->repository->getTagObjects((int)$selectedGroup['transactions'][$index]['transaction_journal_id']);
|
$selectedGroup['transactions'][$index]['tags'] = $this->repository->getTagObjects((int)$selectedGroup['transactions'][$index]['transaction_journal_id']);
|
||||||
@@ -142,29 +142,11 @@ class ShowController extends Controller
|
|||||||
$logEntries[$journal['transaction_journal_id']] = $this->aleRepository->getForId(TransactionJournal::class, $journal['transaction_journal_id']);
|
$logEntries[$journal['transaction_journal_id']] = $this->aleRepository->getForId(TransactionJournal::class, $journal['transaction_journal_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$events = $this->repository->getPiggyEvents($transactionGroup);
|
$events = $this->repository->getPiggyEvents($transactionGroup);
|
||||||
$attachments = $this->repository->getAttachments($transactionGroup);
|
$attachments = $this->repository->getAttachments($transactionGroup);
|
||||||
$links = $this->repository->getLinks($transactionGroup);
|
$links = $this->repository->getLinks($transactionGroup);
|
||||||
|
|
||||||
return view(
|
return view('transactions.show', compact('transactionGroup', 'amounts', 'first', 'type', 'logEntries', 'groupLogEntries', 'subTitle', 'splits', 'selectedGroup', 'groupArray', 'events', 'attachments', 'links', 'accounts'));
|
||||||
'transactions.show',
|
|
||||||
compact(
|
|
||||||
'transactionGroup',
|
|
||||||
'amounts',
|
|
||||||
'first',
|
|
||||||
'type',
|
|
||||||
'logEntries',
|
|
||||||
'groupLogEntries',
|
|
||||||
'subTitle',
|
|
||||||
'splits',
|
|
||||||
'selectedGroup',
|
|
||||||
'groupArray',
|
|
||||||
'events',
|
|
||||||
'attachments',
|
|
||||||
'links',
|
|
||||||
'accounts',
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getAmounts(array $group): array
|
private function getAmounts(array $group): array
|
||||||
@@ -173,7 +155,7 @@ class ShowController extends Controller
|
|||||||
foreach ($group['transactions'] as $transaction) {
|
foreach ($group['transactions'] as $transaction) {
|
||||||
// add normal amount:
|
// add normal amount:
|
||||||
$symbol = $transaction['currency_symbol'];
|
$symbol = $transaction['currency_symbol'];
|
||||||
$amounts[$symbol] ??= [
|
$amounts[$symbol] ??= [
|
||||||
'amount' => '0',
|
'amount' => '0',
|
||||||
'symbol' => $symbol,
|
'symbol' => $symbol,
|
||||||
'decimal_places' => $transaction['currency_decimal_places'],
|
'decimal_places' => $transaction['currency_decimal_places'],
|
||||||
@@ -184,7 +166,7 @@ class ShowController extends Controller
|
|||||||
if (null !== $transaction['foreign_amount'] && '' !== $transaction['foreign_amount'] && 0 !== bccomp('0', (string)$transaction['foreign_amount'])) {
|
if (null !== $transaction['foreign_amount'] && '' !== $transaction['foreign_amount'] && 0 !== bccomp('0', (string)$transaction['foreign_amount'])) {
|
||||||
// same for foreign currency:
|
// same for foreign currency:
|
||||||
$foreignSymbol = $transaction['foreign_currency_symbol'];
|
$foreignSymbol = $transaction['foreign_currency_symbol'];
|
||||||
$amounts[$foreignSymbol] ??= [
|
$amounts[$foreignSymbol] ??= [
|
||||||
'amount' => '0',
|
'amount' => '0',
|
||||||
'symbol' => $foreignSymbol,
|
'symbol' => $foreignSymbol,
|
||||||
'decimal_places' => $transaction['foreign_currency_decimal_places'],
|
'decimal_places' => $transaction['foreign_currency_decimal_places'],
|
||||||
@@ -195,7 +177,7 @@ class ShowController extends Controller
|
|||||||
if (null !== $transaction['pc_amount'] && $transaction['currency_id'] !== $this->primaryCurrency->id) {
|
if (null !== $transaction['pc_amount'] && $transaction['currency_id'] !== $this->primaryCurrency->id) {
|
||||||
// same for foreign currency:
|
// same for foreign currency:
|
||||||
$primarySymbol = $this->primaryCurrency->symbol;
|
$primarySymbol = $this->primaryCurrency->symbol;
|
||||||
$amounts[$primarySymbol] ??= [
|
$amounts[$primarySymbol] ??= [
|
||||||
'amount' => '0',
|
'amount' => '0',
|
||||||
'symbol' => $this->primaryCurrency->symbol,
|
'symbol' => $this->primaryCurrency->symbol,
|
||||||
'decimal_places' => $this->primaryCurrency->decimal_places,
|
'decimal_places' => $this->primaryCurrency->decimal_places,
|
||||||
@@ -210,7 +192,7 @@ class ShowController extends Controller
|
|||||||
|
|
||||||
private function getAccounts(array $group): array
|
private function getAccounts(array $group): array
|
||||||
{
|
{
|
||||||
$accounts = [
|
$accounts = [
|
||||||
'source' => [],
|
'source' => [],
|
||||||
'destination' => [],
|
'destination' => [],
|
||||||
];
|
];
|
||||||
|
@@ -370,8 +370,11 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface,
|
|||||||
|
|
||||||
public function getTagObjects(int $journalId): Collection
|
public function getTagObjects(int $journalId): Collection
|
||||||
{
|
{
|
||||||
/** @var TransactionJournal $journal */
|
/** @var TransactionJournal|null $journal */
|
||||||
$journal = $this->user->transactionJournals()->find($journalId);
|
$journal = $this->user->transactionJournals()->find($journalId);
|
||||||
|
if(null ===$journal) {
|
||||||
|
return new Collection();
|
||||||
|
}
|
||||||
|
|
||||||
return $journal->tags()->whereNull('deleted_at')->get();
|
return $journal->tags()->whereNull('deleted_at')->get();
|
||||||
}
|
}
|
||||||
|
@@ -60,15 +60,15 @@ class Amount
|
|||||||
*/
|
*/
|
||||||
public function formatFlat(string $symbol, int $decimalPlaces, string $amount, ?bool $coloured = null): string
|
public function formatFlat(string $symbol, int $decimalPlaces, string $amount, ?bool $coloured = null): string
|
||||||
{
|
{
|
||||||
$locale = Steam::getLocale();
|
$locale = Steam::getLocale();
|
||||||
$rounded = Steam::bcround($amount, $decimalPlaces);
|
$rounded = Steam::bcround($amount, $decimalPlaces);
|
||||||
$coloured ??= true;
|
$coloured ??= true;
|
||||||
|
|
||||||
$fmt = new NumberFormatter($locale, NumberFormatter::CURRENCY);
|
$fmt = new NumberFormatter($locale, NumberFormatter::CURRENCY);
|
||||||
$fmt->setSymbol(NumberFormatter::CURRENCY_SYMBOL, $symbol);
|
$fmt->setSymbol(NumberFormatter::CURRENCY_SYMBOL, $symbol);
|
||||||
$fmt->setAttribute(NumberFormatter::MIN_FRACTION_DIGITS, $decimalPlaces);
|
$fmt->setAttribute(NumberFormatter::MIN_FRACTION_DIGITS, $decimalPlaces);
|
||||||
$fmt->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, $decimalPlaces);
|
$fmt->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, $decimalPlaces);
|
||||||
$result = (string)$fmt->format((float)$rounded); // intentional float
|
$result = (string)$fmt->format((float)$rounded); // intentional float
|
||||||
|
|
||||||
if (true === $coloured) {
|
if (true === $coloured) {
|
||||||
if (1 === bccomp($rounded, '0')) {
|
if (1 === bccomp($rounded, '0')) {
|
||||||
@@ -122,13 +122,13 @@ class Amount
|
|||||||
$key = sprintf('transaction_currency_%d', $currencyId);
|
$key = sprintf('transaction_currency_%d', $currencyId);
|
||||||
|
|
||||||
/** @var null|TransactionCurrency $pref */
|
/** @var null|TransactionCurrency $pref */
|
||||||
$pref = $instance->getPreference($key);
|
$pref = $instance->getPreference($key);
|
||||||
if (null !== $pref) {
|
if (null !== $pref) {
|
||||||
return $pref;
|
return $pref;
|
||||||
}
|
}
|
||||||
$currency = TransactionCurrency::find($currencyId);
|
$currency = TransactionCurrency::find($currencyId);
|
||||||
if (null === $currency) {
|
if (null === $currency) {
|
||||||
$message = sprintf('Could not find a transaction currency with ID #%d', $currencyId);
|
$message = sprintf('Could not find a transaction currency with ID #%d in %s', $currencyId, __METHOD__);
|
||||||
Log::error($message);
|
Log::error($message);
|
||||||
|
|
||||||
throw new FireflyException($message);
|
throw new FireflyException($message);
|
||||||
@@ -144,13 +144,13 @@ class Amount
|
|||||||
$key = sprintf('transaction_currency_%s', $code);
|
$key = sprintf('transaction_currency_%s', $code);
|
||||||
|
|
||||||
/** @var null|TransactionCurrency $pref */
|
/** @var null|TransactionCurrency $pref */
|
||||||
$pref = $instance->getPreference($key);
|
$pref = $instance->getPreference($key);
|
||||||
if (null !== $pref) {
|
if (null !== $pref) {
|
||||||
return $pref;
|
return $pref;
|
||||||
}
|
}
|
||||||
$currency = TransactionCurrency::whereCode($code)->first();
|
$currency = TransactionCurrency::whereCode($code)->first();
|
||||||
if (null === $currency) {
|
if (null === $currency) {
|
||||||
$message = sprintf('Could not find a transaction currency with code "%s"', $code);
|
$message = sprintf('Could not find a transaction currency with code "%s" in %s', $code, __METHOD__);
|
||||||
Log::error($message);
|
Log::error($message);
|
||||||
|
|
||||||
throw new FireflyException($message);
|
throw new FireflyException($message);
|
||||||
@@ -174,8 +174,8 @@ class Amount
|
|||||||
|
|
||||||
return $pref;
|
return $pref;
|
||||||
}
|
}
|
||||||
$key = sprintf('convert_to_primary_%d', $user->id);
|
$key = sprintf('convert_to_primary_%d', $user->id);
|
||||||
$pref = $instance->getPreference($key);
|
$pref = $instance->getPreference($key);
|
||||||
if (null === $pref) {
|
if (null === $pref) {
|
||||||
$res = true === Preferences::getForUser($user, 'convert_to_primary', false)->data && true === config('cer.enabled');
|
$res = true === Preferences::getForUser($user, 'convert_to_primary', false)->data && true === config('cer.enabled');
|
||||||
$instance->setPreference($key, $res);
|
$instance->setPreference($key, $res);
|
||||||
@@ -201,7 +201,7 @@ class Amount
|
|||||||
|
|
||||||
public function getPrimaryCurrencyByUserGroup(UserGroup $userGroup): TransactionCurrency
|
public function getPrimaryCurrencyByUserGroup(UserGroup $userGroup): TransactionCurrency
|
||||||
{
|
{
|
||||||
$cache = new CacheProperties();
|
$cache = new CacheProperties();
|
||||||
$cache->addProperty('getPrimaryCurrencyByGroup');
|
$cache->addProperty('getPrimaryCurrencyByGroup');
|
||||||
$cache->addProperty($userGroup->id);
|
$cache->addProperty($userGroup->id);
|
||||||
if ($cache->has()) {
|
if ($cache->has()) {
|
||||||
@@ -231,16 +231,16 @@ class Amount
|
|||||||
*/
|
*/
|
||||||
public function getAmountFromJournalObject(TransactionJournal $journal): string
|
public function getAmountFromJournalObject(TransactionJournal $journal): string
|
||||||
{
|
{
|
||||||
$convertToPrimary = $this->convertToPrimary();
|
$convertToPrimary = $this->convertToPrimary();
|
||||||
$currency = $this->getPrimaryCurrency();
|
$currency = $this->getPrimaryCurrency();
|
||||||
$field = $convertToPrimary && $currency->id !== $journal->transaction_currency_id ? 'pc_amount' : 'amount';
|
$field = $convertToPrimary && $currency->id !== $journal->transaction_currency_id ? 'pc_amount' : 'amount';
|
||||||
|
|
||||||
/** @var null|Transaction $sourceTransaction */
|
/** @var null|Transaction $sourceTransaction */
|
||||||
$sourceTransaction = $journal->transactions()->where('amount', '<', 0)->first();
|
$sourceTransaction = $journal->transactions()->where('amount', '<', 0)->first();
|
||||||
if (null === $sourceTransaction) {
|
if (null === $sourceTransaction) {
|
||||||
return '0';
|
return '0';
|
||||||
}
|
}
|
||||||
$amount = $sourceTransaction->{$field} ?? '0';
|
$amount = $sourceTransaction->{$field} ?? '0';
|
||||||
if ((int)$sourceTransaction->foreign_currency_id === $currency->id) {
|
if ((int)$sourceTransaction->foreign_currency_id === $currency->id) {
|
||||||
// use foreign amount instead!
|
// use foreign amount instead!
|
||||||
$amount = (string)$sourceTransaction->foreign_amount; // hard coded to be foreign amount.
|
$amount = (string)$sourceTransaction->foreign_amount; // hard coded to be foreign amount.
|
||||||
@@ -288,20 +288,20 @@ class Amount
|
|||||||
private function getLocaleInfo(): array
|
private function getLocaleInfo(): array
|
||||||
{
|
{
|
||||||
// get config from preference, not from translation:
|
// get config from preference, not from translation:
|
||||||
$locale = Steam::getLocale();
|
$locale = Steam::getLocale();
|
||||||
$array = Steam::getLocaleArray($locale);
|
$array = Steam::getLocaleArray($locale);
|
||||||
|
|
||||||
setlocale(LC_MONETARY, $array);
|
setlocale(LC_MONETARY, $array);
|
||||||
$info = localeconv();
|
$info = localeconv();
|
||||||
|
|
||||||
// correct variables
|
// correct variables
|
||||||
$info['n_cs_precedes'] = $this->getLocaleField($info, 'n_cs_precedes');
|
$info['n_cs_precedes'] = $this->getLocaleField($info, 'n_cs_precedes');
|
||||||
$info['p_cs_precedes'] = $this->getLocaleField($info, 'p_cs_precedes');
|
$info['p_cs_precedes'] = $this->getLocaleField($info, 'p_cs_precedes');
|
||||||
|
|
||||||
$info['n_sep_by_space'] = $this->getLocaleField($info, 'n_sep_by_space');
|
$info['n_sep_by_space'] = $this->getLocaleField($info, 'n_sep_by_space');
|
||||||
$info['p_sep_by_space'] = $this->getLocaleField($info, 'p_sep_by_space');
|
$info['p_sep_by_space'] = $this->getLocaleField($info, 'p_sep_by_space');
|
||||||
|
|
||||||
$fmt = new NumberFormatter($locale, NumberFormatter::CURRENCY);
|
$fmt = new NumberFormatter($locale, NumberFormatter::CURRENCY);
|
||||||
|
|
||||||
$info['mon_decimal_point'] = $fmt->getSymbol(NumberFormatter::MONETARY_SEPARATOR_SYMBOL);
|
$info['mon_decimal_point'] = $fmt->getSymbol(NumberFormatter::MONETARY_SEPARATOR_SYMBOL);
|
||||||
$info['mon_thousands_sep'] = $fmt->getSymbol(NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL);
|
$info['mon_thousands_sep'] = $fmt->getSymbol(NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL);
|
||||||
@@ -333,11 +333,11 @@ class Amount
|
|||||||
|
|
||||||
// there are five possible positions for the "+" or "-" sign (if it is even used)
|
// there are five possible positions for the "+" or "-" sign (if it is even used)
|
||||||
// pos_a and pos_e could be the ( and ) symbol.
|
// pos_a and pos_e could be the ( and ) symbol.
|
||||||
$posA = ''; // before everything
|
$posA = ''; // before everything
|
||||||
$posB = ''; // before currency symbol
|
$posB = ''; // before currency symbol
|
||||||
$posC = ''; // after currency symbol
|
$posC = ''; // after currency symbol
|
||||||
$posD = ''; // before amount
|
$posD = ''; // before amount
|
||||||
$posE = ''; // after everything
|
$posE = ''; // after everything
|
||||||
|
|
||||||
// format would be (currency before amount)
|
// format would be (currency before amount)
|
||||||
// AB%sC_D%vE
|
// AB%sC_D%vE
|
||||||
@@ -379,9 +379,9 @@ class Amount
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($csPrecedes) {
|
if ($csPrecedes) {
|
||||||
return $posA.$posB.'%s'.$posC.$space.$posD.'%v'.$posE;
|
return $posA . $posB . '%s' . $posC . $space . $posD . '%v' . $posE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $posA.$posD.'%v'.$space.$posB.'%s'.$posC.$posE;
|
return $posA . $posD . '%v' . $space . $posB . '%s' . $posC . $posE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -114,20 +114,20 @@ class AmountFormat extends AbstractExtension
|
|||||||
{
|
{
|
||||||
return new TwigFunction(
|
return new TwigFunction(
|
||||||
'formatAmountBySymbol',
|
'formatAmountBySymbol',
|
||||||
static function (string $amount, ?string $symbol, ?int $decimalPlaces = null, ?bool $coloured = null): string {
|
static function (string $amount, ?string $symbol = null, ?int $decimalPlaces = null, ?bool $coloured = null): string {
|
||||||
|
|
||||||
if (null === $symbol) {
|
if (null === $symbol) {
|
||||||
$message = sprintf('formatAmountBySymbol("%s", %s, %d, %s) was called without a symbol. Please browse to /flush to clear your cache.', $amount, var_export($symbol, true), $decimalPlaces, var_export($coloured, true));
|
$message = sprintf('formatAmountBySymbol("%s", %s, %d, %s) was called without a symbol. Please browse to /flush to clear your cache.', $amount, var_export($symbol, true), $decimalPlaces, var_export($coloured, true));
|
||||||
Log::error($message);
|
Log::error($message);
|
||||||
|
$currency = Amount::getPrimaryCurrency();
|
||||||
throw new FireflyException($message);
|
}
|
||||||
|
if (null !== $symbol) {
|
||||||
|
$decimalPlaces ??= 2;
|
||||||
|
$coloured ??= true;
|
||||||
|
$currency = new TransactionCurrency();
|
||||||
|
$currency->symbol = $symbol;
|
||||||
|
$currency->decimal_places = $decimalPlaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
$decimalPlaces ??= 2;
|
|
||||||
$coloured ??= true;
|
|
||||||
$currency = new TransactionCurrency();
|
|
||||||
$currency->symbol = $symbol;
|
|
||||||
$currency->decimal_places = $decimalPlaces;
|
|
||||||
|
|
||||||
return Amount::formatAnything($currency, $amount, $coloured);
|
return Amount::formatAnything($currency, $amount, $coloured);
|
||||||
},
|
},
|
||||||
|
@@ -203,7 +203,7 @@
|
|||||||
{% set boxSize = 4 %}
|
{% set boxSize = 4 %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% for index,journal in selectedGroup.transactions %}
|
{% for index, journal in selectedGroup.transactions %}
|
||||||
<div class="col-lg-{{ boxSize }}">
|
<div class="col-lg-{{ boxSize }}">
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<div class="box-header with-border">
|
<div class="box-header with-border">
|
||||||
@@ -440,7 +440,7 @@
|
|||||||
<td style="width:40%;">{{ 'tags'|_ }}</td>
|
<td style="width:40%;">{{ 'tags'|_ }}</td>
|
||||||
<td>
|
<td>
|
||||||
{% for tag in journal.tags %}
|
{% for tag in journal.tags %}
|
||||||
{% if null != tag.id %}
|
{% if null != tag.id and '' != tag.id %}
|
||||||
<h4 style="display: inline;"><a class="label label-success" href="{{ route('tags.show', [tag.id]) }}"><span class="fa fa-fw fa-tag"></span>{{ tag.tag }}</a></h4>
|
<h4 style="display: inline;"><a class="label label-success" href="{{ route('tags.show', [tag.id]) }}"><span class="fa fa-fw fa-tag"></span>{{ tag.tag }}</a></h4>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
Reference in New Issue
Block a user